Skip to content
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
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Dev Environment Setup

Use bun instead of node
Use ruff for python linting/formatting
Use ruff for python linting/formatting
Use uv instead of pip/python unless necessary

# Code Styling

Expand Down
File renamed without changes.
15 changes: 10 additions & 5 deletions client/src/lib/components/plans/course-dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
let sectionCount: number = $state(0);
let terms: string[] = $state([]);

$inspect(sections).with(console.log);
const restructureData = () => {};

const getCourseInfo = async () => {
const res = await fetch(getCourseSectionsByTerm(course!.value, term));
if (res.ok) {
Expand All @@ -22,6 +23,8 @@
sections = data.sections;
sectionCount = data.count;
terms = data.terms ?? [];

restructureData();
}
};

Expand All @@ -33,9 +36,11 @@
</script>

<Dialog.Root bind:open>
<Dialog.Content class={cn({ 'sm:max-w-500': terms.includes(term) })}>
<Dialog.Content class={cn({ 'sm:max-w-500': terms.includes(term) })}>
<Dialog.Header>
<Dialog.Title class="font-bold text-lg md:text-xl">{course?.label || 'Course Details'}</Dialog.Title>
<Dialog.Title class="text-lg font-bold md:text-xl"
>{course?.label || 'Course Details'}</Dialog.Title
>
<Dialog.Description>
See the details for this course and add it to your plan.
</Dialog.Description>
Expand All @@ -55,10 +60,10 @@
{/if}
</div>
{:else}
{#each Object.entries(sections) as [name, schedules]}
{#each Object.entries(sections) as [name, schedules] (name)}
<div>
<strong>{name}</strong>
{#each schedules as schedule}
{#each schedules as schedule (schedule.id)}
{schedule.instructor}
{/each}
</div>
Expand Down
4 changes: 0 additions & 4 deletions client/src/lib/components/plans/course-search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
const filteredCourses = $derived(
COURSES.filter((c) => c.label.toLowerCase().includes(searchQuery.toLowerCase())).slice(0, 5)
);

function labelForCourse(value: string) {
return COURSES.find((c) => c.value === value)?.label || 'Search for a course...';
}
</script>

<div class="mb-4 w-full">
Expand Down
3 changes: 1 addition & 2 deletions client/src/lib/components/plans/course.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

let { info }: Props = $props();

$inspect(info.types).with(console.log);
const classTypes = $derived(
info.types
.map((x, i) => {
Expand Down Expand Up @@ -37,7 +36,7 @@
<span>
Professors Include:
<span class="space-y-2 space-x-2 font-medium">
{#each info.teachers as teacher}
{#each info.teachers as teacher (teacher.id)}
{#if teacher.name !== 'Staff'}
<Button variant="link" class="p-0 text-white dark:text-black">{teacher.name}</Button>
{/if}
Expand Down
4 changes: 1 addition & 3 deletions client/src/lib/components/plans/plan.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Button from '$lib/components/ui/button/button.svelte';
import * as Dialog from '$lib/components/ui/dialog';
import type { Plan } from '$lib/types';
import { cn, getTermNumber, getTermString } from '$lib/utils';
import { cn, getTermString } from '$lib/utils';
import { GraduationCapIcon, TrashSimpleIcon } from 'phosphor-svelte';

type Props = {
Expand All @@ -12,8 +12,6 @@
};
let { plan, index }: Props = $props();



const term = $derived(getTermString(plan.term));

const tints = ['bg-purple-200', 'bg-blue-200', 'bg-teal-200', 'bg-rose-200'] as const;
Expand Down
10 changes: 3 additions & 7 deletions client/src/lib/components/ui/button/button.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable svelte/no-navigation-without-resolve -->
<script lang="ts" module>
import { resolve } from '$app/paths';
import { cn, type WithElementRef } from '$lib/utils.js';
Expand Down Expand Up @@ -47,12 +48,6 @@
function isAbsolute(href: string) {
return href.startsWith('http://') || href.startsWith('https://') || href.startsWith('//');
}

function resolveHref(href: string) {
if (isAbsolute(href)) return href;
//@ts-expect-error
return resolve(href as Parameters<typeof resolve>[0]);
}
</script>

<script lang="ts">
Expand All @@ -74,7 +69,8 @@
bind:this={ref}
data-slot="button"
class={cn(buttonVariants({ variant, size }), className)}
href={disabled ? undefined : resolveHref(href)}
//@ts-expect-error svelte links
href={disabled ? undefined : isAbsolute(href) ? href : resolve(href)}
aria-disabled={disabled}
role={disabled ? 'link' : undefined}
tabindex={disabled ? -1 : undefined}
Expand Down
2 changes: 0 additions & 2 deletions client/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export interface TeacherInfo {
numRatings: number;
}



export interface PlanCourse {
id: string;
courseId: number;
Expand Down
4 changes: 1 addition & 3 deletions client/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TermNumber, TermString } from "$lib/types";
import type { TermNumber, TermString } from '$lib/types';
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';

Expand All @@ -13,8 +13,6 @@ export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'childre
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };



export function getTermString(t: TermNumber): string {
const term = {
'2259': 'Fall 2025',
Expand Down
7 changes: 6 additions & 1 deletion client/src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
Continue with your Google account to get started.
</p>

<Button href={getAuthLoginHref()} variant="secondary" size="sm" class="shadow-[inset_0_0_5px_1px_rgba(255,255,255,0.2)]">
<Button
href={getAuthLoginHref()}
variant="secondary"
size="sm"
class="shadow-[inset_0_0_5px_1px_rgba(255,255,255,0.2)]"
>
<span class="inline-flex size-6 shrink-0 items-center justify-center">
<Google />
</span>
Expand Down
2 changes: 1 addition & 1 deletion client/src/routes/plans/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</script>

<main
class="mx-auto flex max-w-7xl flex-col items-center justify-between py-5 text-zinc-900 selection:bg-brand-purple selection:text-white dark:text-zinc-100 h-screen"
class="mx-auto flex h-screen max-w-7xl flex-col items-center justify-between py-5 text-zinc-900 selection:bg-brand-purple selection:text-white dark:text-zinc-100"
>
<Navbar />
{@render children()}
Expand Down
93 changes: 49 additions & 44 deletions client/src/routes/plans/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,56 @@ export const load: PageServerLoad = async ({ locals, params, request }) => {
updatedAt: body.updated_at,
userID: body.user_id,
courseCount: body.course_count,
courses: body.courses?.map((c: any) => ({
id: c.id,
courseId: c.course_id,
code: c.code,
name: c.name,
description: c.description,
restrictions: c.restrictions,
prerequisites: c.prerequisites || [],
units: c.units,
types: c.types || [],
teachers: c.teachers?.map((t: any) => ({
id: t.id,
name: t.name,
avgRating: t.avg_rating,
avgDifficulty: t.avg_difficulty,
department: t.department,
rmpId: t.rmp_id,
numRatings: t.num_ratings
})) || [],
sections: c.sections?.map((s: any) => ({
id: s.id,
name: s.name,
type: s.type,
term: s.term,
mode: s.mode,
isInPerson: s.is_in_person,
meetings: s.meetings?.map((m: any) => ({
id: m.id,
days: m.days,
startTime: m.start_time,
endTime: m.end_time,
building: m.building,
room: m.room
})) || [],
teachers: s.teachers?.map((t: any) => ({
id: t.id,
name: t.name,
avgRating: t.avg_rating,
avgDifficulty: t.avg_difficulty,
department: t.department,
rmpId: t.rmp_id,
numRatings: t.num_ratings
})) || []
courses:
body.courses?.map((c: any) => ({
id: c.id,
courseId: c.course_id,
code: c.code,
name: c.name,
description: c.description,
restrictions: c.restrictions,
prerequisites: c.prerequisites || [],
units: c.units,
types: c.types || [],
teachers:
c.teachers?.map((t: any) => ({
id: t.id,
name: t.name,
avgRating: t.avg_rating,
avgDifficulty: t.avg_difficulty,
department: t.department,
rmpId: t.rmp_id,
numRatings: t.num_ratings
})) || [],
sections:
c.sections?.map((s: any) => ({
id: s.id,
name: s.name,
type: s.type,
term: s.term,
mode: s.mode,
isInPerson: s.is_in_person,
meetings:
s.meetings?.map((m: any) => ({
id: m.id,
days: m.days,
startTime: m.start_time,
endTime: m.end_time,
building: m.building,
room: m.room
})) || [],
teachers:
s.teachers?.map((t: any) => ({
id: t.id,
name: t.name,
avgRating: t.avg_rating,
avgDifficulty: t.avg_difficulty,
department: t.department,
rmpId: t.rmp_id,
numRatings: t.num_ratings
})) || []
})) || []
})) || []
})) || []
};

return {
Expand Down
8 changes: 4 additions & 4 deletions client/src/routes/plans/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import CourseSearch from '$lib/components/plans/course-search.svelte';
import Course from '$lib/components/plans/course.svelte';
import { Button } from '$lib/components/ui/button';
import { getTermString } from '$lib/utils';
import { ArrowLeftIcon } from 'phosphor-svelte';
import type { PageProps } from './$types';
import { getTermNumber, getTermString } from "$lib/utils";

let { data }: PageProps = $props();
const plan = $derived(data.plan);
</script>

<svelte:head>
<title> {plan?.title ?? plan?.term} | PathWeave</title>
<title>{plan?.title ?? plan?.term} | PathWeave</title>
</svelte:head>

<main class="mt-40 flex h-full w-full flex-col gap-4">
Expand All @@ -25,13 +25,13 @@
<h1 class="md:font-4xl font-gro text-3xl font-bold text-primary md:text-5xl">
{plan?.title}
</h1>
<span class="">{getTermString(plan!.term)}</span>
<span class="">{getTermString(plan!.term)}</span>
</section>
<section class="grid h-full gap-4 md:grid-cols-3">
<section class="">
<CourseSearch term={plan?.term} />
<div>
{#each plan?.courses || [] as course}
{#each plan?.courses || [] as course (course.id)}
<Course info={course} />
{/each}
</div>
Expand Down
Loading
Loading