feat(fase-18): CreateListModal replaces empty-create-then-rename flow
`CreateListModal.svelte` is the new entry point for "New list" — opens on the masthead button click, prefills the input with `currentCollective.default_list_title` (Fase 18.3.1), shows an inline autocomplete dropdown via `fetchTitleSuggestions`, and renders a "Sugerencia: Compra #6" chip when (a) the typed value exactly matches a catalog-curated prefix case-insensitively and (b) `computeNextNumber` resolves a value (Fase 18.3.2). Submit is disabled while the trimmed value is empty or creation is in flight (Fase 18.3.3). On submit, if the catalog match still holds, the modal auto-suffixes "#N" before inserting and the lists page shows a transient toast confirming the final name (Fase 18.3.4). The prefill effect is gated by a `wasOpen` edge-tracker — a naive `$effect(() => { if (open) value = default })` re-runs whenever `$currentCollective` updates (e.g. a realtime UPDATE landing after the user typed something), which clobbered the typed value and froze the submit button as disabled. The edge guard limits the prefill to the false→true transition. `/lists/+page.svelte`: the masthead "New list" button now opens the modal instead of calling `createList(collective, '', user)` and goto-ing to the detail page for inline rename. The legacy flow was nice for quick creates but couldn't enforce a required title or surface the catalog. Existing per-list actions are unchanged. 15 new i18n strings (en + es) for the modal, the suggestion chip, the auto-numbered toast, and the manage-page subsection that ships in the next commit. Updated existing e2e specs: `lists.test.ts`'s `createList()` helper + the C-13 guest path now drive the modal instead of the legacy placeholder input; `session.test.ts` S-03 uses the modal for the fresh-list setup. New `tests/e2e/list-title-flow.test.ts` adds LTF-01 (default prefill end-to-end with a Supabase-driven setDefaultListTitle since the manage UI lands in the next commit) and LTF-03 (empty input keeps submit disabled, even with whitespace). Tests: 4 lists + 3 session + 2 new LTF specs all green (9/9). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -342,5 +342,24 @@
|
||||
"common_items_add_name_label": "Nombre del item",
|
||||
"common_items_add_name_placeholder": "p. ej. aceite de oliva",
|
||||
"common_items_add_visibility_label": "Visibilidad",
|
||||
"common_items_add_save": "Añadir"
|
||||
"common_items_add_save": "Añadir",
|
||||
"create_list_modal_title": "Nueva lista de la compra",
|
||||
"create_list_input_label": "Nombre de la lista",
|
||||
"create_list_input_placeholder": "p. ej. Compra semanal",
|
||||
"create_list_submit": "Crear",
|
||||
"create_list_suggestion_chip": "Sugerencia: {title}",
|
||||
"create_list_auto_numbered_toast": "Creada como «{title}»",
|
||||
"manage_list_titles_section_title": "Títulos sugeridos",
|
||||
"manage_list_titles_blurb": "Preconfigura un título por defecto para las nuevas listas y mantén una lista de sugerencias.",
|
||||
"manage_default_list_title_label": "Título por defecto",
|
||||
"manage_default_list_title_placeholder": "p. ej. Compra semanal",
|
||||
"manage_default_list_title_clear": "Borrar",
|
||||
"manage_list_titles_empty": "No hay títulos sugeridos todavía.",
|
||||
"manage_list_titles_add_button": "Añadir título",
|
||||
"manage_list_titles_add_modal_title": "Añadir título sugerido",
|
||||
"manage_list_titles_add_name_label": "Título",
|
||||
"manage_list_titles_add_name_placeholder": "p. ej. Compra",
|
||||
"manage_list_titles_add_save": "Añadir",
|
||||
"manage_list_titles_remove": "Borrar",
|
||||
"manage_list_titles_readonly": "Solo los admins pueden gestionar estos títulos."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user