feat: Phase 2 Schritt 10 — Einkaufslisten-Modul
Backend: - GET /shopping — alle Listen mit item_total/item_checked Zähler - POST/PUT/DELETE /shopping/:listId — Listen-CRUD - GET /shopping/:listId/items — Artikel nach Supermarkt-Gang sortiert (Obst→Backwaren→Milch→Fleisch→Tiefkühl→Getränke→Haushalt→Drogerie→Sonstiges) Abgehakte innerhalb der Kategorie ans Ende - POST /shopping/:listId/items — Artikel hinzufügen - PATCH /shopping/items/:id — Artikel aktualisieren (abhaken, umbenennen) - DELETE /shopping/items/:id — Einzelartikel löschen - DELETE /shopping/:listId/items/checked — nur abgehakte löschen - GET /shopping/suggestions?q= — Autocomplete aus bisherigen Einträgen Frontend: - Multi-Listen-Tabs (horizontal scrollbar, Artikel-Zähler im Tab) - Quick-Add: Name + Menge + Kategorie-Dropdown in einer Zeile - Autocomplete-Dropdown mit Tastaturnavigation (↑↓ Enter Escape) - Optimistisches Toggle: Checkbox reagiert sofort, Rollback bei Fehler - "Abgehakt löschen"-Button erscheint dynamisch bei checked > 0 - Listen umbenennen/löschen direkt im Header - Kategorie-Icons (Lucide) in Gruppen-Überschriften Tests: 17/17 bestanden (71 gesamt) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,431 @@
|
||||
/**
|
||||
* Modul: Einkaufslisten (Shopping)
|
||||
* Zweck: Styles für Listen-Tabs, Artikel-Liste, Kategorie-Gruppen, Quick-Add, Autocomplete
|
||||
* Abhängigkeiten: tokens.css, layout.css
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Seiten-Layout
|
||||
* -------------------------------------------------------- */
|
||||
.shopping-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100dvh - var(--nav-height-mobile) - var(--safe-area-inset-bottom));
|
||||
max-width: var(--content-max-width);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.shopping-page {
|
||||
height: 100dvh;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Listen-Tabs (horizontal scroll)
|
||||
* -------------------------------------------------------- */
|
||||
.list-tabs-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
background-color: var(--color-surface);
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.list-tabs-bar::-webkit-scrollbar { display: none; }
|
||||
|
||||
.list-tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-full);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: var(--font-weight-medium);
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
border: 1.5px solid var(--color-border);
|
||||
background-color: transparent;
|
||||
color: var(--color-text-secondary);
|
||||
transition: all var(--transition-fast);
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.list-tab--active {
|
||||
background-color: var(--color-accent);
|
||||
border-color: var(--color-accent);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.list-tab__count {
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
border-radius: var(--radius-full);
|
||||
padding: 1px 6px;
|
||||
font-size: var(--text-xs);
|
||||
}
|
||||
|
||||
.list-tab--active .list-tab__count {
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.list-tab__new {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: var(--radius-full);
|
||||
border: 1.5px dashed var(--color-border);
|
||||
background: none;
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: all var(--transition-fast);
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
.list-tab__new:hover {
|
||||
border-color: var(--color-accent);
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Liste-Header (Name + Aktionen)
|
||||
* -------------------------------------------------------- */
|
||||
.list-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--space-3) var(--space-4) var(--space-2);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.list-header__name {
|
||||
font-size: var(--text-lg);
|
||||
font-weight: var(--font-weight-bold);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.list-header__edit-icon {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
color: var(--color-text-disabled);
|
||||
}
|
||||
|
||||
.list-header__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Quick-Add Eingabe
|
||||
* -------------------------------------------------------- */
|
||||
.quick-add {
|
||||
padding: var(--space-2) var(--space-4) var(--space-3);
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.quick-add__form {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.quick-add__input-wrap {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.quick-add__input {
|
||||
width: 100%;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
padding-right: 80px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1.5px solid var(--color-border);
|
||||
background-color: var(--color-surface);
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--text-base);
|
||||
transition: border-color var(--transition-fast);
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.quick-add__input:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.quick-add__qty {
|
||||
position: absolute;
|
||||
right: var(--space-2);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 70px;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--color-border);
|
||||
background-color: var(--color-surface-2);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--text-sm);
|
||||
text-align: center;
|
||||
min-height: unset;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.quick-add__qty:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.quick-add__cat {
|
||||
width: 130px;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1.5px solid var(--color-border);
|
||||
background-color: var(--color-surface);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--text-sm);
|
||||
cursor: pointer;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.quick-add__cat:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.quick-add__btn {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: var(--radius-sm);
|
||||
background-color: var(--color-accent);
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: background-color var(--transition-fast);
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
.quick-add__btn:hover { background-color: var(--color-accent-hover); }
|
||||
|
||||
/* Autocomplete-Dropdown */
|
||||
.autocomplete-dropdown {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px);
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: var(--color-surface);
|
||||
border: 1.5px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-md);
|
||||
z-index: var(--z-modal);
|
||||
overflow: hidden;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.autocomplete-item {
|
||||
padding: var(--space-3) var(--space-4);
|
||||
cursor: pointer;
|
||||
font-size: var(--text-base);
|
||||
transition: background-color var(--transition-fast);
|
||||
}
|
||||
|
||||
.autocomplete-item:hover,
|
||||
.autocomplete-item--active {
|
||||
background-color: var(--color-accent-light);
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Artikel-Liste (scrollbar)
|
||||
* -------------------------------------------------------- */
|
||||
.items-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 var(--space-4) var(--space-4);
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Kategorie-Gruppen
|
||||
* -------------------------------------------------------- */
|
||||
.item-category {
|
||||
margin-bottom: var(--space-4);
|
||||
}
|
||||
|
||||
.item-category__header {
|
||||
font-size: var(--text-xs);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
color: var(--color-text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
padding: var(--space-2) 0 var(--space-1);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
margin-bottom: var(--space-1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.item-category__icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Einkaufsartikel
|
||||
* -------------------------------------------------------- */
|
||||
.shopping-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-3) var(--space-1);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
transition: opacity var(--transition-fast);
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.shopping-item:last-child { border-bottom: none; }
|
||||
|
||||
.shopping-item--checked {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
/* Checkbox */
|
||||
.item-check {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 2px solid var(--color-border);
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all var(--transition-fast);
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
.item-check--checked {
|
||||
background-color: var(--color-success);
|
||||
border-color: var(--color-success);
|
||||
}
|
||||
|
||||
.item-check__icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: #ffffff;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-check--checked .item-check__icon { display: block; }
|
||||
|
||||
/* Artikel-Text */
|
||||
.item-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: var(--text-base);
|
||||
color: var(--color-text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.shopping-item--checked .item-name {
|
||||
text-decoration: line-through;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.item-quantity {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--color-text-secondary);
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
/* Löschen-Button */
|
||||
.item-delete {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: var(--radius-sm);
|
||||
background: none;
|
||||
color: var(--color-text-disabled);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity var(--transition-fast), color var(--transition-fast);
|
||||
min-height: unset;
|
||||
border: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.shopping-item:hover .item-delete,
|
||||
.shopping-item:focus-within .item-delete {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.item-delete:hover { color: var(--color-danger); }
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* Leer-Zustand
|
||||
* -------------------------------------------------------- */
|
||||
.shopping-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--space-12) var(--space-6);
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.shopping-empty__icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
color: var(--color-text-disabled);
|
||||
margin-bottom: var(--space-4);
|
||||
}
|
||||
|
||||
.shopping-empty__title {
|
||||
font-size: var(--text-lg);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.shopping-empty__desc {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* No-Lists-Zustand
|
||||
* -------------------------------------------------------- */
|
||||
.no-lists {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
gap: var(--space-4);
|
||||
padding: var(--space-12);
|
||||
text-align: center;
|
||||
}
|
||||
Reference in New Issue
Block a user