From 4c797354269c8e0791ed6b41b163db75e3b4b8df Mon Sep 17 00:00:00 2001
From: Jean-Luc Makiola
Date: Mon, 6 Apr 2026 15:12:59 +0200
Subject: [PATCH] feat(21-03): remove slide-out panels from root layout and
clean UIStore
- Remove Item and Candidate SlideOutPanel instances from __root.tsx
- Remove SlideOutPanel, ItemForm, CandidateForm imports from root
- Remove panel state (panelMode, editingItemId, candidatePanelMode, editingCandidateId) from UIStore
- Remove panel actions (openEditPanel, openAddPanel, closePanel, etc.) from UIStore
- Preserve currentThreadId derivation for CandidateDeleteDialog
- Update CollectionView empty state to use catalog search instead of add panel
- Update ItemForm/CandidateForm with onClose prop replacing store panel close
- Clean all dead panel references across src/client/
---
src/client/components/CandidateForm.tsx | 8 ++--
src/client/components/CollectionView.tsx | 4 +-
src/client/components/ItemForm.tsx | 8 ++--
src/client/routes/__root.tsx | 50 ------------------------
src/client/routes/threads/$threadId.tsx | 4 +-
src/client/stores/uiStore.ts | 31 ++-------------
6 files changed, 16 insertions(+), 89 deletions(-)
diff --git a/src/client/components/CandidateForm.tsx b/src/client/components/CandidateForm.tsx
index 0365979..71c6677 100644
--- a/src/client/components/CandidateForm.tsx
+++ b/src/client/components/CandidateForm.tsx
@@ -1,7 +1,6 @@
import { useEffect, useState } from "react";
import { useCreateCandidate, useUpdateCandidate } from "../hooks/useCandidates";
import { useThread } from "../hooks/useThreads";
-import { useUIStore } from "../stores/uiStore";
import { CategoryPicker } from "./CategoryPicker";
import { ImageUpload } from "./ImageUpload";
@@ -9,6 +8,7 @@ interface CandidateFormProps {
mode: "add" | "edit";
threadId: number;
candidateId?: number | null;
+ onClose?: () => void;
}
interface FormData {
@@ -39,11 +39,11 @@ export function CandidateForm({
mode,
threadId,
candidateId,
+ onClose,
}: CandidateFormProps) {
const { data: thread } = useThread(threadId);
const createCandidate = useCreateCandidate(threadId);
const updateCandidate = useUpdateCandidate(threadId);
- const closeCandidatePanel = useUIStore((s) => s.closeCandidatePanel);
const [form, setForm] = useState(INITIAL_FORM);
const [errors, setErrors] = useState>({});
@@ -124,13 +124,13 @@ export function CandidateForm({
createCandidate.mutate(payload, {
onSuccess: () => {
setForm(INITIAL_FORM);
- closeCandidatePanel();
+ onClose?.();
},
});
} else if (candidateId != null) {
updateCandidate.mutate(
{ candidateId, ...payload },
- { onSuccess: () => closeCandidatePanel() },
+ { onSuccess: () => onClose?.() },
);
}
}
diff --git a/src/client/components/CollectionView.tsx b/src/client/components/CollectionView.tsx
index eb1290c..126676c 100644
--- a/src/client/components/CollectionView.tsx
+++ b/src/client/components/CollectionView.tsx
@@ -14,7 +14,7 @@ export function CollectionView() {
const { data: totals } = useTotals();
const { data: categories } = useCategories();
const { weight, price } = useFormatters();
- const openAddPanel = useUIStore((s) => s.openAddPanel);
+ const openCatalogSearch = useUIStore((s) => s.openCatalogSearch);
const [searchText, setSearchText] = useState("");
const [categoryFilter, setCategoryFilter] = useState(null);
@@ -66,7 +66,7 @@ export function CollectionView() {