Skip to content

update staging with main #325

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

Merged
merged 17 commits into from
Oct 29, 2024
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
2 changes: 2 additions & 0 deletions backend/src/repositories/course.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
CourseCodeSchema,
CourseSchema,
} from "../api/schemas/course.schema";
import e from "express";
import { Console } from "console";

export class CourseRepository {
constructor(private readonly prisma: PrismaClient) {}
Expand Down
54 changes: 27 additions & 27 deletions frontend/src/app/course/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function generateMetadata(props: {
};
}): Promise<Metadata> {
const { course } = (await get(
`/course/${props.params.id.toUpperCase()}`
`/course/${props.params.id.toUpperCase()}`,
)) as {
course: Course;
};
Expand All @@ -50,7 +50,7 @@ export default async function ReviewPage({
if (!course) notFound();

const { reviews } = (await get(
`/reviews/${course.courseCode.toUpperCase()}`
`/reviews/${course.courseCode.toUpperCase()}`,
)) as Reviews;

let userCourseInfo: string[] = [];
Expand All @@ -60,7 +60,7 @@ export default async function ReviewPage({
"GET",
`/user/course/${params.id.toUpperCase()}`,
session?.user?.accessToken ?? "",
session?.user?.id ?? ""
session?.user?.id ?? "",
)) as { userCourseInfo: string[] };
userCourseInfo = res.userCourseInfo;
} catch (err) {
Expand Down Expand Up @@ -91,7 +91,7 @@ export default async function ReviewPage({
// };

return (
<div className='isolate bg-white dark:bg-slate-800 duration-150'>
<div className="isolate bg-white dark:bg-slate-800 duration-150">
{/* Structured data */}
<Head>
<script
Expand Down Expand Up @@ -119,53 +119,53 @@ export default async function ReviewPage({
/>
</Head>
{/* Header */}
<div className='relative'>
<div className='w-1/2 ml-auto md:w-full pr-16 md:px-8 py-8'>
<div className="relative">
<div className="w-1/2 ml-auto md:w-full pr-16 md:px-8 py-8">
{/* Search bar */}
<ReviewSearchbar />
</div>
{/* Waves */}
<Image
className='w-full h-full absolute object-cover top-0 -z-10 dark:opacity-75'
className="w-full h-full absolute object-cover top-0 -z-10 dark:opacity-75"
src={waves}
alt='Waves'
alt="Waves"
/>
</div>
{/* Course details */}
<div className='flex gap-8 pt-12 px-16 md:px-8 lg:pt-8 md:flex-wrap'>
<div className="flex gap-8 pt-12 px-16 md:px-8 lg:pt-8 md:flex-wrap">
<Suspense fallback={<div>Loading...</div>}>
{/* <script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(metaLD) }}
/> */}
<section className='space-y-4 w-full block md:static md:max-h-full sticky top-8 max-h-[calc(100vh-4rem)] overflow-y-scroll scrollbar-none'>
<h1 className='text-6xl font-bold break-words'>
<section className="space-y-4 w-full block md:static md:max-h-full sticky top-8 max-h-[calc(100vh-4rem)] overflow-y-scroll scrollbar-none">
<h1 className="text-6xl font-bold break-words">
{course.courseCode}
</h1>
<h2 className='text-3xl font-bold break-words'>{course.title}</h2>
<h2 className="text-3xl font-bold break-words">{course.title}</h2>
{/* Terms */}
<TermsGroup
className='py-1 px-2 rounded-full bg-unilectives-tags-pink font-bold text-black/50'
className="py-1 px-2 rounded-full bg-unilectives-tags-pink font-bold text-black/50"
terms={course.terms}
/>
{/* Link to handbook */}
<Link
target='_blank'
rel='noopener noreferrer'
target="_blank"
rel="noopener noreferrer"
href={`//www.handbook.unsw.edu.au/undergraduate/courses/${new Date().getFullYear()}/${
course.courseCode
}`}
className='flex items-center w-fit gap-1 text-unilectives-blue hover:underline flex-1'
className="flex items-center w-fit gap-1 text-unilectives-blue hover:underline flex-1"
>
<LinkIcon className='w-4 h-4' />
<LinkIcon className="w-4 h-4" />
{course.courseCode} Handbook Page
</Link>
{/* StarRating */}
<div className='space-x-2'>
<div className='text-2xl inline'>
<div className="space-x-2">
<div className="text-2xl inline">
<Rating
type='star'
color='purple'
type="star"
color="purple"
overallRating={course.overallRating}
/>
</div>
Expand All @@ -182,7 +182,7 @@ export default async function ReviewPage({
</span>
</div>
{/* Doughnut Charts */}
<div className='flex flex-wrap justify-around'>
<div className="flex flex-wrap justify-around">
{[
{ metric: course.enjoyability, title: "Enjoyment" },
{ metric: course.usefulness, title: "Usefulness" },
Expand All @@ -194,30 +194,30 @@ export default async function ReviewPage({
width={90}
strokeWidth={9}
/>
<p className='text-center font-bold'>{item.title}</p>
<p className="text-center font-bold">{item.title}</p>
</div>
))}
</div>
{/* Pre-requisites group */}
{course.enrolmentRules ? (
<div>
<h3 className='font-bold'>Enrolment Rules</h3>
<h3 className="font-bold">Enrolment Rules</h3>
<p>{course.enrolmentRules}</p>
</div>
) : (
<div></div>
)}
<div>
<h3 className='font-bold'>Description</h3>
<p className='whitespace-pre-line'>{course.description}</p>
<h3 className="font-bold">Description</h3>
<p className="whitespace-pre-line">{course.description}</p>
</div>
</section>
</Suspense>
{/* Reviews */}
{/* Show reviews is separated as another client component "ReviewsBar"
so the review page can stay as a server side component to ensure server side
rendering */}
<section className='space-y-4 w-full mb-8'>
<section className="space-y-4 w-full max-w-[50%] md:max-w-full mb-8">
<Suspense fallback={<div>Loading...</div>}>
<ReviewsBar
courseCode={course.courseCode}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default async function RootLayout({
`,
}}
/>
<script defer data-domain="cselectives.staging.csesoc.unsw.edu.au" src="https://plausible.io/js/script.js"></script>
<script defer data-domain="unilectives.devsoc.app" src="https://plausible.unilectives.com/js/script.outbound-links.tagged-events.js"></script>
</head>
<body className="bg-white dark:bg-slate-800 dark:text-gray-200">
<Provider session={session}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function TruncatedDescription({
newMax++;
index++;
}

if (index === content.length) {
setShortenedContent(content);
} else {
Expand All @@ -50,7 +51,7 @@ export default function TruncatedDescription({
}, [content])

return (
<div>
<div className="break-words">
<p className="whitespace-pre-line text-justify">
{showFullContent ? content : shortenedContent}
</p>
Expand Down
2 changes: 1 addition & 1 deletion migration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.2-alpine
FROM node:20.4-alpine

# Set the current working directory inside the container
WORKDIR /app
Expand Down
20 changes: 1 addition & 19 deletions migration/src/migrate/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,7 @@ export default class MigrationRepository {
"terms",
"title",
"uoc",
"rating",
"archived",
"attributes",
"calendar",
"campus",
"description",
"enrolment_rules",
"equivalents",
"exclusions",
"faculty",
"field_of_education",
"gen_ed",
"level",
"school",
"study_level",
"terms",
"title",
"uoc",
"rating",
"rating"
],
["course_code"],
{ skipUpdateIfNoValuesChanged: true },
Expand Down
Loading