feat(plan): add Sprava kategorii management modal and button

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-06 00:55:20 +02:00
parent dab5ad8aa5
commit b94f4879e3
3 changed files with 196 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ import {
import type { PlanCellModalMode } from "../components/PlanCellModal";
import PlanGrid from "../components/PlanGrid";
import PlanCellModal from "../components/PlanCellModal";
import PlanCategoriesModal from "../components/PlanCategoriesModal";
import Forbidden from "../components/Forbidden";
import { projectListOptions, type Project } from "../lib/queries/projects";
import { planCategoriesOptions, type PlanCategory } from "../lib/queries/plan";
@@ -129,6 +130,8 @@ export default function PlanWork() {
const { data: categoriesData } = useQuery(planCategoriesOptions());
const categories: PlanCategory[] = categoriesData ?? [];
const [catModalOpen, setCatModalOpen] = useState(false);
// `lastMutated` is the (userId, date) of the most recent successful
// mutation. We pass it to PlanGrid as `pulseKey`; the matching cell
// gets a one-shot CSS pulse animation. We clear it after 700ms (the
@@ -638,6 +641,15 @@ export default function PlanWork() {
Měsíc
</button>
</div>
{canEdit && (
<button
type="button"
className="admin-btn admin-btn-secondary"
onClick={() => setCatModalOpen(true)}
>
Správa kategorií
</button>
)}
</motion.div>
{gridLoading && (
@@ -695,6 +707,11 @@ export default function PlanWork() {
onCreateOverrideFromRange={createOverrideFromRange}
onSwitchToEditRange={switchToEditRange}
/>
<PlanCategoriesModal
isOpen={catModalOpen}
onClose={() => setCatModalOpen(false)}
categories={categories}
/>
</div>
);
}