diff --git a/CLAUDE.md b/CLAUDE.md index b3cc537..0dc9646 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -395,11 +395,15 @@ security only, not the full SaaS-shaped doc — and the judgment call on what co search box, filters the document list, collapses to an icon-only rail), LoginView (Sign In/Sign Up toggle + "Continue with Google"), - ProcessingIndicator, ResultCard (Download + Download All, - best-effort persists the export to R2 via - `documentsService.saveExportFile`), SourceDocumentPanel, - TransactionsTable (now also hosts the "Move to project" - select), TransactionRow, ResizablePanels. `RestoreBanner` + ConfirmModal (NEW 2026-10-13 — generic confirm/cancel + dialog over a dimmed backdrop; built for "Move to project" + but reusable elsewhere), ProcessingIndicator, ResultCard + (Download + Download All, best-effort persists the export + to R2 via `documentsService.saveExportFile`), + SourceDocumentPanel, TransactionsTable (now also hosts the + "Move to project" select + its ConfirmModal, see "Move to + project confirm modal" under Key decisions & lessons), + TransactionRow, ResizablePanels. `RestoreBanner` was removed in Stage B.2 (see Key decisions & lessons) — PocketBase being the real backend left no ambiguity for it to explain. Every button/nav icon site-wide uses @@ -1039,6 +1043,45 @@ connected this session either (tried again, same as every prior UI change in thi project); this is the one area of this change the user needs to confirm visually themselves before considering it done. +**"Move to project" confirm modal, 2026-10-13.** The user reported genuine confusion +right after the shell redesign above: the "Move to project" dropdown in +`TransactionsTable.vue` actually worked (PATCHed the document's `project` field via +`documentsService.moveToProject`), but gave **zero visible feedback** - no confirmation, +no change to the document in view, nothing in the sidebar/breadcrumb updating - so a +successful move looked identical to a no-op. Asked for a modal confirm step +specifically "so we don't have to add another button to the actual div." + +Built `ConfirmModal.vue` - a small, generic confirm/cancel dialog (dimmed backdrop, +reuses `.card` for its own surface, Esc/backdrop-click both cancel) - rather than a +one-off inline confirmation, since this is exactly the kind of "are you sure" step other +destructive-ish actions in this app (e.g. deleting a project) could reuse later, even +though nothing else is wired to it yet. + +**One real subtlety, caught before any code ran:** the `` element's displayed value through `v-model`, +not a bare `:value` (a known Vue gotcha, not something encountered by surprise at +runtime here - reasoned through up front). Fixed by giving the dropdown its own local +`selectedProjectId` ref driven by `v-model`, kept in sync with the real active document +via a `watch` (needed now since switching documents via `DocumentNavBar` no longer +auto-updates the select through a direct store binding), and explicitly reset back to +`doc.project` in `cancelMove()` and on a failed move. + +Also addressed the original "no feedback" complaint: a `moveConfirmNote` ("Moved to +{project name}") appears next to the dropdown for 3.5s after a successful move. Label +text changed from the bare, ambiguous "Project" to "Move to project" per the earlier +exchange about what this control even does. + +Verified: `npm run build` passes; the built JS bundle confirmed to contain the new +`modal-overlay`/`ConfirmModal`/"Moved to "/"Move to project" strings; the `app` container +rebuilt and `curl`-checked serving 200. `measure.py` re-run, unaffected (no backend +touched). **Not machine-verified:** the actual modal interaction (open/confirm/cancel/ +Esc/backdrop-click, the dropdown correctly reverting on cancel) - same standing +limitation as every other UI change this session, Claude-in-Chrome did not connect. + **Governing rule: never silently correct or exclude data.** This shows up in several concrete places, not just as an abstract principle: - A row with an unusual status (e.g. HSBC's "Cancelled" wires) stays in the output and is diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css index 4556a25..c67c7be 100644 --- a/frontend/src/assets/main.css +++ b/frontend/src/assets/main.css @@ -609,6 +609,20 @@ tr.editing td{ background:rgba(37,99,235,.03); } height:32px; padding:0 8px; background:var(--navy); border:1px solid var(--border-2); border-radius:7px; font-size:12.5px; color:var(--t1); font-family:var(--fb); outline:none; cursor:pointer; } +.move-confirm-note{ + display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--green); + margin-left:2px; +} + +/* ── ConfirmModal.vue - a generic confirm/cancel dialog over a dimmed + backdrop. Reuses .card for the dialog's own surface. ──────────────── */ +.modal-overlay{ + position:fixed; inset:0; z-index:50; background:rgba(13,21,38,.45); + display:flex; align-items:center; justify-content:center; padding:24px; outline:none; +} +.modal-card{ width:100%; max-width:380px; margin-bottom:0; } +.modal-message{ font-size:13.5px; color:var(--t2); line-height:1.6; margin-bottom:22px; } +.modal-actions{ display:flex; align-items:center; justify-content:flex-end; gap:10px; } /* Icon-prefixed inputs (LoginView's email/password fields). */ .input-icon-wrap{ position:relative; } diff --git a/frontend/src/components/ConfirmModal.vue b/frontend/src/components/ConfirmModal.vue new file mode 100644 index 0000000..b8ecb20 --- /dev/null +++ b/frontend/src/components/ConfirmModal.vue @@ -0,0 +1,54 @@ + + + diff --git a/frontend/src/components/TransactionsTable.vue b/frontend/src/components/TransactionsTable.vue index 614db54..be56af4 100644 --- a/frontend/src/components/TransactionsTable.vue +++ b/frontend/src/components/TransactionsTable.vue @@ -19,7 +19,7 @@ * again by applyCheckResults, while closingCalc's text IS recomputed on * every recheck). */ -import { ref, computed } from 'vue' +import { ref, computed, watch } from 'vue' import { useExtractionStore } from '../stores/extractionStore' import { useUiStore } from '../stores/uiStore' import { useProjectsStore } from '../stores/projectsStore' @@ -29,6 +29,7 @@ import * as documentsService from '../services/documentsService' import { useTransactionFilters } from '../composables/useTransactionFilters' import TransactionRow from './TransactionRow.vue' import DocumentNavBar from './DocumentNavBar.vue' +import ConfirmModal from './ConfirmModal.vue' const extractionStore = useExtractionStore() const uiStore = useUiStore() @@ -42,19 +43,64 @@ const projectsStore = useProjectsStore() // view even if it no longer matches an active project filter (a known, // accepted simplification - the next reload/filter change will reflect // it correctly). +// +// The 's displayed value through +// v-model, not a bare :value). Picking a different project opens a +// confirm step (ConfirmModal) rather than moving immediately - one +// misclick on the dropdown used to silently relocate a document with no +// feedback at all. const movingProject = ref(false) -async function handleMoveToProject(e) { - const projectId = e.target.value +const selectedProjectId = ref(extractionStore.activeDocument?.project ?? '') +watch( + () => extractionStore.activeDocument?.project, + (v) => { selectedProjectId.value = v ?? '' }, +) + +const showMoveConfirm = ref(false) +const pendingProjectId = ref(null) +const pendingProjectName = computed( + () => projectsStore.projects.find((p) => p.id === pendingProjectId.value)?.name ?? '', +) +const moveConfirmNote = ref('') +let moveConfirmNoteTimer = null + +function handleSelectChange() { const doc = extractionStore.activeDocument - if (!doc || !projectId || projectId === doc.project) return + if (!doc || !selectedProjectId.value || selectedProjectId.value === doc.project) return + pendingProjectId.value = selectedProjectId.value + showMoveConfirm.value = true +} + +function cancelMove() { + showMoveConfirm.value = false + pendingProjectId.value = null + // Revert the dropdown back to the document's actual, unchanged project. + selectedProjectId.value = extractionStore.activeDocument?.project ?? '' +} + +async function confirmMove() { + const doc = extractionStore.activeDocument + const projectId = pendingProjectId.value + const projectName = pendingProjectName.value + showMoveConfirm.value = false + if (!doc || !projectId) return movingProject.value = true extractionStore.clearError() try { await documentsService.moveToProject(doc.pbId, projectId) extractionStore.setActiveDocumentProject(projectId) + clearTimeout(moveConfirmNoteTimer) + moveConfirmNote.value = `Moved to ${projectName}` + moveConfirmNoteTimer = setTimeout(() => { moveConfirmNote.value = '' }, 3500) } catch (err) { extractionStore.setError('Could not move this document: ' + err.message) + selectedProjectId.value = doc.project } + pendingProjectId.value = null movingProject.value = false } @@ -142,11 +188,21 @@ async function handleRecheck() {