Skip to content

Commit

Permalink
Home page reroutes to roles
Browse files Browse the repository at this point in the history
  • Loading branch information
banushi-a committed Nov 23, 2024
1 parent 4cd269e commit 403d423
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
49 changes: 21 additions & 28 deletions apps/web/public/svg/hidingLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/web/src/app/(pages)/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function Home() {
return (
<div className="flex h-[85vh] flex-col">
<div className="flex h-full flex-col items-center justify-center">
<SearchFilter />
<SearchFilter alternatePathname="/roles" />
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/_components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default function Header({ session, auth }: HeaderProps) {
<div className="mx-4 flex h-20 items-end">
<Image
src="/svg/hidingLogo.svg"
height={150}
width={150}
alt="Logo Picture"
width={137}
height={60}
/>
</div>
<h1
Expand Down
12 changes: 10 additions & 2 deletions apps/web/src/app/_components/search/search-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@ interface SearchFilterProps {
search?: string;
cycle?: "FALL" | "SPRING" | "SUMMER";
term?: "INPERSON" | "HYBRID" | "REMOTE";
alternatePathname?: string;
}

/**
* Handles searching logic, updates the search param base on user search and passes the text to backend with fuzzy searching.
* @param param0 user input text that's passed to the fuzzy search, cycle filter, and term filter
* @param param0 user input text that's passed to the fuzzy search, cycle filter, and term filter.
* - alternatePathname example: "/roles" or "/companies"
* @returns the search bar with the user inputted text
*/
export default function SearchFilter({
search,
cycle,
term,
alternatePathname,
}: SearchFilterProps) {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
Expand Down Expand Up @@ -74,7 +77,12 @@ export default function SearchFilter({
);

function onSubmit(values: z.infer<typeof formSchema>) {
router.push(pathName + "?" + createQueryString(values));
console.log(alternatePathname);
if (alternatePathname) {
router.push(alternatePathname + "?" + createQueryString(values));
} else {
router.push(pathName + "?" + createQueryString(values));
}
}

return (
Expand Down

0 comments on commit 403d423

Please sign in to comment.