Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Profile Page #759

Merged
merged 11 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"update:grades": "tsx --env-file=.env ./src/scripts/update-grade-distributions.ts"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/core": "^7.26.7",
"@babel/preset-env": "^7.26.7",
"@babel/preset-typescript": "^7.26.0",
"@graphql-codegen/cli": "5.0.3",
"@graphql-codegen/graphql-modules-preset": "^4.0.12",
Expand All @@ -22,41 +22,41 @@
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.17",
"@types/express-session": "^1.18.1",
"@types/lodash": "^4.17.13",
"@types/node": "^22.10.0",
"@types/lodash": "^4.17.14",
"@types/node": "^22.10.10",
"@types/passport-google-oauth20": "^2.0.16",
"tsx": "^4.19.2",
"@types/papaparse": "^5.3.15",
"typescript": "^5.7.2"
"typescript": "^5.7.3"
},
"dependencies": {
"@apollo/server": "^4.11.2",
"@apollo/server-plugin-response-cache": "^4.1.3",
"@apollo/server": "^4.11.3",
"@apollo/server-plugin-response-cache": "^4.1.4",
"@apollo/utils.keyvadapter": "^4.0.0",
"@aws-sdk/client-athena": "^3.699.0",
"@aws-sdk/client-s3": "^3.701.0",
"@aws-sdk/client-athena": "^3.734.0",
"@aws-sdk/client-s3": "^3.735.0",
"@escape.tech/graphql-armor": "^3.1.2",
"@graphql-tools/schema": "^10.0.10",
"@graphql-tools/utils": "^10.6.1",
"@keyv/redis": "^4.0.2",
"@graphql-tools/schema": "^10.0.16",
"@graphql-tools/utils": "^10.7.2",
"@keyv/redis": "^4.2.0",
"@repo/common": "*",
"@repo/sis-api": "*",
"compression": "^1.7.5",
"connect-redis": "^7.1.1",
"connect-redis": "^8.0.1",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.1",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"express-session": "^1.18.1",
"fuse.js": "^7.0.0",
"graphql": "^16.9.0",
"graphql": "^16.10.0",
"graphql-modules": "^2.4.0",
"graphql-type-json": "^0.3.2",
"helmet": "^8.0.0",
"keyv": "^5.2.1",
"keyv": "^5.2.3",
"lodash": "^4.17.21",
"mongodb": "^6.11.0",
"mongoose": "^8.8.3",
"papaparse": "^5.4.1",
"mongodb": "^6.12.0",
"mongoose": "^8.9.5",
"papaparse": "^5.5.1",
"passport": "^0.7.0",
"passport-google-oauth20": "^2.0.0",
"redis": "^4.7.0"
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/bootstrap/loaders/passport.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import RedisStore from "connect-redis";
import { RedisStore } from "connect-redis";
import type { Application } from "express";
import session from "express-session";
import passport from "passport";
Expand Down
11 changes: 6 additions & 5 deletions apps/backend/src/modules/catalog/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GraphQLResolveInfo } from "graphql";

import {
ClassModel,
ClassType,
CourseModel,
CourseType,
GradeDistributionModel,
Expand Down Expand Up @@ -480,7 +481,7 @@ export const getCatalog = async (
const id = getId(course?.identifiers);
if (!id) return accumulator;

accumulator[id] = course;
accumulator[id] = course as CourseType;
return accumulator;
},
{} as Record<string, CourseType>
Expand All @@ -495,9 +496,9 @@ export const getCatalog = async (
const id = `${courseId}-${number}`;
if (!id) return accumulator;

accumulator[id] = accumulator[id]
? [...accumulator[id], section]
: [section];
accumulator[id] = (
accumulator[id] ? [...accumulator[id], section] : [section]
) as SectionType[];

return accumulator;
},
Expand Down Expand Up @@ -537,7 +538,7 @@ export const getCatalog = async (
}

const formattedClass = {
...formatClass(_class),
...formatClass(_class as ClassType),
primarySection: formattedPrimarySection,
sections: formattedSections,
course: formattedCourse,
Expand Down
10 changes: 5 additions & 5 deletions apps/backend/src/modules/class/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassModel, SectionModel } from "@repo/common";
import { ClassModel, ClassType, SectionModel, SectionType } from "@repo/common";

import { formatClass, formatSection } from "./formatter";

Expand All @@ -18,7 +18,7 @@ export const getClass = async (

if (!_class) return null;

return formatClass(_class);
return formatClass(_class as ClassType);
};

export const getSecondarySections = async (
Expand All @@ -35,7 +35,7 @@ export const getSecondarySections = async (
"class.number": { $regex: `^(${number[number.length - 1]}|999)` },
}).lean();

return sections.map(formatSection);
return sections.map((section) => formatSection(section as SectionType));
};

export const getPrimarySection = async (
Expand All @@ -54,7 +54,7 @@ export const getPrimarySection = async (

if (!section) return null;

return formatSection(section);
return formatSection(section as SectionType);
};

export const getSection = async (
Expand All @@ -73,5 +73,5 @@ export const getSection = async (

if (!section) return null;

return formatSection(section);
return formatSection(section as SectionType);
};
8 changes: 4 additions & 4 deletions apps/backend/src/modules/course/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassModel, CourseModel } from "@repo/common";
import { ClassModel, ClassType, CourseModel, CourseType } from "@repo/common";

import { formatClass } from "../class/formatter";
import { IntermediateCourse, formatCourse } from "./formatter";
Expand All @@ -14,7 +14,7 @@ export const getCourse = async (subject: string, number: string) => {

if (!course) return null;

return formatCourse(course);
return formatCourse(course as CourseType);
};

export const getClassesByCourse = async (
Expand All @@ -26,7 +26,7 @@ export const getClassesByCourse = async (
"course.catalogNumber.formatted": courseNumber,
}).lean();

return classes.map(formatClass);
return classes.map((_class) => formatClass(_class as ClassType));
};

export const getAssociatedCourses = async (courses: string[]) => {
Expand Down Expand Up @@ -60,7 +60,7 @@ export const getAssociatedCourses = async (courses: string[]) => {
associatedCourse.catalogNumber?.formatted
) === index
)
.map(formatCourse)
.map((course) => formatCourse(course as CourseType))
);
};

Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/modules/schedule/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassModel, ScheduleModel, TermModel } from "@repo/common";
import { ClassModel, ClassType, ScheduleModel, TermModel } from "@repo/common";

import {
CreateScheduleInput,
Expand Down Expand Up @@ -115,7 +115,7 @@ export const getClasses = async (
if (!_class) continue;

classes.push({
class: formatClass(_class) as unknown as ClassModule.Class,
class: formatClass(_class as ClassType) as unknown as ClassModule.Class,
selectedSections: selectedClass.sections,
} as ScheduleModule.SelectedClass);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/src/modules/term/controller.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TermModel } from "@repo/common";
import { TermModel, TermType } from "@repo/common";

import { Semester } from "../../generated-types/graphql";
import { formatTerm } from "./formatter";

export const getTerms = async () => {
const terms = await TermModel.find().lean();

return terms.map(formatTerm);
return terms.map((term) => formatTerm(term as TermType));
};

export const getTerm = async (year: number, semester: Semester) => {
Expand All @@ -16,5 +16,5 @@ export const getTerm = async (year: number, semester: Semester) => {

if (!term) return null;

return formatTerm(term);
return formatTerm(term as TermType);
};
12 changes: 9 additions & 3 deletions apps/backend/src/modules/user/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ClassModel, CourseModel, UserModel } from "@repo/common";
import {
ClassModel,
ClassType,
CourseModel,
CourseType,
UserModel,
} from "@repo/common";

import { UpdateUserInput } from "../../generated-types/graphql";
import { formatClass } from "../class/formatter";
Expand Down Expand Up @@ -45,7 +51,7 @@ export const getBookmarkedCourses = async (

if (!course) continue;

courses.push(course);
courses.push(course as CourseType);
}

return courses.map(formatCourse);
Expand All @@ -66,7 +72,7 @@ export const getBookmarkedClasses = async (

if (!_class) continue;

classes.push(_class);
classes.push(_class as ClassType);
}

return classes.map(formatClass);
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/scripts/update-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ const initialize = async () => {
);

console.log("\n=== UPDATE CLASSES ===");
await updateClasses(filteredTerms);
await updateClasses(filteredTerms as TermType[]);

console.log("\n=== UPDATE SECTIONS ===");
await updateSections(filteredTerms);
await updateSections(filteredTerms as TermType[]);
} catch (error) {
console.error(error);

Expand Down
10 changes: 5 additions & 5 deletions apps/datapuller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"main": "tsx src/main.ts"
},
"devDependencies": {
"@types/node": "^22.10.0",
"eslint": "^9.15.0",
"typescript": "^5.7.2"
"@types/node": "^22.10.10",
"eslint": "^9.19.0",
"typescript": "^5.7.3"
},
"dependencies": {
"@aws-sdk/client-athena": "^3.734.0",
"@aws-sdk/client-s3": "^3.734.0",
"@aws-sdk/client-s3": "^3.735.0",
"@repo/common": "*",
"@repo/sis-api": "*",
"dotenv": "^16.4.5",
"dotenv": "^16.4.7",
"papaparse": "^5.5.1",
"tslog": "^4.9.3"
}
Expand Down
53 changes: 27 additions & 26 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,45 @@
"start": "serve -s dist -p 3000"
},
"dependencies": {
"@apollo/client": "3.11.10",
"@floating-ui/dom": "^1.6.12",
"@apollo/client": "3.12.7",
"@floating-ui/dom": "^1.6.13",
"@mapbox/mapbox-gl-directions": "^4.3.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-hover-card": "^1.1.2",
"@radix-ui/react-radio-group": "^1.2.1",
"@radix-ui/react-scroll-area": "^1.2.1",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.4",
"@radix-ui/react-checkbox": "^1.1.3",
"@radix-ui/react-dialog": "^1.1.5",
"@radix-ui/react-dropdown-menu": "^2.1.5",
"@radix-ui/react-hover-card": "^1.1.5",
"@radix-ui/react-radio-group": "^1.2.2",
"@radix-ui/react-scroll-area": "^1.2.2",
"@radix-ui/react-select": "^2.1.5",
"@radix-ui/react-separator": "^1.1.1",
"@radix-ui/react-tabs": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.7",
"@repo/theme": "*",
"@shopify/draggable": "^1.1.3",
"@tanstack/react-virtual": "^3.10.9",
"@tanstack/react-virtual": "^3.11.2",
"babel-plugin-react-compiler": "^19.0.0-beta-decd7b8-20250118",
"classnames": "^2.5.1",
"fuse.js": "^7.0.0",
"graphql": "^16.9.0",
"iconoir-react": "^7.10.0",
"mapbox-gl": "^3.8.0",
"graphql": "^16.10.0",
"iconoir-react": "^7.10.1",
"mapbox-gl": "^3.9.3",
"moment": "^2.30.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.0.1",
"recharts": "^2.13.3"
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.1.3",
"recharts": "^2.15.0"
},
"devDependencies": {
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@types/mapbox-gl": "^3.4.1",
"@types/node": "^22.10.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/node": "^22.10.10",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.15.0",
"eslint": "^9.19.0",
"serve": "^14.2.4",
"typescript": "^5.7.2",
"vite": "^6.0.1"
"typescript": "^5.7.3",
"vite": "^6.0.11"
}
}
11 changes: 11 additions & 0 deletions apps/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import Landing from "@/app/Landing";
import Layout from "@/components/Layout";
import PinsProvider from "@/components/PinsProvider";

const Profile = lazy(() => import("@/app/Profile"));

// TODO: Experiment with server-side rendering for static pages and hydration for dynamic pages

const Class = {
Expand Down Expand Up @@ -88,6 +90,15 @@ const router = createBrowserRouter([
},
],
},
{
element: <Layout />,
children: [
{
element: <Profile />,
path: "profile",
},
],
},
{
element: <Layout footer={false} />,
children: [
Expand Down
Loading