diff --git a/frontend/src/views/user/settings/General.vue b/frontend/src/views/user/settings/General.vue index c86733f02..c1a68a888 100644 --- a/frontend/src/views/user/settings/General.vue +++ b/frontend/src/views/user/settings/General.vue @@ -5,39 +5,30 @@ :loading="loading" >
-
- -

- {{ $t('user.settings.general.externalUserNameChange', {provider: authStore.info.authProvider}) }} -

-
-
- -
+ + + +

+ {{ $t('user.settings.general.externalUserNameChange', {provider: authStore.info.authProvider}) }} +

+ + +
@@ -47,111 +38,57 @@ :loading="loading" >
-
- -
-
- -
-
+ + + + + + - -
-
- -
-
- -
-
- -
-
+ + + + + - -
+ +
@@ -161,88 +98,58 @@ :loading="loading" >
-
- -
-
- -
-
- -
-
- -
-
- -
+ + + + + + + + + + + + + +
@@ -252,42 +159,24 @@ :loading="loading" >
-
- -
-
- -
+ + + + + +
-
- -
-
- -
-
- -
-
- -
-
- -
+ + + + + + + + +
@@ -375,20 +237,15 @@ :loading="loading" >
-
- -
+ + +
@@ -398,24 +255,14 @@ :loading="loading" >
-
- -
-
- -
+ +
@@ -445,9 +292,12 @@ import {PrefixMode} from '@/modules/quickAddMagic' import ProjectSearch from '@/components/tasks/partials/ProjectSearch.vue' import Multiselect from '@/components/input/Multiselect.vue' import CustomTransition from '@/components/misc/CustomTransition.vue' +import FormField from '@/components/input/FormField.vue' +import FormInput from '@/components/input/FormInput.vue' +import FormSelect from '@/components/input/FormSelect.vue' +import FormCheckbox from '@/components/input/FormCheckbox.vue' import {SUPPORTED_LOCALES} from '@/i18n' -import {createRandomID} from '@/helpers/randomId' import {AuthenticatedHTTPFactory} from '@/helpers/fetcher' import {formatDisplayDateFormat} from '@/helpers/time/formatDate' @@ -476,28 +326,68 @@ useTitle(() => `${t('user.settings.general.title')} - ${t('user.settings.title') const DEFAULT_PROJECT_ID = 0 -const colorSchemeSettings = computed(() => ({ - light: t('user.settings.appearance.colorScheme.light'), - auto: t('user.settings.appearance.colorScheme.system'), - dark: t('user.settings.appearance.colorScheme.dark'), -})) +const defaultViewOptions = computed(() => + Object.values(DEFAULT_PROJECT_VIEW_SETTINGS).map(view => ({ + value: view, + label: t(`project.${view}.title`), + })), +) -const dateDisplaySettings = computed(() => ({ - [DATE_DISPLAY.RELATIVE]: t('user.settings.general.dateDisplayOptions.relative'), - [DATE_DISPLAY.MM_DD_YYYY]: t('user.settings.general.dateDisplayOptions.mm-dd-yyyy'), - [DATE_DISPLAY.DD_MM_YYYY]: t('user.settings.general.dateDisplayOptions.dd-mm-yyyy'), - [DATE_DISPLAY.YYYY_MM_DD]: t('user.settings.general.dateDisplayOptions.yyyy-mm-dd'), - [DATE_DISPLAY.MM_SLASH_DD_YYYY]: t('user.settings.general.dateDisplayOptions.mm/dd/yyyy'), - [DATE_DISPLAY.DD_SLASH_MM_YYYY]: t('user.settings.general.dateDisplayOptions.dd/mm/yyyy'), - [DATE_DISPLAY.YYYY_SLASH_MM_DD]: t('user.settings.general.dateDisplayOptions.yyyy/mm/dd'), - [DATE_DISPLAY.DAY_MONTH_YEAR]: formatDisplayDateFormat(new Date(), DATE_DISPLAY.DAY_MONTH_YEAR, settings.value?.frontendSettings?.timeFormat), - [DATE_DISPLAY.WEEKDAY_DAY_MONTH_YEAR]: formatDisplayDateFormat(new Date(), DATE_DISPLAY.WEEKDAY_DAY_MONTH_YEAR, settings.value?.frontendSettings?.timeFormat), -})) +const minimumPriorityOptions = computed(() => [ + {value: PRIORITIES.LOW, label: t('task.priority.low')}, + {value: PRIORITIES.MEDIUM, label: t('task.priority.medium')}, + {value: PRIORITIES.HIGH, label: t('task.priority.high')}, + {value: PRIORITIES.URGENT, label: t('task.priority.urgent')}, + {value: PRIORITIES.DO_NOW, label: t('task.priority.doNow')}, +]) -const timeFormatSettings = computed(() => ({ - [TIME_FORMAT.HOURS_12]: t('user.settings.general.timeFormatOptions.12h'), - [TIME_FORMAT.HOURS_24]: t('user.settings.general.timeFormatOptions.24h'), -})) +const weekStartOptions = computed(() => [ + {value: 0, label: t('user.settings.general.weekStartSunday')}, + {value: 1, label: t('user.settings.general.weekStartMonday')}, +]) + +const dateDisplayOptions = computed(() => [ + {value: DATE_DISPLAY.RELATIVE, label: t('user.settings.general.dateDisplayOptions.relative')}, + {value: DATE_DISPLAY.MM_DD_YYYY, label: t('user.settings.general.dateDisplayOptions.mm-dd-yyyy')}, + {value: DATE_DISPLAY.DD_MM_YYYY, label: t('user.settings.general.dateDisplayOptions.dd-mm-yyyy')}, + {value: DATE_DISPLAY.YYYY_MM_DD, label: t('user.settings.general.dateDisplayOptions.yyyy-mm-dd')}, + {value: DATE_DISPLAY.MM_SLASH_DD_YYYY, label: t('user.settings.general.dateDisplayOptions.mm/dd/yyyy')}, + {value: DATE_DISPLAY.DD_SLASH_MM_YYYY, label: t('user.settings.general.dateDisplayOptions.dd/mm/yyyy')}, + {value: DATE_DISPLAY.YYYY_SLASH_MM_DD, label: t('user.settings.general.dateDisplayOptions.yyyy/mm/dd')}, + {value: DATE_DISPLAY.DAY_MONTH_YEAR, label: formatDisplayDateFormat(new Date(), DATE_DISPLAY.DAY_MONTH_YEAR, settings.value?.frontendSettings?.timeFormat)}, + {value: DATE_DISPLAY.WEEKDAY_DAY_MONTH_YEAR, label: formatDisplayDateFormat(new Date(), DATE_DISPLAY.WEEKDAY_DAY_MONTH_YEAR, settings.value?.frontendSettings?.timeFormat)}, +]) + +const timeFormatOptions = computed(() => [ + {value: TIME_FORMAT.HOURS_12, label: t('user.settings.general.timeFormatOptions.12h')}, + {value: TIME_FORMAT.HOURS_24, label: t('user.settings.general.timeFormatOptions.24h')}, +]) + +const colorSchemeOptions = computed(() => [ + {value: 'light', label: t('user.settings.appearance.colorScheme.light')}, + {value: 'auto', label: t('user.settings.appearance.colorScheme.system')}, + {value: 'dark', label: t('user.settings.appearance.colorScheme.dark')}, +]) + +const quickAddMagicModeOptions = computed(() => + (Object.values(PrefixMode) as PrefixMode[]).map(mode => ({ + value: mode, + label: t(`user.settings.quickAddMagic.${mode}`), + })), +) + +const defaultTaskRelationTypeOptions = computed(() => + RELATION_KINDS.map(kind => ({ + value: kind, + label: t(`task.relation.kinds.${kind}`, 1), + })), +) + +const languageOptions = computed(() => + Object.entries(SUPPORTED_LOCALES) + .map(([code, title]) => ({value: code, label: title})) + .sort((a, b) => a.label.localeCompare(b.label)), +) const authStore = useAuthStore() @@ -635,13 +525,6 @@ const { timezoneObject, } = useAvailableTimezones(settings) -const id = ref(createRandomID()) -const availableLanguageOptions = ref( - Object.entries(SUPPORTED_LOCALES) - .map(l => ({code: l[0], title: l[1]})) - .sort((a, b) => a.title.localeCompare(b.title)), -) - const isExternalUser = computed(() => !authStore.info.isLocalUser) watch( @@ -688,10 +571,6 @@ async function updateSettings() {