From 2ff7e6f8ce32a76479a745e82a4974c0d0d2133f Mon Sep 17 00:00:00 2001 From: ulfrxdev Date: Wed, 25 Mar 2026 22:44:12 +0100 Subject: [PATCH] Reorganise pantry view --- stacks/recipe/Dockerfile | 3 + stacks/recipe/icons/apple-touch-icon.png | Bin 0 -> 564 bytes stacks/recipe/icons/icon-192.png | Bin 0 -> 593 bytes stacks/recipe/icons/icon-512.png | Bin 0 -> 2201 bytes stacks/recipe/index.html | 16 +- stacks/recipe/js/views/Pantry.js | 846 ++++++++++------------- stacks/recipe/manifest.webmanifest | 31 + stacks/recipe/nginx/default.conf | 9 + stacks/recipe/sw.js | 13 + 9 files changed, 431 insertions(+), 487 deletions(-) create mode 100644 stacks/recipe/icons/apple-touch-icon.png create mode 100644 stacks/recipe/icons/icon-192.png create mode 100644 stacks/recipe/icons/icon-512.png create mode 100644 stacks/recipe/manifest.webmanifest create mode 100644 stacks/recipe/sw.js diff --git a/stacks/recipe/Dockerfile b/stacks/recipe/Dockerfile index 3170de3..3a490c9 100644 --- a/stacks/recipe/Dockerfile +++ b/stacks/recipe/Dockerfile @@ -3,6 +3,9 @@ FROM nginx:alpine COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY index.html /usr/share/nginx/html/ +COPY manifest.webmanifest /usr/share/nginx/html/ +COPY sw.js /usr/share/nginx/html/ +COPY icons /usr/share/nginx/html/icons COPY js /usr/share/nginx/html/js COPY css /usr/share/nginx/html/css diff --git a/stacks/recipe/icons/apple-touch-icon.png b/stacks/recipe/icons/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..31e470bbf6566fc4e994ebbf58b62c3d5342e4fd GIT binary patch literal 564 zcmeAS@N?(olHy`uVBq!ia0vp^TR@nD4M^IaWiw)6VEpar;uumf=k2A9oD2#K2Mpp1 zJ~RK{A245_Ws+ibd*9A)ja?tD8RCpgG~3jUURWYAOT>9{QbrJuZ`VRk!%@K@93W4b YJQu8x5x=Z&089-Gp00i_>zopr0IfRDH~;_u literal 0 HcmV?d00001 diff --git a/stacks/recipe/icons/icon-192.png b/stacks/recipe/icons/icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..f31fa2b254f5efe031613b0e627dcd8fa26b002c GIT binary patch literal 593 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE4M+yv$zf+;V3P23aSW-L^Y*eLBZGp#fdlIs z7Bl`8cH%kWH)sCMHMM#nXWujYILWX?vcZITLK?#*9*0?s9>xrrYzk*b1&48fRKHEE VX6>?P@&G0k22WQ%mvv4FO#mE_tDOJ< literal 0 HcmV?d00001 diff --git a/stacks/recipe/icons/icon-512.png b/stacks/recipe/icons/icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..ca5c9ef8103b4485f86983687bb676c5b67fb4e3 GIT binary patch literal 2201 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4YzZe)e5>puljz zKDxcM#m<-=$>Ia(czR*R74!2)hJdB0XAb)igPlY_z2)z4*}Q$iB} D1#}t! literal 0 HcmV?d00001 diff --git a/stacks/recipe/index.html b/stacks/recipe/index.html index 28899df..52c5a01 100644 --- a/stacks/recipe/index.html +++ b/stacks/recipe/index.html @@ -3,7 +3,14 @@ + + + + Recipe App - Modular + + + - + -
+
+ \ No newline at end of file diff --git a/stacks/recipe/js/views/Pantry.js b/stacks/recipe/js/views/Pantry.js index 4700971..27a8da6 100644 --- a/stacks/recipe/js/views/Pantry.js +++ b/stacks/recipe/js/views/Pantry.js @@ -2,586 +2,462 @@ import { INGREDIENTS, CATEGORY_LABELS, pantryQtyStep, - splitStockIntoPacks, } from '../data/catalog.js'; import { addIngredientToKitchenList, categoryLabel, loadPantry, setPantryQty } from '../services/pantryShopping.js'; import { showAppToast } from '../ui/toast.js'; -function escapeHtml(s) { - return String(s) - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); +/* ── helpers ── */ + +function esc(s) { + return String(s).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } -function pantryUnitLabel(u) { - if (u === 'szt') return 'szt.'; - return u; +function unitLabel(u) { + return u === 'szt' ? 'szt.' : u; } function normalizeSearch(q) { return String(q).trim().toLowerCase(); } -const PANTRY_SHOP_BOTTOM = '5.25rem'; -const PANTRY_SHOP_OFF = `translateY(calc(100% + ${PANTRY_SHOP_BOTTOM}))`; +const CATEGORY_ICONS = { + pieczywo: 'fa-bread-slice', + nabial: 'fa-cheese', + mieso_ryby: 'fa-drumstick-bite', + warzywa: 'fa-carrot', + owoce: 'fa-apple-whole', + suche: 'fa-wheat-awn', + przyprawy: 'fa-leaf', + inne: 'fa-jar', +}; -/** @type {string | null} */ -let shopPickerIngredientId = null; -/** @type {number} */ -let shopPickerStep = 1; -/** Czy licznik w arkuszu to liczba opakowań (vs. jednostki magazynowe). */ -let shopPickerUsesPacks = false; +/* ── state ── */ + +let showOnlyStock = false; +let editingId = null; +/** @type {Set} */ +const selectedCategories = new Set(); + +let editShopStep = 1; +let editShopUsesPacks = false; + +const BOTTOM = '5.25rem'; +const HIDDEN_Y = `translateY(calc(100% + ${BOTTOM}))`; + +/* ══════════════════════ HTML SHELL ══════════════════════ */ export function getPantryHTML() { return `