fix: format phase 22 worktree files that were committed unformatted
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,9 +67,7 @@ export function AddToCollectionModal() {
|
||||
closeAddToCollection();
|
||||
},
|
||||
onError: (err) => {
|
||||
setError(
|
||||
err instanceof Error ? err.message : "Failed to add item",
|
||||
);
|
||||
setError(err instanceof Error ? err.message : "Failed to add item");
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useCategories } from "../hooks/useCategories";
|
||||
import { useGlobalItem } from "../hooks/useGlobalItems";
|
||||
import { useCreateThread, useThreads } from "../hooks/useThreads";
|
||||
@@ -12,9 +12,7 @@ export function AddToThreadModal() {
|
||||
(s) => s.addToThreadModal,
|
||||
);
|
||||
const closeAddToThread = useUIStore((s) => s.closeAddToThread);
|
||||
const catalogSessionThreadId = useUIStore(
|
||||
(s) => s.catalogSessionThreadId,
|
||||
);
|
||||
const catalogSessionThreadId = useUIStore((s) => s.catalogSessionThreadId);
|
||||
const setCatalogSessionThreadId = useUIStore(
|
||||
(s) => s.setCatalogSessionThreadId,
|
||||
);
|
||||
@@ -26,13 +24,11 @@ export function AddToThreadModal() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const [mode, setMode] = useState<"pick" | "create">("pick");
|
||||
const [selectedThreadId, setSelectedThreadId] = useState<number | null>(
|
||||
const [selectedThreadId, setSelectedThreadId] = useState<number | null>(null);
|
||||
const [newThreadName, setNewThreadName] = useState("");
|
||||
const [newThreadCategoryId, setNewThreadCategoryId] = useState<number | null>(
|
||||
null,
|
||||
);
|
||||
const [newThreadName, setNewThreadName] = useState("");
|
||||
const [newThreadCategoryId, setNewThreadCategoryId] = useState<
|
||||
number | null
|
||||
>(null);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@@ -63,7 +59,13 @@ export function AddToThreadModal() {
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [open]);
|
||||
}, [
|
||||
open,
|
||||
activeThreads.length,
|
||||
activeThreads.some,
|
||||
activeThreads[0].id,
|
||||
catalogSessionThreadId,
|
||||
]);
|
||||
|
||||
// Reset form state when modal closes
|
||||
useEffect(() => {
|
||||
@@ -112,9 +114,7 @@ export function AddToThreadModal() {
|
||||
toast.success(`Added to "${thread?.name ?? "thread"}"`);
|
||||
closeAddToThread();
|
||||
} catch (err) {
|
||||
setError(
|
||||
err instanceof Error ? err.message : "Failed to add candidate",
|
||||
);
|
||||
setError(err instanceof Error ? err.message : "Failed to add candidate");
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
@@ -142,9 +142,7 @@ export function AddToThreadModal() {
|
||||
toast.success(`Created "${trimmedName}" with first candidate`);
|
||||
closeAddToThread();
|
||||
} catch (err) {
|
||||
setError(
|
||||
err instanceof Error ? err.message : "Failed to create thread",
|
||||
);
|
||||
setError(err instanceof Error ? err.message : "Failed to create thread");
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
|
||||
@@ -133,14 +133,18 @@ function GlobalItemDetail() {
|
||||
<div className="flex gap-3 mb-6">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openAddToCollection(item.id, `${item.brand} ${item.model}`)}
|
||||
onClick={() =>
|
||||
openAddToCollection(item.id, `${item.brand} ${item.model}`)
|
||||
}
|
||||
className="bg-gray-700 text-white rounded-lg px-5 py-2.5 text-sm font-medium hover:bg-gray-800 transition-colors"
|
||||
>
|
||||
Add to Collection
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openAddToThread(item.id, `${item.brand} ${item.model}`)}
|
||||
onClick={() =>
|
||||
openAddToThread(item.id, `${item.brand} ${item.model}`)
|
||||
}
|
||||
className="bg-white text-gray-700 border border-gray-200 rounded-lg px-5 py-2.5 text-sm font-medium hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
Add to Thread
|
||||
|
||||
@@ -36,7 +36,7 @@ function ThreadDetailPage() {
|
||||
thread?.candidates ?? [],
|
||||
setupData?.items,
|
||||
thread?.categoryId ?? 0,
|
||||
)
|
||||
);
|
||||
|
||||
const [addCandidateOpen, setAddCandidateOpen] = useState(false);
|
||||
|
||||
@@ -62,7 +62,7 @@ function ThreadDetailPage() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isError || !thread) {
|
||||
@@ -79,7 +79,7 @@ function ThreadDetailPage() {
|
||||
Back to planning
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const isActive = thread.status === "active";
|
||||
@@ -93,7 +93,7 @@ function ThreadDetailPage() {
|
||||
if (!tempItems) return;
|
||||
reorderMutation.mutate({
|
||||
orderedIds: tempItems.map((c) => c.id),
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -306,7 +306,7 @@ function ThreadDetailPage() {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
interface AddCandidateModalProps {
|
||||
@@ -392,10 +392,10 @@ function AddCandidateModal({ threadId, onClose }: AddCandidateModalProps) {
|
||||
{
|
||||
onSuccess: () => {
|
||||
setForm(INITIAL_MODAL_FORM);
|
||||
onClose()
|
||||
onClose();
|
||||
},
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -625,5 +625,5 @@ function AddCandidateModal({ threadId, onClose }: AddCandidateModalProps) {
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,12 +59,20 @@ interface UIState {
|
||||
closeCatalogSearch: () => void;
|
||||
|
||||
// Add-to-collection modal
|
||||
addToCollectionModal: { open: boolean; globalItemId: number | null; globalItemName: string | null };
|
||||
addToCollectionModal: {
|
||||
open: boolean;
|
||||
globalItemId: number | null;
|
||||
globalItemName: string | null;
|
||||
};
|
||||
openAddToCollection: (globalItemId: number, globalItemName: string) => void;
|
||||
closeAddToCollection: () => void;
|
||||
|
||||
// Add-to-thread modal
|
||||
addToThreadModal: { open: boolean; globalItemId: number | null; globalItemName: string | null };
|
||||
addToThreadModal: {
|
||||
open: boolean;
|
||||
globalItemId: number | null;
|
||||
globalItemName: string | null;
|
||||
};
|
||||
openAddToThread: (globalItemId: number, globalItemName: string) => void;
|
||||
closeAddToThread: () => void;
|
||||
|
||||
@@ -137,21 +145,41 @@ export const useUIStore = create<UIState>((set) => ({
|
||||
fabMenuOpen: false,
|
||||
}),
|
||||
closeCatalogSearch: () =>
|
||||
set({ catalogSearchOpen: false, catalogSearchMode: null, catalogSessionThreadId: null }),
|
||||
set({
|
||||
catalogSearchOpen: false,
|
||||
catalogSearchMode: null,
|
||||
catalogSessionThreadId: null,
|
||||
}),
|
||||
|
||||
// Add-to-collection modal
|
||||
addToCollectionModal: { open: false, globalItemId: null, globalItemName: null },
|
||||
addToCollectionModal: {
|
||||
open: false,
|
||||
globalItemId: null,
|
||||
globalItemName: null,
|
||||
},
|
||||
openAddToCollection: (globalItemId, globalItemName) =>
|
||||
set({ addToCollectionModal: { open: true, globalItemId, globalItemName } }),
|
||||
closeAddToCollection: () =>
|
||||
set({ addToCollectionModal: { open: false, globalItemId: null, globalItemName: null } }),
|
||||
set({
|
||||
addToCollectionModal: {
|
||||
open: false,
|
||||
globalItemId: null,
|
||||
globalItemName: null,
|
||||
},
|
||||
}),
|
||||
|
||||
// Add-to-thread modal
|
||||
addToThreadModal: { open: false, globalItemId: null, globalItemName: null },
|
||||
openAddToThread: (globalItemId, globalItemName) =>
|
||||
set({ addToThreadModal: { open: true, globalItemId, globalItemName } }),
|
||||
closeAddToThread: () =>
|
||||
set({ addToThreadModal: { open: false, globalItemId: null, globalItemName: null } }),
|
||||
set({
|
||||
addToThreadModal: {
|
||||
open: false,
|
||||
globalItemId: null,
|
||||
globalItemName: null,
|
||||
},
|
||||
}),
|
||||
|
||||
// Session thread tracking
|
||||
catalogSessionThreadId: null,
|
||||
|
||||
@@ -595,7 +595,8 @@ export const DEV_USER_ITEMS = [
|
||||
weightGrams: 179,
|
||||
priceCents: 1200,
|
||||
purchasePriceCents: null,
|
||||
notes: "Backup water carry, also doubles as hot water bottle in sleep system.",
|
||||
notes:
|
||||
"Backup water carry, also doubles as hot water bottle in sleep system.",
|
||||
quantity: 1,
|
||||
},
|
||||
] as const;
|
||||
|
||||
Reference in New Issue
Block a user