diff --git a/src/ncounter/App.svelte b/src/ncounter/App.svelte
index 896de3b..7384304 100644
--- a/src/ncounter/App.svelte
+++ b/src/ncounter/App.svelte
@@ -40,8 +40,6 @@ function showAdd(){
history: []
}
- console.log({ newCounter });
-
showAddDialog = true;
}
diff --git a/src/ncounter/Counter.svelte b/src/ncounter/Counter.svelte
index 2dc9661..256abed 100644
--- a/src/ncounter/Counter.svelte
+++ b/src/ncounter/Counter.svelte
@@ -7,18 +7,20 @@
{#if !counter.isClickCounter}
+
{/if}
{ message }
- {#if showIncrement}
+ {#if showDialog}
{/if}
@@ -35,10 +37,13 @@ export let counterId;
$: counter = $counters.find(x => x.id == counterId);
-let incrementValue;
+let dialogValue;
let showIncrement;
+let showSet;
let message = '';
+$: showDialog = showIncrement || showSet;
+
const formatter = new Intl.DateTimeFormat('en-US',
{
month: 'short',
@@ -56,16 +61,25 @@ function update(newCounter){
counters.update(newCounter);
}
-function increment(){
- const newCounter = {
+function dialogCancel(){
+ showIncrement = false;
+ showSet = false;
+}
+
+function dialogDone(){
+ const newCounter = showIncrement ? {
...counter,
- value: counter.value + incrementValue
+ value: counter.value + dialogValue
+ } : {
+ ...counter,
+ value: dialogValue
}
update(newCounter);
showIncrement = false;
- incrementValue = null;
+ showSet = false;
+ dialogValue = null;
}
function reset(e){
@@ -151,7 +165,7 @@ header {
margin-left: 0;
}
-.increment-value {
+.dialog-value {
width: 100%;
margin: 5px 0;
}