Skip to content

Commit

Permalink
Merge pull request 'feat: limit reset button clicks and display reset…
Browse files Browse the repository at this point in the history
… 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]>
  • Loading branch information
Caleb Rogers committed May 28, 2024
2 parents 2e9ca99 + 8a8b27d commit 0163330
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
$: if (resetConfirm === 0) {
calorieDateMap.reset();
// Set resetConfirm back to 3 after 1500 milliseconds
setTimeout(() => (resetConfirm = 3), 1500);
}
function updateDateQuery(date: string) {
Expand Down Expand Up @@ -111,9 +113,12 @@
</table>
</section>
<section>
<button on:click={() => resetConfirm--}>
<button disabled={resetConfirm <= 0} on:click={() => resetConfirm--}>
Click {resetConfirm} times to permanently reset all calorie recordings
</button>
{#if resetConfirm === 0}
<p>Data has been reset!</p>
{/if}
</section>

<style>
Expand Down

0 comments on commit 0163330

Please sign in to comment.