diff --git a/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx b/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx index f16921e..b341c00 100644 --- a/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx +++ b/apps/pyconkr-admin/src/components/pages/sitemap/list.tsx @@ -1,4 +1,10 @@ -import { useBackendAdminClient, useListQuery, useRemovePreparedMutation, useUpdatePreparedMutation } from "@frontend/common/src/hooks/useAdminAPI"; +import { + useBackendAdminClient, + useChoicesQuery, + useListQuery, + useRemovePreparedMutation, + useUpdatePreparedMutation, +} from "@frontend/common/src/hooks/useAdminAPI"; import { buildFlatSiteMap, buildNestedSiteMap } from "@frontend/common/src/utils"; import { Add, Delete, Edit, Save } from "@mui/icons-material"; import { @@ -9,8 +15,10 @@ import { DialogActions, DialogContent, DialogTitle, + FormControl, IconButton, IconButtonProps, + InputLabel, MenuItem, Select, Stack, @@ -97,11 +105,13 @@ type InnerSiteMapStateType = { const ModifyDetectionFields: (keyof FlatSiteMap)[] = ["order", "parent_sitemap"]; -const InnerSiteMapList: React.FC<{ year: number }> = ErrorBoundary.with( +type InnerSiteMapListProps = { domainGroupId: string; headerSlot: React.ReactNode }; + +const InnerSiteMapList: React.FC = ErrorBoundary.with( { fallback: ErrorFallback }, - Suspense.with({ fallback: }, ({ year }: { year: number }) => { + Suspense.with({ fallback: }, ({ domainGroupId, headerSlot }: InnerSiteMapListProps) => { const backendAdminAPIClient = useBackendAdminClient(); - const { data } = useListQuery(backendAdminAPIClient, "cms", "sitemap", { year: String(year) }); + const { data } = useListQuery(backendAdminAPIClient, "cms", "sitemap", { domain_group: domainGroupId }); const deleteMutation = useRemovePreparedMutation(backendAdminAPIClient, "cms", "sitemap"); const { mutateAsync: updateMutationAsync } = useUpdatePreparedMutation(backendAdminAPIClient, "cms", "sitemap"); @@ -126,7 +136,10 @@ const InnerSiteMapList: React.FC<{ year: number }> = ErrorBoundary.with( const disabled = deleteMutation.isPending; const editorId = state.editorSiteMapId === "add" ? undefined : state.editorSiteMapId; - const editorContext = state.parentSiteMapId ? { parent_sitemap: state.parentSiteMapId } : undefined; + const editorContext = { + domain_group: domainGroupId, + ...(state.parentSiteMapId ? { parent_sitemap: state.parentSiteMapId } : {}), + }; const resetFlatSiteMap = () => setState((ps) => ({ ...ps, flatSiteMap: data })); const applyChanges = () => { @@ -221,9 +234,12 @@ const InnerSiteMapList: React.FC<{ year: number }> = ErrorBoundary.with( - -