Skip to content

Commit 0163330

Browse files
author
Caleb Rogers
committed
Merge pull request 'feat: limit reset button clicks and display reset message' (#8) from sultanmyrza/running-calorie-average:fix-limit-reset-clicks-and-display-message into main
Reviewed-on: https://codeberg.org/508_dev/running-calorie-average/pulls/8 Reviewed-by: Caleb Rogers <[email protected]>
2 parents 2e9ca99 + 8a8b27d commit 0163330

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/routes/+page.svelte

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
1111
$: if (resetConfirm === 0) {
1212
calorieDateMap.reset();
13+
// Set resetConfirm back to 3 after 1500 milliseconds
14+
setTimeout(() => (resetConfirm = 3), 1500);
1315
}
1416
1517
function updateDateQuery(date: string) {
@@ -111,9 +113,12 @@
111113
</table>
112114
</section>
113115
<section>
114-
<button on:click={() => resetConfirm--}>
116+
<button disabled={resetConfirm <= 0} on:click={() => resetConfirm--}>
115117
Click {resetConfirm} times to permanently reset all calorie recordings
116118
</button>
119+
{#if resetConfirm === 0}
120+
<p>Data has been reset!</p>
121+
{/if}
117122
</section>
118123

119124
<style>

0 commit comments

Comments
 (0)