"use client"; import { FolderTree, HardHat, List, Package } from "lucide-react"; import { useRouter, useSearchParams } from "next/navigation"; import { useTranslations } from "next-intl"; import { Button } from "@/components/ui/button"; import { requestCatalogNavigation } from "@/features/catalog/client/use-catalog-navigation"; import { cn } from "@/lib/utils"; interface CatalogViewToggleProps { currentView: string; catalogType?: string; } export function CatalogViewToggle({ currentView, catalogType = "normal", }: CatalogViewToggleProps) { const router = useRouter(); const t = useTranslations("pages.admin.catalog.workspace"); const searchParams = useSearchParams(); function setView(view: string) { if (view === currentView || !requestCatalogNavigation()) return; const params = new URLSearchParams(searchParams.toString()); if (view === "tree") { params.delete("view"); } else { params.set("view", view); } router.push(`?${params.toString()}`); } function setCatalog(type: string) { if (type === catalogType || !requestCatalogNavigation()) return; const params = new URLSearchParams(searchParams.toString()); if (type === "normal") { params.delete("catalog"); } else { params.set("catalog", type); } params.delete("view"); params.delete("root"); params.delete("category"); router.push(`?${params.toString()}`); } return (
{/* Catalog type selector */}
{/* View mode selector */}
); }