feat(fase-15): /collective/manage common items UI + e2e (15.3)

New subsection on /collective/manage:
  - Table with rows of (name, uses, last used) + 3-way Hide/Normal/Boost
    segmented control writing weight=-50/0/50, + Remove action that opens
    a confirmation modal explaining "items already in lists are not
    touched".
  - Add common-item modal (admin only) — input + same 3-way control,
    defaulting to Boost; useful for seeding the catalogue before lists
    actually mention an item.
  - Empty / filtered-empty states + client-side substring search.
  - Members see the entire table with all buttons disabled and a tooltip
    pointing to "only admins can manage common items". Guests don't see
    the section at all.

Implementation notes:
  - The data-weight-state attribute on each row gives the test suite a
    stable handle for the current visual state (boost / normal / hide).
  - The segmented control is a plain `inline-flex` of three buttons —
    different visual language to the existing section-visibility toggles
    (those are checkboxes), so there's no ambiguity at a glance.
  - HIDE_WEIGHT / BOOST_WEIGHT constants make the magic numbers explicit;
    the column itself has no check constraint so future tiers can land
    without a schema change.

Playwright covers CI-01 (Ana boosts yogurt → it leads the dropdown ahead
of higher-use-count milk), CI-03 (Borja sees the table, all actions
disabled, "Add common item" hidden), CI-04 (Ana purges apples → row gone
from the table). CI-02 (exclude-on-list) lives in the same file but
exercises the /lists/[id] page and ships in the next commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 11:27:03 +02:00
parent 3f96e6cdb3
commit 834034bada
4 changed files with 607 additions and 4 deletions

View File

@@ -315,5 +315,29 @@
"admin_server_section_state_unset": "Sin opinión",
"admin_server_info": "Información del servidor",
"admin_error_forbidden": "No tienes acceso a esta zona.",
"admin_error_unknown": "Algo ha ido mal. Inténtalo de nuevo."
"admin_error_unknown": "Algo ha ido mal. Inténtalo de nuevo.",
"common_items_title": "Items frecuentes",
"common_items_blurb": "Promueve items que siempre aparezcan primero en las sugerencias, u oculta los que no quieras ver. Los miembros ven el catálogo pero no pueden editarlo.",
"common_items_search_placeholder": "Buscar items…",
"common_items_empty": "Aún no hay items frecuentes. Los items que se añadan a las listas aparecerán aquí.",
"common_items_empty_filtered": "Ningún item coincide con tu búsqueda.",
"common_items_col_name": "Nombre",
"common_items_col_weight": "Visibilidad",
"common_items_col_uses": "Usos",
"common_items_col_last_used": "Último uso",
"common_items_col_actions": "Acciones",
"common_items_state_hide": "Ocultar",
"common_items_state_normal": "Normal",
"common_items_state_boost": "Destacar",
"common_items_state_locked_tooltip": "Solo los admins pueden gestionar items frecuentes.",
"common_items_purge_button": "Eliminar",
"common_items_purge_modal_title": "¿Eliminar {name}?",
"common_items_purge_modal_body": "Esto solo elimina la entrada de sugerencias. Los items que ya están en listas no se ven afectados.",
"common_items_purge_confirm": "Eliminar",
"common_items_add_button": "Añadir item común",
"common_items_add_modal_title": "Añadir item común",
"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"
}