feat: inline edit for patterns in library (name, description, category, direction, regime)

- Backend: PATCH /api/patterns/custom/{id} — partial update, only provided fields changed
- useApi.ts: usePatchPattern mutation hook
- PatternCard: pencil icon (non-builtin only) → edit mode with inline inputs for name, description, direction (select), category, and #regime; ✓/✗ buttons to save or cancel; card border highlights blue while editing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-22 21:13:34 +02:00
parent d794ad68aa
commit a2315c3b78
3 changed files with 156 additions and 31 deletions

View File

@@ -311,6 +311,21 @@ export const useDeletePattern = () => {
})
}
export const usePatchPattern = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: (body: {
id: string
name?: string
description?: string
category?: string
signal_direction?: string
regime_tag?: string
}) => api.patch(`/patterns/custom/${body.id}`, body).then(r => r.data),
onSuccess: () => qc.invalidateQueries({ queryKey: ['all-patterns'] }),
})
}
export const useTogglePattern = () => {
const qc = useQueryClient()
return useMutation({