diff --git a/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx b/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx index 67d5c36..f16921e 100644 --- a/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx +++ b/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx @@ -11,9 +11,12 @@ import { DialogTitle, IconButton, IconButtonProps, + MenuItem, + Select, Stack, styled, Tooltip, + Typography, } from "@mui/material"; import { ErrorBoundary, Suspense } from "@suspensive/react"; import { enqueueSnackbar, OptionsObject } from "notistack"; @@ -94,18 +97,19 @@ type InnerSiteMapStateType = { const ModifyDetectionFields: (keyof FlatSiteMap)[] = ["order", "parent_sitemap"]; -const InnerSiteMapList: React.FC = ErrorBoundary.with( +const InnerSiteMapList: React.FC<{ year: number }> = ErrorBoundary.with( { fallback: ErrorFallback }, - Suspense.with({ fallback: }, () => { + Suspense.with({ fallback: }, ({ year }: { year: number }) => { const backendAdminAPIClient = useBackendAdminClient(); - const { data } = useListQuery(backendAdminAPIClient, "cms", "sitemap"); - const originalFlatSiteMapObj = Object.values(data).reduce((acc, item) => ({ ...acc, [item.id]: item }), {} as FlatSiteMapObj); + const { data } = useListQuery(backendAdminAPIClient, "cms", "sitemap", { year: String(year) }); const deleteMutation = useRemovePreparedMutation(backendAdminAPIClient, "cms", "sitemap"); const { mutateAsync: updateMutationAsync } = useUpdatePreparedMutation(backendAdminAPIClient, "cms", "sitemap"); const addSnackbar = (c: string | React.ReactNode, variant: OptionsObject["variant"]) => enqueueSnackbar(c, { variant, anchorOrigin: { vertical: "bottom", horizontal: "center" } }); + const originalFlatSiteMapObj = Object.values(data).reduce((acc, item) => ({ ...acc, [item.id]: item }), {} as FlatSiteMapObj); + const [state, setState] = React.useState({ flatSiteMap: data }); const nestedSiteMap = buildNestedSiteMap(state.flatSiteMap)[""]; const childrenFlatSiteMap = buildFlatSiteMap(nestedSiteMap); @@ -241,8 +245,29 @@ const InnerSiteMapList: React.FC = ErrorBoundary.with( }) ); -export const SiteMapList: React.FC = () => ( - - - -); +const YEAR_OPTIONS = [2025, 2026]; + +export const SiteMapList: React.FC = () => { + const [year, setYear] = React.useState(new Date().getFullYear()); + + return ( + + + + 연도 + + + + + + ); +}; diff --git a/packages/common/src/schemas/backendAdminAPI.ts b/packages/common/src/schemas/backendAdminAPI.ts index fb94077..57d0c2d 100644 --- a/packages/common/src/schemas/backendAdminAPI.ts +++ b/packages/common/src/schemas/backendAdminAPI.ts @@ -63,6 +63,7 @@ export type PageSectionSchema = { export type FlattenedSiteMapSchema = { id: string; + year: number; route_code: string; name_ko: string; name_en: string; @@ -75,6 +76,7 @@ export type FlattenedSiteMapSchema = { export type NestedSiteMapSchema = { id: string; + year: number; route_code: string; name_ko: string; name_en: string;