Fixed: Paste now updates meal and meat types correctly.
Fixed: When returning from a viewing, the filters refilter correctly. QOL: When a recipe is being re-edited, the page jumps to the editor.
This commit is contained in:
parent
01669aa53a
commit
5b4d9068a9
4
dist/build/bundle.css.map
vendored
4
dist/build/bundle.css.map
vendored
@ -6,9 +6,9 @@
|
||||
"../../RecipeItem.svelte"
|
||||
],
|
||||
"sourcesContent": [
|
||||
"<script>\n import { state } from '../store/store';\n\n function updateMeat(event) {\n const newVal = event.target.value;\n state.updateMeatFilter(newVal);\n }\n\n function updateMeal(event) {\n const newVal = event.target.value;\n state.updateMealFilter(newVal);\n }\n\n\n</script>\n\n<style>\n .filterBar {\n background: var(--medium-color);\n margin-bottom: 1rem;\n padding: 10px 5px;\n }\n</style>\n\n<div class=\"container\">\n <div class=\"filterBar grid-4\">\n <select on:change={updateMeat}>\n <option value=\"0\">All</option>\n <option value=\"1\">Chicken</option>\n <option value=\"2\">Beef</option>\n <option value=\"3\">Pork</option>\n <option value=\"4\">Fish</option>\n <option value=\"5\">Egg</option>\n <option value=\"6\">Vegetable</option>\n </select>\n\n <select on:change={updateMeal}>\n <option value=\"0\">All</option>\n <option value=\"1\">Mains</option>\n <option value=\"2\">Soups</option>\n <option value=\"128\">Notes</option>\n </select>\n </div>\n\n</div>\n",
|
||||
"<script>\n import { state } from '../store/store';\n import { onMount } from 'svelte';\n\n let meatVal = '0';\n let mealVal = '0';\n const meals = ['', '1', '2', '128'];\n\n function updateMeat(event) {\n const newVal = event.target.value;\n state.updateMeatFilter(newVal);\n }\n\n function updateMeal(event) {\n const newVal = event.target.value;\n state.updateMealFilter(newVal);\n }\n\n onMount(() => {\n\n setTimeout(() => {\n\n const mtVal = document.getElementById('meatVal').selectedIndex;\n const mlVal = document.getElementById('mealVal').selectedIndex;\n\n if (mtVal !== 0) {\n meatVal = mtVal.toString(10);\n state.updateMeatFilter(meatVal);\n }\n\n if (mlVal !== 0) {\n mealVal = meals[mlVal];\n state.updateMealFilter(mealVal);\n }\n\n }, 25);\n });\n\n</script>\n\n<style>\n .filterBar {\n background: var(--medium-color);\n margin-bottom: 1rem;\n padding: 10px 5px;\n }\n</style>\n\n<div class=\"container\">\n <div class=\"filterBar grid-4\">\n <select id=\"meatVal\" on:change={updateMeat} bind:value={meatVal}>\n <option value=\"0\">All</option>\n <option value=\"1\">Chicken</option>\n <option value=\"2\">Beef</option>\n <option value=\"3\">Pork</option>\n <option value=\"4\">Fish</option>\n <option value=\"5\">Egg</option>\n <option value=\"6\">Vegetable</option>\n </select>\n\n <select id=\"mealVal\" on:change={updateMeal} bind:value={mealVal}>\n <option value=\"0\">All</option>\n <option value=\"1\">Mains</option>\n <option value=\"2\">Soups</option>\n <option value=\"128\">Notes</option>\n </select>\n </div>\n\n</div>\n",
|
||||
"<script>\n import { state } from '../store/store';\n\n export let recipeItem = {};\n\n let meatClass;\n let meatText;\n let url;\n const meats = ['x', 'Chicken', 'Beef', 'Pork', 'Fish', 'Egg', 'Vegetable'];\n\n $:{\n meatText = meats[recipeItem.meat];\n meatClass = (recipeItem.meat === '') ? '' : meats[recipeItem.meat].toLowerCase();\n url = `/view/${recipeItem.short}`;\n }\n\n function editRecipe(hash) {\n state.editRecipe(hash);\n }\n\n</script>\n\n<style>\n .recipeItem {\n display: flex;\n padding: 0.1rem;\n border-bottom: 1px #ccc dotted;\n }\n\n .recipeItem:nth-of-type(odd) {\n background-color: rgba(0, 0, 0, 0.04);\n }\n\n .listItemSix {\n\n flex: 6;\n }\n\n .listItemThree {\n\n flex: 3;\n }\n\n .chicken {\n background: #8e5241;\n color: #fff;\n }\n\n .beef {\n background: #d72414;\n color: #fff;\n }\n\n .pork {\n background: #ef96d9;\n color: #fff;\n }\n\n .fish {\n background: #005ba0;\n color: #fff;\n }\n\n .egg {\n background: #fbc003;\n color: #000;\n }\n\n .vegetable {\n background: #00903e;\n color: #fff;\n }\n</style>\n\n<div class=\"recipeItem\">\n <div class=\"listItemSix\"><a href={url}>{recipeItem.name}</a></div>\n <div class=\"listItemThree\">\n {#if recipeItem.mealtype ===2}\n <span class=\"badge badge-light\">Soup</span>\n {:else if recipeItem.mealtype===128}\n <span class=\"badge badge-dark\">Note</span>\n\n {/if}\n <span class=\"badge {meatClass}\">{meatText}</span>\n </div>\n <div class=\"listItemThree all-center\">\n <button class=\"btn btn-primary btn-sm\" type=\"button\" on:click={editRecipe(recipeItem.hash)}>Edit</button>\n </div>\n</div>\n"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAiBI,UAAU,eAAC,CAAC,AACR,UAAU,CAAE,IAAI,cAAc,CAAC,CAC/B,aAAa,CAAE,IAAI,CACnB,OAAO,CAAE,IAAI,CAAC,GAAG,AACrB,CAAC;ACED,WAAW,cAAC,CAAC,AACT,OAAO,CAAE,IAAI,CACb,OAAO,CAAE,MAAM,CACf,aAAa,CAAE,GAAG,CAAC,IAAI,CAAC,MAAM,AAClC,CAAC,AAED,yBAAW,aAAa,GAAG,CAAC,AAAC,CAAC,AAC1B,gBAAgB,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,AACzC,CAAC,AAED,YAAY,cAAC,CAAC,AAEV,IAAI,CAAE,CAAC,AACX,CAAC,AAED,cAAc,cAAC,CAAC,AAEZ,IAAI,CAAE,CAAC,AACX,CAAC,AAED,QAAQ,cAAC,CAAC,AACN,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,IAAI,cAAC,CAAC,AACF,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,UAAU,cAAC,CAAC,AACR,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC"
|
||||
"mappings": "AAyCI,UAAU,eAAC,CAAC,AACR,UAAU,CAAE,IAAI,cAAc,CAAC,CAC/B,aAAa,CAAE,IAAI,CACnB,OAAO,CAAE,IAAI,CAAC,GAAG,AACrB,CAAC;ACtBD,WAAW,cAAC,CAAC,AACT,OAAO,CAAE,IAAI,CACb,OAAO,CAAE,MAAM,CACf,aAAa,CAAE,GAAG,CAAC,IAAI,CAAC,MAAM,AAClC,CAAC,AAED,yBAAW,aAAa,GAAG,CAAC,AAAC,CAAC,AAC1B,gBAAgB,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,AACzC,CAAC,AAED,YAAY,cAAC,CAAC,AAEV,IAAI,CAAE,CAAC,AACX,CAAC,AAED,cAAc,cAAC,CAAC,AAEZ,IAAI,CAAE,CAAC,AACX,CAAC,AAED,QAAQ,cAAC,CAAC,AACN,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,KAAK,cAAC,CAAC,AACH,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,IAAI,cAAC,CAAC,AACF,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC,AAED,UAAU,cAAC,CAAC,AACR,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,AACf,CAAC"
|
||||
}
|
2
dist/build/bundle.js
vendored
2
dist/build/bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/build/bundle.js.map
vendored
2
dist/build/bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@ exports.getAll = () => {
|
||||
outgoing.push(row);
|
||||
});
|
||||
|
||||
resolve(outgoing) ;
|
||||
resolve(outgoing);
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -68,7 +68,7 @@ exports.insertOne = (data) => {
|
||||
if (err)
|
||||
reject(err);
|
||||
|
||||
resolve({ 'msg':'Row inserted', '_id': this.lastID });
|
||||
resolve({ 'msg': 'Row inserted', '_id': this.lastID });
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -81,7 +81,7 @@ exports.deleteOne = (hash) => {
|
||||
if (err)
|
||||
reject(err);
|
||||
|
||||
resolve({ 'msg':'Row deleted', 'changes': this.changes });
|
||||
resolve({ 'msg': 'Row deleted', 'changes': this.changes });
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -102,7 +102,7 @@ exports.updateOne = (data) => {
|
||||
if (err)
|
||||
reject(err);
|
||||
|
||||
resolve({ 'msg':'Row updated', 'changes': this.changes });
|
||||
resolve({ 'msg': 'Row updated', 'changes': this.changes });
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -120,7 +120,7 @@ exports.getRandom = (timestamp) => {
|
||||
if (!err) {
|
||||
const outgoing = [...rows];
|
||||
|
||||
resolve(outgoing) ;
|
||||
resolve(outgoing);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -130,7 +130,7 @@ exports.updateTimestamps = (newTimestamp, items) => {
|
||||
const sqlTimestamp = ~~(newTimestamp / 1000);
|
||||
|
||||
console.log('>> items', items);
|
||||
|
||||
|
||||
const sql = 'UPDATE menu SET lastused = $lastused WHERE _id = $in';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -139,7 +139,7 @@ exports.updateTimestamps = (newTimestamp, items) => {
|
||||
|
||||
items.forEach((item) => {
|
||||
console.log(item);
|
||||
const newData = { '$lastused':sqlTimestamp, '$in':item };
|
||||
const newData = { '$lastused': sqlTimestamp, '$in': item };
|
||||
|
||||
stmt.run(newData);
|
||||
});
|
||||
@ -148,11 +148,9 @@ exports.updateTimestamps = (newTimestamp, items) => {
|
||||
if (err)
|
||||
reject(err);
|
||||
|
||||
resolve({ 'msg':'Row updateds' });
|
||||
resolve({ 'msg': 'Row updateds' });
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user