diff --git a/web/i18n/en/dialog.json b/web/i18n/en/dialog.json new file mode 100644 index 00000000..96a552ec --- /dev/null +++ b/web/i18n/en/dialog.json @@ -0,0 +1,8 @@ +{ + "button.gotit": "got it", + "button.cancel": "cancel", + "button.erase": "erase", + + "erase.title": "erase all settings?", + "erase.body": "are you sure you want to reset all settings? this action is immediate and irreversible." +} diff --git a/web/i18n/en/general.json b/web/i18n/en/general.json index 5a371ff8..6ea5e8a0 100644 --- a/web/i18n/en/general.json +++ b/web/i18n/en/general.json @@ -1,4 +1,3 @@ { - "cobalt": "cobalt", - "gotit": "got it" + "cobalt": "cobalt" } diff --git a/web/i18n/en/settings.json b/web/i18n/en/settings.json index 4df36dc5..0d20cc15 100644 --- a/web/i18n/en/settings.json +++ b/web/i18n/en/settings.json @@ -93,5 +93,7 @@ "advanced.debug": "debug", "advanced.debug.title": "enable debug features", "advanced.debug.description": "gives you access to a page with app & device info useful for debugging.", + + "advanced.data": "settings data", "advanced.reset": "erase all settings" } diff --git a/web/src/components/buttons/ResetSettingsButton.svelte b/web/src/components/buttons/ResetSettingsButton.svelte index 85a2139d..0434c84d 100644 --- a/web/src/components/buttons/ResetSettingsButton.svelte +++ b/web/src/components/buttons/ResetSettingsButton.svelte @@ -1,22 +1,55 @@ - - { $t('settings.advanced.reset') } + + + {$t("settings.advanced.reset")} diff --git a/web/src/components/dialog/DialogHolder.svelte b/web/src/components/dialog/DialogHolder.svelte index 7d6ef1dd..1f306c6b 100644 --- a/web/src/components/dialog/DialogHolder.svelte +++ b/web/src/components/dialog/DialogHolder.svelte @@ -12,6 +12,7 @@ id={dialog.id} title={dialog.title} meowbalt={dialog.meowbalt} + icon={dialog.icon} bodyText={dialog.bodyText} bodySubText={dialog.bodySubText} buttons={dialog.buttons} diff --git a/web/src/components/dialog/SmallDialog.svelte b/web/src/components/dialog/SmallDialog.svelte index 3820c88e..4aa12b72 100644 --- a/web/src/components/dialog/SmallDialog.svelte +++ b/web/src/components/dialog/SmallDialog.svelte @@ -2,13 +2,16 @@ import { tick } from "svelte"; import { killDialog } from "$lib/dialogs"; - import type { DialogButton } from "$lib/types/dialog"; + import type { DialogButton, SmallDialogIcons } from "$lib/types/dialog"; import Meowbalt from "$components/misc/Meowbalt.svelte"; import type { MeowbaltEmotions } from "$lib/types/meowbalt"; + import IconAlertTriangle from "@tabler/icons-svelte/IconAlertTriangle.svelte"; + export let id: string; - export let meowbalt: MeowbaltEmotions; + export let meowbalt: MeowbaltEmotions | undefined; + export let icon: SmallDialogIcons | undefined; export let title: string = ""; export let bodyText: string = ""; export let bodySubText: string = ""; @@ -45,12 +48,19 @@ {/if} - {#if title} - - {title} - - {/if} + {#if title || icon} + + {#if icon === "warn-red"} + + + + {/if} + {#if title} + {title} + {/if} + + {/if} {#if bodyText} {bodyText} {/if} @@ -61,7 +71,7 @@ {#each buttons as button} { await button.action(); @@ -116,8 +126,15 @@ gap: var(--padding); } + .popup-body { + gap: 8px; + } + .small-dialog { --small-dialog-padding: 18px; + + align-items: center; + text-align: center; max-width: 340px; width: calc( 100% - var(--padding) * 2 - var(--small-dialog-padding) * 2 @@ -144,8 +161,6 @@ .small-dialog.meowbalt-visible { padding-top: calc(var(--padding) * 4); - align-items: center; - text-align: center; } .meowbalt-container { @@ -153,8 +168,16 @@ top: -120px; } - .popup-header { + .popup-header h2 { color: var(--secondary); + font-size: 19px; + } + + .popup-header .popup-icon.warn-red :global(svg) { + stroke-width: 1.5px; + height: 50px; + width: 50px; + stroke: var(--red); } .body-text { @@ -175,6 +198,8 @@ flex-direction: row; width: 100%; gap: calc(var(--padding) / 2); + overflow: scroll; + border-radius: var(--border-radius); } .popup-button { @@ -182,10 +207,18 @@ height: 40px; } + .popup-button.red { + background-color: var(--red); + } + .popup-button:not(.active) { background-color: var(--button-elevated); } + .popup-button:not(.active):active { + background-color: var(--button-elevated-hover); + } + .popup-button:not(:focus-visible) { box-shadow: none; } diff --git a/web/src/components/save/buttons/DownloadButton.svelte b/web/src/components/save/buttons/DownloadButton.svelte index b2c5ae8d..40b78942 100644 --- a/web/src/components/save/buttons/DownloadButton.svelte +++ b/web/src/components/save/buttons/DownloadButton.svelte @@ -16,16 +16,16 @@ $: buttonAltText = $t('a11y.save.download'); $: isDisabled = false; - let defaultErrorPopup = { + let defaultErrorPopup: DialogInfo = { id: "save-error", type: "small", meowbalt: "error", buttons: [{ - text: $t("general.gotit"), + text: $t("dialog.button.gotit"), main: true, action: () => {}, }] - } as DialogInfo + } const changeDownloadButton = (state: string) => { isDisabled = true; diff --git a/web/src/lib/types/dialog.ts b/web/src/lib/types/dialog.ts index 888dc646..6630fd6f 100644 --- a/web/src/lib/types/dialog.ts +++ b/web/src/lib/types/dialog.ts @@ -2,17 +2,20 @@ import type { MeowbaltEmotions } from "$lib/types/meowbalt"; export type DialogButton = { text: string, - color: "blue" | "red" | "default", + color?: "red", main: boolean, action: () => unknown | Promise } +export type SmallDialogIcons = "warn-red"; + export type DialogInfo = { id: string, type: "small", - meowbalt: MeowbaltEmotions | "", - title: string, - bodyText: string, - bodySubText: string, + meowbalt?: MeowbaltEmotions, + icon?: SmallDialogIcons, + title?: string, + bodyText?: string, + bodySubText?: string, buttons: DialogButton[], } diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index b6eac3e6..7bb8c8ff 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -60,8 +60,9 @@ --white: #ffffff; --gray: #75757e; - --red: #f92f2f; - --dark-red: #df0707; + + --red: #ed2236; + --dark-red: #d61c2e; --green: #51cf5e; --blue: #2f8af9; @@ -127,6 +128,7 @@ --secondary: #e1e1e1; --gray: #818181; + --blue: #2a7ce1; --green: #37aa42; @@ -288,6 +290,10 @@ background-color: var(--secondary); } + :global(.button.active:active) { + background-color: var(--button-active-hover); + } + /* important is used because active class is toggled by state */ /* and added to the end of the list, taking priority */ :global(.active:focus-visible) { diff --git a/web/src/routes/settings/advanced/+page.svelte b/web/src/routes/settings/advanced/+page.svelte index 1fe02104..6ac2b73e 100644 --- a/web/src/routes/settings/advanced/+page.svelte +++ b/web/src/routes/settings/advanced/+page.svelte @@ -15,6 +15,6 @@ /> - + - \ No newline at end of file +