From 49f601d200f76236a6be656d2d13c8948b3fdd95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:37:51 -0500 Subject: [PATCH] feat: added reset prompt --- src/app/tools/session/page.tsx | 83 +++++++++++++++++++++++++++++----- src/stores/session.ts | 19 ++++++-- 2 files changed, 87 insertions(+), 15 deletions(-) diff --git a/src/app/tools/session/page.tsx b/src/app/tools/session/page.tsx index 97023ac9a..d9a10c27c 100644 --- a/src/app/tools/session/page.tsx +++ b/src/app/tools/session/page.tsx @@ -1,7 +1,15 @@ 'use client'; import { CopyIcon, PersonIcon, ReloadIcon } from '@radix-ui/react-icons'; -import { Button, DropdownMenu, TextField } from '@radix-ui/themes'; +import { + AlertDialog, + Button, + Checkbox, + DropdownMenu, + Flex, + Text, + TextField, +} from '@radix-ui/themes'; import { debounce } from 'lodash'; import { ChangeEvent, useRef, useState } from 'react'; import PageWrapper from '../../../components/PageWrapper'; @@ -63,6 +71,12 @@ export default function Page() { }); } + function reset() { + const session = useSession.getState(); + if (!session.isTracking) return; + setSession(session.region, session.id, session.nickname); + } + return (
@@ -132,17 +146,62 @@ export default function Page() {
- + + + + + + + + + + Are you sure you want to reset? + + + This'll discard your current session and start tracking from + scratch again. + + + + + + useSession.setState({ + promptBeforeReset: !checked, + }) + } + /> + Don't ask me again + + + + + + + + + + + + + +