diff --git a/app.vue b/app.vue index 686a15e..beab80b 100644 --- a/app.vue +++ b/app.vue @@ -8,6 +8,7 @@ diff --git a/components/UserInterface/RadioButtons.vue b/components/UserInterface/RadioButtons.vue index c36b5d0..a43a80a 100644 --- a/components/UserInterface/RadioButtons.vue +++ b/components/UserInterface/RadioButtons.vue @@ -1,6 +1,6 @@ - + {{ textStrings[index] }} @@ -19,7 +19,7 @@ const props = defineProps<{ }>(); // makes an array from 0 to buttonCount - 1 -const indices = Array.from({ length: props.buttonCount }, (_, i) => i) +const incidies = Array.from({ length: props.buttonCount }, (_, i) => i) // select default selected button onMounted(async () => { diff --git a/types/settings.ts b/types/settings.ts deleted file mode 100644 index 28e3bfc..0000000 --- a/types/settings.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface ClientSettings { - selectedThemeId?: string, // the ID of the theme, not the URL, for example "dark" - timeFormat?: TimeFormat -} - -export interface TimeFormat { - index: number, - format: "auto" | "12" | "24" -} \ No newline at end of file diff --git a/utils/getPreferredTimeFormat.ts b/utils/getPreferredTimeFormat.ts index 86b9635..4cf03e0 100644 --- a/utils/getPreferredTimeFormat.ts +++ b/utils/getPreferredTimeFormat.ts @@ -1,9 +1,9 @@ export default (): "12" | "24" => { - const format = settingsLoad().timeFormat?.format ?? "auto" + const format = settingLoad("timeFormat").timeFormat ?? "auto" - if (format == "12") { + if (format == "12-hour") { return "12" - } else if (format == "24") { + } else if (format == "24-hour") { return "24" } diff --git a/utils/settingsLoad.ts b/utils/settingLoad.ts similarity index 66% rename from utils/settingsLoad.ts rename to utils/settingLoad.ts index e7fdfaf..d0f315c 100644 --- a/utils/settingsLoad.ts +++ b/utils/settingLoad.ts @@ -1,12 +1,10 @@ -import type { ClientSettings } from "~/types/settings" - -export default (): ClientSettings => { +export default (key: string): any => { let clientSettingsItem: string | null = localStorage.getItem("clientSettings") if (typeof clientSettingsItem != "string") { clientSettingsItem = "{}" } - let clientSettings: ClientSettings = {} + let clientSettings: { [key: string]: any } = {} try { clientSettings = JSON.parse(clientSettingsItem) } catch { @@ -17,5 +15,5 @@ export default (): ClientSettings => { clientSettings = {} } - return clientSettings + return clientSettings[key] } \ No newline at end of file