Votre panier
- - --
-
-
diff --git a/src/public/borne/assets/css/style.css b/src/public/borne/assets/css/style.css index ed68a70..0f7c3d3 100644 --- a/src/public/borne/assets/css/style.css +++ b/src/public/borne/assets/css/style.css @@ -292,7 +292,6 @@ button { justify-self: center; } -.site-header__cart, .site-header__mode { justify-self: end; } @@ -454,49 +453,6 @@ button { 7. SHARED COMPONENTS — header extensions + badges + buttons ============================================================ */ -/* Cart link in header (products / product / cart pages) */ -.site-header__cart { - position: relative; - display: inline-flex; - align-items: center; - justify-content: center; - width: 56px; - height: 56px; - border-radius: var(--radius-sm); - transition: background var(--transition-fast); - font-size: 1.6rem; - color: var(--color-text-primary); - text-decoration: none; -} - -.site-header__cart:hover, -.site-header__cart:focus-visible { - background: rgba(255, 199, 44, 0.18); - outline: none; -} - -.cart-icon { - line-height: 1; -} - -.cart-badge { - position: absolute; - top: 4px; - right: 4px; - min-width: 20px; - height: 20px; - padding: 0 4px; - border-radius: var(--radius-pill); - background: var(--color-brand-red); - color: #fff; - font-size: var(--font-size-xs); - font-weight: var(--font-weight-bold); - display: flex; - align-items: center; - justify-content: center; - line-height: 1; -} - /* Mode badge — shown in header for context */ .mode-badge { display: inline-block; @@ -744,215 +700,9 @@ button { } /* ============================================================ - 9. COMPONENT — PRODUCT DETAIL (product.html) + 10. COMPONENT — QUANTITY CONTROLS (modale options produit) ============================================================ */ -.product-page { - min-height: 100vh; - display: flex; - flex-direction: column; - background: var(--color-bg-page); -} - -.product-main { - flex: 1; - padding: var(--space-6); - max-width: 800px; - margin: 0 auto; - width: 100%; -} - -.product-error { - color: var(--color-brand-red); - font-size: var(--font-size-md); - padding: var(--space-5); -} - -.product-detail { - display: flex; - flex-direction: column; - gap: var(--space-6); -} - -.product-detail__skeleton { - /* Placeholder shown while JS loads data */ - width: 100%; - height: 300px; - background: var(--color-bg-card); - border-radius: var(--radius-md); - animation: skeleton-pulse 1.4s ease-in-out infinite; -} - -@keyframes skeleton-pulse { - 0%, 100% { opacity: 1; } - 50% { opacity: 0.4; } -} - -.product-detail__image-wrap { - width: 100%; - max-width: 480px; - margin: 0 auto; - background: var(--color-bg-card); - border-radius: var(--radius-md); - box-shadow: var(--shadow-card); - overflow: hidden; - aspect-ratio: 1 / 1; - display: flex; - align-items: center; - justify-content: center; -} - -.product-detail__image { - width: 100%; - height: 100%; - object-fit: contain; - padding: var(--space-5); -} - -.product-detail__info { - display: flex; - flex-direction: column; - gap: var(--space-4); -} - -.product-detail__name { - font-size: var(--font-size-xl); - font-weight: var(--font-weight-bold); - color: var(--color-text-primary); - line-height: 1.2; -} - -.product-detail__price { - font-size: var(--font-size-2xl); - font-weight: var(--font-weight-bold); - color: var(--color-brand-dark); -} - -.product-detail__composition { - background: var(--color-bg-card); - border-left: 4px solid var(--color-brand-yellow); - border-radius: 0 var(--radius-sm) var(--radius-sm) 0; - padding: var(--space-4) var(--space-5); -} - -.product-detail__composition-title { - font-size: var(--font-size-base); - font-weight: var(--font-weight-bold); - margin-bottom: var(--space-2); - color: var(--color-text-primary); -} - -.product-detail__composition-text { - font-size: var(--font-size-sm); - color: var(--color-text-secondary); - line-height: 1.5; -} - -.product-detail__add { - width: 100%; - margin-top: var(--space-2); -} - -/* ============================================================ - 10. COMPONENT — CART (cart.html) - ============================================================ */ - -.cart-page { - min-height: 100vh; - display: flex; - flex-direction: column; - background: var(--color-bg-page); -} - -.cart-main { - flex: 1; - padding: var(--space-6); - display: flex; - flex-direction: column; - gap: var(--space-5); - max-width: 900px; - margin: 0 auto; - width: 100%; -} - -.cart-main__heading { - font-size: var(--font-size-xl); - font-weight: var(--font-weight-bold); - color: var(--color-text-primary); -} - -.cart-empty { - text-align: center; - padding: var(--space-10) var(--space-6); - display: flex; - flex-direction: column; - align-items: center; - gap: var(--space-5); -} - -.cart-empty__message { - font-size: var(--font-size-lg); - color: var(--color-text-secondary); -} - -.cart-list { - display: flex; - flex-direction: column; - gap: var(--space-3); - list-style: none; - padding: 0; - margin: 0; -} - -/* One cart line */ -.cart-line { - display: flex; - align-items: center; - gap: var(--space-4); - background: var(--color-bg-card); - border-radius: var(--radius-md); - box-shadow: var(--shadow-card); - padding: var(--space-3) var(--space-4); -} - -.cart-line__image { - width: 72px; - height: 72px; - object-fit: contain; - flex-shrink: 0; - border-radius: var(--radius-sm); - background: var(--color-bg-page); -} - -.cart-line__info { - flex: 1; - min-width: 0; -} - -.cart-line__name { - display: block; - font-size: var(--font-size-base); - font-weight: var(--font-weight-bold); - color: var(--color-text-primary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.cart-line__unit-price { - display: block; - font-size: var(--font-size-sm); - color: var(--color-text-muted); -} - -/* Quantity controls */ -.cart-line__qty { - display: flex; - align-items: center; - gap: var(--space-2); - flex-shrink: 0; -} - .qty-btn { width: 44px; height: 44px; @@ -984,73 +734,6 @@ button { font-weight: var(--font-weight-bold); } -.cart-line__total { - font-size: var(--font-size-md); - font-weight: var(--font-weight-bold); - color: var(--color-text-primary); - flex-shrink: 0; - min-width: 80px; - text-align: right; -} - -.cart-line__remove { - background: none; - border: none; - cursor: pointer; - padding: var(--space-2); - border-radius: var(--radius-sm); - display: flex; - align-items: center; - justify-content: center; - flex-shrink: 0; - transition: background var(--transition-fast); -} - -.cart-line__remove:hover, -.cart-line__remove:focus-visible { - background: rgba(218, 2, 14, 0.10); - outline: none; -} - -/* Order summary block */ -.cart-summary { - background: var(--color-bg-card); - border-radius: var(--radius-md); - box-shadow: var(--shadow-card); - padding: var(--space-5); - display: flex; - flex-direction: column; - gap: var(--space-3); -} - -.cart-summary__line { - display: flex; - justify-content: space-between; - font-size: var(--font-size-base); - color: var(--color-text-secondary); -} - -.cart-summary__line--total { - padding-top: var(--space-3); - border-top: 2px solid var(--color-border-default); - font-size: var(--font-size-lg); - font-weight: var(--font-weight-bold); - color: var(--color-text-primary); -} - -/* Cart action row */ -.cart-actions { - display: flex; - gap: var(--space-4); - justify-content: space-between; - flex-wrap: wrap; - padding-bottom: var(--space-8); -} - -.cart-actions .btn { - flex: 1 1 200px; -} - /* ============================================================ 11. COMPONENT — PAYMENT (payment.html) ============================================================ */ @@ -1268,15 +951,6 @@ button { grid-template-columns: repeat(2, 1fr); } - .cart-line { - flex-wrap: wrap; - gap: var(--space-3); - } - - .cart-line__info { - flex: 1 1 calc(100% - 80px); - } - .payment-methods { flex-direction: column; align-items: stretch; @@ -1292,14 +966,10 @@ button { .products-main { padding: var(--space-4); } - - .cart-main { - padding: var(--space-4); - } } /* ============================================================ - 14. COMPONENT — MENU COMPOSER MODAL (product.html, type=menu) + 14. COMPONENT — MENU COMPOSER MODAL (modale ouverte depuis la grille produits) ============================================================ */ /* @@ -1515,10 +1185,6 @@ button { z-index: 2; } -.product-detail__info .allergen-info-btn { - margin-top: var(--space-3); -} - .allergen-modal-overlay { position: fixed; inset: 0; @@ -1788,31 +1454,6 @@ button { margin-right: auto; } -/* ---------- Cart line composition display -------------------- */ - -.cart-line__composition { - list-style: none; - padding: var(--space-1) 0 0; - margin: 0; - display: flex; - flex-direction: column; - gap: 2px; -} - -.cart-line__comp-item { - font-size: var(--font-size-xs); - color: var(--color-text-muted); - line-height: 1.4; -} - -.cart-line__comp-suppl { - font-size: var(--font-size-xs); - color: var(--color-brand-yellow-dk); - font-weight: var(--font-weight-bold); - line-height: 1.4; - padding-top: var(--space-1); -} - /* ---------- Responsive — narrow screens --------------------- */ @media (max-width: 600px) { @@ -1920,8 +1561,7 @@ button { } .order-panel__line { - position: relative; - padding: var(--space-3) var(--space-6) var(--space-3) 0; + padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-default); } @@ -1952,14 +1592,49 @@ button { content: "+ "; } +/* Ligne de controles : stepper de quantite a gauche, retrait a droite. */ +.order-panel__line-controls { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: var(--space-2); +} + +.order-panel__qty { + display: flex; + align-items: center; + gap: var(--space-2); +} + +/* Boutons +/- : cible tactile confortable (borne). */ +.order-panel__qty-btn { + min-width: 44px; + min-height: 44px; + border: 2px solid var(--color-border-default); + border-radius: var(--radius-sm); + background: var(--color-bg-card); + color: var(--color-text-primary); + font-size: var(--font-size-lg); + font-weight: var(--font-weight-bold); + line-height: 1; + cursor: pointer; +} + +.order-panel__qty-value { + min-width: 2ch; + text-align: center; + font-weight: var(--font-weight-bold); +} + .order-panel__remove { - position: absolute; - top: var(--space-3); - right: 0; + display: flex; + align-items: center; + justify-content: center; + min-width: 44px; + min-height: 44px; border: none; background: none; cursor: pointer; - padding: var(--space-1); line-height: 0; } diff --git a/src/public/borne/assets/js/order-panel.js b/src/public/borne/assets/js/order-panel.js index ed57f00..9869ba0 100644 --- a/src/public/borne/assets/js/order-panel.js +++ b/src/public/borne/assets/js/order-panel.js @@ -1,18 +1,18 @@ /* * order-panel.js — Panneau de commande persistant (maquette : recap a droite de - * l'ecran de commande). Rendu sur les ecrans de commande (products, product) pour - * que le panier reste visible en permanence, comme sur la maquette borne. + * l'ecran de commande). Rendu sur l'ecran de commande (products) pour que le panier + * reste visible en permanence, comme sur la maquette borne. * - * C'est un miroir COMPACT de page-cart.js : meme modele d'item, meme rendu de la - * composition de menu. La page panier (cart.html) reste la vue detaillee (TVA, +/-) ; - * le panneau, lui, montre lignes + total + Abandon/Payer et permet de retirer une - * ligne. La logique de mise en forme est extraite en fonctions PURES (buildPanelModel, - * compositionLabels) pour etre testable sans DOM. + * C'est l'UNIQUE vue panier : il montre lignes + total + Abandon/Payer, permet + * d'ajuster la quantite de chaque ligne (+/-) et de la retirer. La logique de mise + * en forme est extraite en fonctions PURES (buildPanelModel, compositionLabels) + * pour etre testable sans DOM. */ import { getCart, removeFromCart, + updateQuantity, computeMenuLineCents, clearCart, formatPrice, @@ -35,8 +35,8 @@ export function lineCents(item) { /** * Construit les libelles des options d'un menu (puces sous le nom de ligne). - * Miroir de renderCompositionBlock() de page-cart.js, sans le supplement (le panneau - * affiche le total de ligne, pas le detail TVA). Tolerant aux composants absents. + * Sans le supplement (le panneau affiche le total de ligne, pas le detail TVA). + * Tolerant aux composants absents. * @param {Object|undefined} c — objet composition de l'item menu * @returns {string[]} */ @@ -93,7 +93,7 @@ function modeLabel() { /** * Construit le HTML d'une ligne du panneau. Toute valeur derivee du catalogue est - * echappee (RG-T15 anti-XSS), comme dans page-cart.js. + * echappee (RG-T15 anti-XSS). * @param {Object} line — element de buildPanelModel().lines * @returns {string} */ @@ -106,18 +106,37 @@ function lineHtml(line) { return `
${formatPrice(product.prix)}
- -
- Sur place
-
-
-
- 0
- Panier
-
-