mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
more work on settings
This commit is contained in:
@@ -18,6 +18,11 @@ import {setupI18n} from "@/i18n";
|
|||||||
import SettingsPage from "@/pages/SettingsPage.vue";
|
import SettingsPage from "@/pages/SettingsPage.vue";
|
||||||
import AccountSettings from "@/components/settings/AccountSettings.vue";
|
import AccountSettings from "@/components/settings/AccountSettings.vue";
|
||||||
import CosmeticSettings from "@/components/settings/CosmeticSettings.vue";
|
import CosmeticSettings from "@/components/settings/CosmeticSettings.vue";
|
||||||
|
import ShoppingSettings from "@/components/settings/ShoppingSettings.vue";
|
||||||
|
import MealPlanSettings from "@/components/settings/MealPlanSettings.vue";
|
||||||
|
import SpaceSettings from "@/components/settings/SpaceSettings.vue";
|
||||||
|
import SpaceMemberSettings from "@/components/settings/SpaceMemberSettings.vue";
|
||||||
|
import UserSpaceSettings from "@/components/settings/UserSpaceSettings.vue";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{path: '/', component: StartPage, name: 'view_home'},
|
{path: '/', component: StartPage, name: 'view_home'},
|
||||||
@@ -26,6 +31,11 @@ const routes = [
|
|||||||
children: [
|
children: [
|
||||||
{path: 'account', component: AccountSettings, name: 'view_settings_account'},
|
{path: 'account', component: AccountSettings, name: 'view_settings_account'},
|
||||||
{path: 'cosmetic', component: CosmeticSettings, name: 'view_settings_cosmetic'},
|
{path: 'cosmetic', component: CosmeticSettings, name: 'view_settings_cosmetic'},
|
||||||
|
{path: 'shopping', component: ShoppingSettings, name: 'view_settings_shopping'},
|
||||||
|
{path: 'meal-plan', component: MealPlanSettings, name: 'view_settings_mealplan'},
|
||||||
|
{path: 'space', component: SpaceSettings, name: 'view_settings_space'},
|
||||||
|
{path: 'space-members', component: SpaceMemberSettings, name: 'view_settings_space_member'},
|
||||||
|
{path: 'user-space', component: UserSpaceSettings, name: 'view_settings_user_space'},
|
||||||
]},
|
]},
|
||||||
//{path: '/settings/:page', component: SettingsPage, name: 'view_settings_page', props: true},
|
//{path: '/settings/:page', component: SettingsPage, name: 'view_settings_page', props: true},
|
||||||
{path: '/search', component: SearchPage, name: 'view_search'},
|
{path: '/search', component: SearchPage, name: 'view_search'},
|
||||||
|
|||||||
21
vue3/src/components/settings/MealPlanSettings.vue
Normal file
21
vue3/src/components/settings/MealPlanSettings.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<v-form>
|
||||||
|
<p class="text-h6">{{ $t('Cosmetic') }}</p>
|
||||||
|
<v-divider class="mb-3"></v-divider>
|
||||||
|
|
||||||
|
|
||||||
|
<v-btn class="mt-3" color="success" @click="useUserPreferenceStore().updateUserSettings()" prepend-icon="$save">{{$t('Save')}}</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
21
vue3/src/components/settings/ShoppingSettings.vue
Normal file
21
vue3/src/components/settings/ShoppingSettings.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<v-form>
|
||||||
|
<p class="text-h6">{{ $t('Cosmetic') }}</p>
|
||||||
|
<v-divider class="mb-3"></v-divider>
|
||||||
|
|
||||||
|
|
||||||
|
<v-btn class="mt-3" color="success" @click="useUserPreferenceStore().updateUserSettings()" prepend-icon="$save">{{$t('Save')}}</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
21
vue3/src/components/settings/SpaceMemberSettings.vue
Normal file
21
vue3/src/components/settings/SpaceMemberSettings.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<v-form>
|
||||||
|
<p class="text-h6">{{ $t('Cosmetic') }}</p>
|
||||||
|
<v-divider class="mb-3"></v-divider>
|
||||||
|
|
||||||
|
|
||||||
|
<v-btn class="mt-3" color="success" @click="useUserPreferenceStore().updateUserSettings()" prepend-icon="$save">{{$t('Save')}}</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
21
vue3/src/components/settings/SpaceSettings.vue
Normal file
21
vue3/src/components/settings/SpaceSettings.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<v-form>
|
||||||
|
<p class="text-h6">{{ $t('Cosmetic') }}</p>
|
||||||
|
<v-divider class="mb-3"></v-divider>
|
||||||
|
|
||||||
|
|
||||||
|
<v-btn class="mt-3" color="success" @click="useUserPreferenceStore().updateUserSettings()" prepend-icon="$save">{{$t('Save')}}</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
39
vue3/src/components/settings/UserSpaceSettings.vue
Normal file
39
vue3/src/components/settings/UserSpaceSettings.vue
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12"></v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="3" v-for="us in userSpaces">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>{{us.space}}</v-card-title>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import {onMounted, ref} from "vue";
|
||||||
|
import {ApiApi, UserSpace} from "@/openapi";
|
||||||
|
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
|
||||||
|
|
||||||
|
const userSpaces = ref([] as UserSpace[])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const api = new ApiApi()
|
||||||
|
|
||||||
|
api.apiUserSpaceList().then(r => {
|
||||||
|
userSpaces.value = r.results
|
||||||
|
}).catch(err => {
|
||||||
|
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-list-subheader>{{ $t('Settings') }}</v-list-subheader>
|
<v-list-subheader>{{ $t('Settings') }}</v-list-subheader>
|
||||||
<v-list-item :to="{name: 'view_settings_cosmetic'}" prepend-icon="fa-solid fa-palette">{{ $t('Cosmetic') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_cosmetic'}" prepend-icon="fa-solid fa-palette">{{ $t('Cosmetic') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="$shopping">{{ $t('Shopping_list') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_shopping'}" prepend-icon="$shopping">{{ $t('Shopping_list') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="$mealplan">{{ $t('Meal_Plan') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_mealplan'}" prepend-icon="$mealplan">{{ $t('Meal_Plan') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="$search">{{ $t('Search') }}</v-list-item>
|
<!-- <v-list-item prepend-icon="$search">{{ $t('Search') }}</v-list-item>-->
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-list-subheader>Space</v-list-subheader>
|
<v-list-subheader>Space</v-list-subheader>
|
||||||
<v-list-item prepend-icon="$spaces">{{ $t('YourSpaces') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_user_space'}" prepend-icon="$spaces">{{ $t('YourSpaces') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="$settings">{{ $t('SpaceSettings') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_space'}" prepend-icon="$settings">{{ $t('SpaceSettings') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="fa-solid fa-users">{{ $t('SpaceSettings') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_space_member'}" prepend-icon="fa-solid fa-users">{{ $t('SpaceMembers') }}</v-list-item>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-list-subheader>Admin</v-list-subheader>
|
<v-list-subheader>Admin</v-list-subheader>
|
||||||
<v-list-item prepend-icon="fa-solid fa-code">{{ $t('API') }}</v-list-item>
|
<v-list-item prepend-icon="fa-solid fa-code">{{ $t('API') }}</v-list-item>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import {acceptHMRUpdate, defineStore} from 'pinia'
|
import {acceptHMRUpdate, defineStore} from 'pinia'
|
||||||
import {useStorage} from "@vueuse/core";
|
import {useStorage} from "@vueuse/core";
|
||||||
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
|
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
|
||||||
import {ApiApi, UserPreference} from "@/openapi";
|
import {ApiApi, Space, UserPreference} from "@/openapi";
|
||||||
|
|
||||||
const DEVICE_SETTINGS_KEY = 'TANDOOR_DEVICE_SETTINGS'
|
const DEVICE_SETTINGS_KEY = 'TANDOOR_DEVICE_SETTINGS'
|
||||||
const USER_PREFERENCE_KEY = 'TANDOOR_USER_PREFERENCE'
|
const USER_PREFERENCE_KEY = 'TANDOOR_USER_PREFERENCE'
|
||||||
|
const ACTIVE_SPACE_KEY = 'TANDOOR_ACTIVE_SPACE'
|
||||||
|
|
||||||
class DeviceSettings {
|
class DeviceSettings {
|
||||||
|
|
||||||
@@ -29,6 +30,11 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
|||||||
*/
|
*/
|
||||||
let userSettings = useStorage(USER_PREFERENCE_KEY, {} as UserPreference)
|
let userSettings = useStorage(USER_PREFERENCE_KEY, {} as UserPreference)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* database user settings, cache in local storage in case application is started offline
|
||||||
|
*/
|
||||||
|
let activeSpace = useStorage(ACTIVE_SPACE_KEY, {} as Space)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve user settings from DB
|
* retrieve user settings from DB
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user