diff --git a/app/(main)/professors/[id]/@reviews/page.tsx b/app/(main)/professors/[id]/@reviews/page.tsx index 183f025..c27b439 100644 --- a/app/(main)/professors/[id]/@reviews/page.tsx +++ b/app/(main)/professors/[id]/@reviews/page.tsx @@ -15,7 +15,7 @@ const getKey = (pageIndex: number, previousPageData: ProfessorsIDReviewsResponse) => { if (previousPageData && previousPageData.page === previousPageData.pages) return null; - return `/django/core/professors/${id}/reviews/?page=${pageIndex + 1}&${params}`; + return `/django/core/professors/${id}/reviews?page=${pageIndex + 1}&${params}`; }; const Skeleton = () => diff --git a/app/(main)/professors/[id]/@schedules/page.tsx b/app/(main)/professors/[id]/@schedules/page.tsx index f76c144..68d7a0b 100644 --- a/app/(main)/professors/[id]/@schedules/page.tsx +++ b/app/(main)/professors/[id]/@schedules/page.tsx @@ -12,7 +12,7 @@ const getKey = (pageIndex: number, previousPageData: ProfessorsIDSchedulesResponse) => { if (previousPageData && previousPageData.page === previousPageData.pages) return null; - return `/django/core/professors/${id}/schedules/?page=${pageIndex + 1}`; + return `/django/core/professors/${id}/schedules?page=${pageIndex + 1}`; }; export default function Page({ params }: { params: { id: string } }) { diff --git a/components/molecules/client/nav-search-bar/component.tsx b/components/molecules/client/nav-search-bar/component.tsx index 201d86f..133b9cf 100644 --- a/components/molecules/client/nav-search-bar/component.tsx +++ b/components/molecules/client/nav-search-bar/component.tsx @@ -1,6 +1,5 @@ 'use client'; -import Link from 'next/link'; import { useSearchParams } from 'next/navigation'; import useSWR from 'swr'; @@ -12,6 +11,7 @@ import { SchedulesSearchResponse, } from '@/types'; import SWRConfigProvider from '@/wrappers/swr-config'; +import Link from 'next/link'; type Error = { message: string }; @@ -75,6 +75,7 @@ const StatusMessage: React.FC = ({ const CourseSearchResults: React.FC = () => { const searchParams = useSearchParams(); + const currentOption = searchParams.get('navOption') ?? 'courses'; const currentQuery = searchParams.get('navQuery') ?? ''; const { data, error, isLoading } = useCoursesSearchResults(currentQuery); return ( @@ -84,7 +85,7 @@ const CourseSearchResults: React.FC = () => { ? data.items.map((course, i) => (
  • @@ -103,6 +104,7 @@ const CourseSearchResults: React.FC = () => { const ProfessorSearchResults: React.FC = () => { const searchParams = useSearchParams(); + const currentOption = searchParams.get('navOption') ?? 'courses'; const currentQuery = searchParams.get('navQuery') ?? ''; const { data, error, isLoading } = useProfessorsSearchResults(currentQuery); return ( @@ -112,7 +114,7 @@ const ProfessorSearchResults: React.FC = () => { ? data.items.map((professor, i) => (
  • @@ -131,6 +133,7 @@ const ProfessorSearchResults: React.FC = () => { const ScheduleSearchResults: React.FC = () => { const searchParams = useSearchParams(); + const currentOption = searchParams.get('navOption') ?? 'courses'; const currentQuery = searchParams.get('navQuery') ?? ''; const { data, error, isLoading } = useSchedulesSearchResults(currentQuery); return ( @@ -140,7 +143,7 @@ const ScheduleSearchResults: React.FC = () => { ? data.items.map((schedule, i) => (
  • @@ -184,13 +187,14 @@ export const NavSearchBar: React.FC = () => { param="navOption" shouldResetPageOnChange={false} className="rounded-l-none border-border bg-background" + value={currentOption} > {currentQuery ? ( - + {currentOption === 'courses' ? ( diff --git a/components/molecules/param-select/component.tsx b/components/molecules/param-select/component.tsx index 3b06ebd..bc8b1f7 100644 --- a/components/molecules/param-select/component.tsx +++ b/components/molecules/param-select/component.tsx @@ -37,9 +37,15 @@ export const ParamSelect: React.FC = ({ replace(`${pathname}?${params.toString()}`); } + React.useEffect(() => { + setPendingParam(currentParam); + }, [currentParam]); + return (