From 1f3c071fca36e129b7d88b01799aeda9e28ad155 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 9 Apr 2021 18:32:10 +0300 Subject: [PATCH] Add button to increase items in todo page --- src/routes/todo.svelte | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/routes/todo.svelte b/src/routes/todo.svelte index bc2ccdea..8631a1c7 100644 --- a/src/routes/todo.svelte +++ b/src/routes/todo.svelte @@ -16,6 +16,9 @@ import { dropRates } from '../data/dropRates'; const { open: openModal, close: closeModal } = getContext('simple-modal'); + + const AMOUNT_GOLD_CHANGE = [1000, 10000, 50000]; + const AMOUNT_ITEM_CHANGE = [1, 5, 10]; let refreshLayout; let columnCount = 1; @@ -122,6 +125,16 @@ }); } + function increase(key, val) { + todos.update((n) => { + let target = n.find(c=>c.resources.hasOwnProperty(key)); + if(target) + target.resources[key] += val; + + return n; + }); + } + async function updateSummary() { const todayOnly = {}; summary = $todos.reduce((prev, current) => { @@ -386,27 +399,17 @@ {itemList[id].name} - {#if id === 'mora'} - - - - {:else} - - - - {/if} + {/each} {/each}