From 595fc18ea65e0b8c4d4084b3b22040a823ade781 Mon Sep 17 00:00:00 2001 From: Dimitri Gigot Date: Thu, 26 Mar 2020 17:03:53 +0000 Subject: [PATCH 1/4] Groceries app --- apps.json | 14 +++ apps/groceries/groceries.html | 158 ++++++++++++++++++++++++++++++++++ apps/groceries/groceries.png | Bin 0 -> 1800 bytes 3 files changed, 172 insertions(+) create mode 100644 apps/groceries/groceries.html create mode 100644 apps/groceries/groceries.png diff --git a/apps.json b/apps.json index cb0a1bf79..3e3c89bba 100644 --- a/apps.json +++ b/apps.json @@ -823,5 +823,19 @@ "storage": [ {"name":"widid.wid.js","url":"widget.js"} ] + }, + { + "id": "groceries", + "name": "Groceries", + "icon": "groceries.png", + "version":"0.01", + "description": "Simple grocery list - Display a list of product and track if you already put them in your cart.", + "tags": "tool,outdoors", + "type": "app", + "custom":"groceries.html", + "storage": [ + {"name":"groceries.json"}, + {"name":"groceries.app.js"} + ] } ] diff --git a/apps/groceries/groceries.html b/apps/groceries/groceries.html new file mode 100644 index 000000000..9da8b0e6b --- /dev/null +++ b/apps/groceries/groceries.html @@ -0,0 +1,158 @@ + + + + + + +

List of products

+ + + + + + + + + + + +
namequantityactions
+

+

Add a new product

+
+
+
+ +
+
+ +
+
+ +
+
+
+

+ + + + + + + diff --git a/apps/groceries/groceries.png b/apps/groceries/groceries.png new file mode 100644 index 0000000000000000000000000000000000000000..93a29a4a686f172e5e6dbd2ecb2a1d3edf4751c0 GIT binary patch literal 1800 zcmV+j2lx1iP)tlxqC9)f@Omu&Na^VuQ3o*OkLX&0x0b91a zC7LC3CR;|G&UwKyoC)@U)%oe$2-|YHkk(v4M!t35mBz$@a#wDU>?rxOl>4iDU0;K~&^NeJ~rZV1qG0 z2VEWRN{fW6B-AV=vyLG{LNQb2i6*D;)z1+>HV9oV)YY-AYv;CEAGyt1BxHeIB6`O1 zgNbCKvH5&(h}tjTY&oMqX-z=6c>c(BKect-eBUPt!g0uGg&+h40X>Fzw5_e#pVR#$ zXoP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cBz%HNa*=^#c>zCWO1`&}!lb?WRyb7@D_ zoMJQ4ZGbZ)W6%m}S;fo+s9pL&qm@ky;%p0`2i^anc~wxo1C;V!MN}J*?VR%}kkbG~ qkv|qi@hCO{S(a~Li!HWTm;V6Sm{)4DoNDL*0000 Date: Thu, 26 Mar 2020 17:20:23 +0000 Subject: [PATCH 2/4] Change product list style --- apps/groceries/groceries.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/groceries/groceries.html b/apps/groceries/groceries.html index 9da8b0e6b..0f29817ab 100644 --- a/apps/groceries/groceries.html +++ b/apps/groceries/groceries.html @@ -126,8 +126,12 @@ function updateSettings() { require("Storage").writeJSON(filename, settings); Bangle.buzz(); } +function twoChat(n){ + if(n<10) return '0'+n; + return ''+n; +} const mainMenu = settings.products.reduce(function(m, p, i){ - const name = '( '+p.quantity+' ) '+p.name; + const name = twoChat(p.quantity)+' '+p.name; m[name] = { value: p.ok, format: v => v?'[x]':'[ ]', From d0dd4b13af93296dfd66240fe361c076baf2c87a Mon Sep 17 00:00:00 2001 From: Dimitri Gigot Date: Thu, 26 Mar 2020 19:35:17 +0000 Subject: [PATCH 3/4] save on remove item --- apps/groceries/groceries.html | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/groceries/groceries.html b/apps/groceries/groceries.html index 0f29817ab..79acb4b59 100644 --- a/apps/groceries/groceries.html +++ b/apps/groceries/groceries.html @@ -87,6 +87,7 @@ function removeProduct(index){ products = products.filter((p,i) => i!==index) + save() renderProducts() } From 82feb3b7c102c068c211ae4de9ac9a377fa6b3b9 Mon Sep 17 00:00:00 2001 From: Dimitri Gigot Date: Fri, 27 Mar 2020 20:00:37 +0000 Subject: [PATCH 4/4] rename the app to have a 7character name & fix issue with saving --- apps.json | 12 ++++++------ .../groceries.html => grocery/grocery.html} | 8 ++++---- .../groceries.png => grocery/grocery.png} | Bin 3 files changed, 10 insertions(+), 10 deletions(-) rename apps/{groceries/groceries.html => grocery/grocery.html} (96%) rename apps/{groceries/groceries.png => grocery/grocery.png} (100%) diff --git a/apps.json b/apps.json index 3e3c89bba..c06cd49a8 100644 --- a/apps.json +++ b/apps.json @@ -825,17 +825,17 @@ ] }, { - "id": "groceries", - "name": "Groceries", - "icon": "groceries.png", + "id": "grocery", + "name": "Grocery", + "icon": "grocery.png", "version":"0.01", "description": "Simple grocery list - Display a list of product and track if you already put them in your cart.", "tags": "tool,outdoors", "type": "app", - "custom":"groceries.html", + "custom":"grocery.html", "storage": [ - {"name":"groceries.json"}, - {"name":"groceries.app.js"} + {"name":"grocery"}, + {"name":"grocery.app.js"} ] } ] diff --git a/apps/groceries/groceries.html b/apps/grocery/grocery.html similarity index 96% rename from apps/groceries/groceries.html rename to apps/grocery/grocery.html index 79acb4b59..12711375d 100644 --- a/apps/groceries/groceries.html +++ b/apps/grocery/grocery.html @@ -111,7 +111,7 @@ var newTime = ${Date.now()} var products = ${JSON.stringify(products)} var newTime = newTime; -var filename = 'groceries.json'; +var filename = 'grocery'; var settings = require("Storage").readJSON(filename,1)|| null; function getSettings(){ return { @@ -152,9 +152,9 @@ E.showMenu(mainMenu); var icon = `require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AQ0QACF1nGAAIxpFoYwqFwwwnRggwGB4eFAggACLzwHCMAeF1WGAgOGw2x2IGCLzYGEF4YpBwotCFwJfWFwo1GSAYtBAIIABRq4vFMhAwBzoAFdzIuKAAOc4IAGGC4qEMZOiF44wXFxovleBYvIGCwmB0WjE4V/AgfG1IvCzujFQOjwoECF6WFwovBDYOFEwN/AgIwCAgOFBwYrBBAQEBzodCF6AAHww1CBpIODAAYvRDAWG2IEBAYYJFBxICCF6Ox1WxAAQfBAYQlCAAIOJAQIvUADQvn1WGR4RfbP4gAFBwgFCF7a5EdwQADF46/cL9wAQF94AGF85bB1TvmF47vdJ4bvFF8qPRFgLv/L7jPCaQq/fYYrvgJgoAGd/7v/F/4v/F5oAdF54weFyAA/AH4A3A="))`; sendCustomizedApp({ storage:[ - {name:"groceries.app.js", content:app}, - {name:"groceries.img", content:icon, evaluate:true}, - {name:"groceries.json"} + {name:"grocery.app.js", content:app}, + {name:"grocery.img", content:icon, evaluate:true}, + {name:"grocery"} ] }); }); diff --git a/apps/groceries/groceries.png b/apps/grocery/grocery.png similarity index 100% rename from apps/groceries/groceries.png rename to apps/grocery/grocery.png