diff --git a/web/src/components/site/Navigation/Navpill/components/CategoryList.tsx b/web/src/components/site/Navigation/Navpill/components/CategoryList.tsx index 3b405278b..5e05b2eb7 100644 --- a/web/src/components/site/Navigation/Navpill/components/CategoryList.tsx +++ b/web/src/components/site/Navigation/Navpill/components/CategoryList.tsx @@ -1,23 +1,27 @@ import { Button, Flex } from "@chakra-ui/react"; -import { map } from "lodash/fp"; +import { usePathname } from "next/navigation"; import { useCategoryList } from "src/api/openapi/categories"; import { Category } from "src/api/openapi/schemas"; import { Anchor } from "src/components/site/Anchor"; import { Unready } from "src/components/site/Unready"; -const mapCategories = (selected?: string) => - map((c: Category) => ( - - - )); - -type Props = { category?: string }; + ); +} -export function CategoryList({ category }: Props) { +export function CategoryList() { const { data } = useCategoryList(); if (!data) return ; @@ -36,7 +40,9 @@ export function CategoryList({ category }: Props) { alignItems="start" overflowY="scroll" > - {mapCategories(category)(data.categories)} + {data.categories.map((c) => ( + + ))} ); } diff --git a/web/src/components/site/Navigation/Navpill/components/Menu.tsx b/web/src/components/site/Navigation/Navpill/components/Menu.tsx index dde1b59b6..20191ea9a 100644 --- a/web/src/components/site/Navigation/Navpill/components/Menu.tsx +++ b/web/src/components/site/Navigation/Navpill/components/Menu.tsx @@ -1,12 +1,8 @@ import { Flex, VStack } from "@chakra-ui/react"; -import { useNavigation } from "src/components/site/Navigation/useNavigation"; - import { CategoryList } from "./CategoryList"; export function Menu() { - const { category } = useNavigation(); - return ( - + ); diff --git a/web/src/components/site/Navigation/Sidebar/components/NavItem.tsx b/web/src/components/site/Navigation/Sidebar/components/NavItem.tsx deleted file mode 100644 index 889071b52..000000000 --- a/web/src/components/site/Navigation/Sidebar/components/NavItem.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { LinkProps } from "@chakra-ui/react"; -import { usePathname } from "next/navigation"; -import { PropsWithRef } from "react"; - -import { Anchor } from "src/components/site/Anchor"; - -export function NavItem(props: LinkProps & PropsWithRef) { - const pathname = usePathname(); - const selected = props.href === pathname; - - return ( - - {props.children} - - ); -} diff --git a/web/src/components/site/Navigation/useNavigation.ts b/web/src/components/site/Navigation/useNavigation.ts index 81fb7e211..57820545b 100644 --- a/web/src/components/site/Navigation/useNavigation.ts +++ b/web/src/components/site/Navigation/useNavigation.ts @@ -1,32 +1,20 @@ "use client"; -import { useSearchParams } from "next/navigation"; -import { z } from "zod"; - import { useGetInfo } from "src/api/openapi/misc"; import { useSession } from "src/auth"; -export const QuerySchema = z.object({ - category: z.string().optional(), -}); -export type Query = z.infer; - // NOTE: Everything that involves data fetching here has a suitable fallback. // Most of the time, components will render but this is the data for // the navigation so it's a bit more important that we show something always. export function useNavigation() { - const query = useSearchParams(); const { data: infoResult } = useGetInfo(); const session = useSession(); - const { category } = QuerySchema.parse(query); - const title = infoResult?.title ?? "Storyden"; return { isAdmin: session?.admin ?? false, title, - category, }; }