import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Plus, RotateCcw, List } from "lucide-react"; import { PageHelp } from "../components/shared/PageHelp"; import { useCategories } from "../hooks/useCategories"; import CategoryTree from "../components/categories/CategoryTree"; import CategoryDetailPanel from "../components/categories/CategoryDetailPanel"; import AllKeywordsPanel from "../components/categories/AllKeywordsPanel"; export default function CategoriesPage() { const { t } = useTranslation(); const [showAllKeywords, setShowAllKeywords] = useState(false); const { state, selectCategory, startCreating, startEditing, cancelEditing, saveCategory, deleteCategory, addKeyword, editKeyword, removeKeyword, reinitializeCategories, } = useCategories(); const handleReinitialize = async () => { if (confirm(t("categories.reinitializeConfirm"))) { await reinitializeCategories(); } }; const selectedCategory = state.selectedCategoryId !== null ? state.categories.find((c) => c.id === state.selectedCategoryId) ?? null : null; return (
{t("common.loading")}
) : showAllKeywords ? (