From 62aa8d3d9b63b85f0bfb5c19d2d0da3aadf8b41e Mon Sep 17 00:00:00 2001
From: Damian <37555910+DCRepublic@users.noreply.github.com>
Date: Mon, 4 Nov 2024 15:07:59 -0500
Subject: [PATCH] Search: update url on change
---
app/page.tsx | 16 +++++++++++++++-
components/Search.tsx | 33 +++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/app/page.tsx b/app/page.tsx
index 4ef48f6..61c0dfd 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -10,6 +10,18 @@ import prisma from "../lib/prisma";
import { Course, CoursePlan } from "@prisma/client";
import { getPlanCookie } from "../app/actions";
+async function getCourses() {
+ const courses = await prisma.course.findMany();
+ let output: any = [];
+
+ for (let i = 0; i < courses.length; i++) {
+ if (!output.includes(courses[i].year)) {
+ output.push(courses[i].year);
+ }
+ }
+ return output;
+}
+
export default async function Page(props: {
searchParams?: Promise<{
query?: string;
@@ -45,13 +57,15 @@ export default async function Page(props: {
return