Allow user to set string based default activity

This commit is contained in:
Miah 2025-02-27 21:36:31 +00:00
commit 7e0e0fe8f0
2 changed files with 43 additions and 135 deletions

View file

@ -193,6 +193,7 @@ export interface UserBase {
group?: string | null; group?: string | null;
household?: string | null; household?: string | null;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;
@ -209,6 +210,7 @@ export interface UserIn {
group?: string | null; group?: string | null;
household?: string | null; household?: string | null;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;
@ -225,6 +227,7 @@ export interface UserOut {
group: string; group: string;
household: string; household: string;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;

View file

@ -3,18 +3,9 @@
<BasePageTitle divider> <BasePageTitle divider>
<template #header> <template #header>
<div class="d-flex flex-column align-center justify-center"> <div class="d-flex flex-column align-center justify-center">
<UserAvatar <UserAvatar :tooltip="false" size="96" :user-id="userCopy.id!" />
:tooltip="false" <AppButtonUpload class="my-1" file-name="profile" accept="image/*" :url="`/api/users/${userCopy.id}/image`"
size="96" @uploaded="$auth.refresh()" />
:user-id="userCopy.id!"
/>
<AppButtonUpload
class="my-1"
file-name="profile"
accept="image/*"
:url="`/api/users/${userCopy.id}/image`"
@uploaded="$auth.refresh()"
/>
</div> </div>
</template> </template>
<template #title> <template #title>
@ -25,23 +16,13 @@
<section class="mt-5"> <section class="mt-5">
<ToggleState tag="article"> <ToggleState tag="article">
<template #activator="{ toggle, state }"> <template #activator="{ toggle, state }">
<v-btn <v-btn v-if="!state" color="info" class="mt-2 mb-n3" @click="toggle">
v-if="!state"
color="info"
class="mt-2 mb-n3"
@click="toggle"
>
<v-icon start> <v-icon start>
{{ $globals.icons.lock }} {{ $globals.icons.lock }}
</v-icon> </v-icon>
{{ $t("settings.change-password") }} {{ $t("settings.change-password") }}
</v-btn> </v-btn>
<v-btn <v-btn v-else color="info" class="mt-2 mb-n3" @click="toggle">
v-else
color="info"
class="mt-2 mb-n3"
@click="toggle"
>
<v-icon start> <v-icon start>
{{ $globals.icons.user }} {{ $globals.icons.user }}
</v-icon> </v-icon>
@ -49,116 +30,57 @@
</v-btn> </v-btn>
</template> </template>
<template #default="{ state }"> <template #default="{ state }">
<v-slide-x-transition <v-slide-x-transition leave-absolute hide-on-leave>
leave-absolute <div v-if="!state" key="personal-info">
hide-on-leave <BaseCardSectionTitle class="mt-10" :title="$t('profile.personal-information')" />
> <v-card tag="article" variant="outlined" style="border-color: lightgrey;">
<div
v-if="!state"
key="personal-info"
>
<BaseCardSectionTitle
class="mt-10"
:title="$t('profile.personal-information')"
/>
<v-card
tag="article"
variant="outlined"
style="border-color: lightgrey;"
>
<v-card-text class="pb-0"> <v-card-text class="pb-0">
<v-form ref="userUpdate"> <v-form ref="userUpdate">
<v-text-field <v-text-field v-model="userCopy.username" :label="$t('user.username')" required validate-on="blur"
v-model="userCopy.username" density="comfortable" variant="underlined" />
:label="$t('user.username')" <v-text-field v-model="userCopy.fullName" :label="$t('user.full-name')" required validate-on="blur"
required density="comfortable" variant="underlined" />
validate-on="blur" <v-text-field v-model="userCopy.email" :label="$t('user.email')" validate-on="blur" required
density="comfortable" density="comfortable" variant="underlined" />
variant="underlined" <v-text-field v-model="userCopy.defaultActivity" :label="'Default Activity'" validate-on-blur
/> required>
<v-text-field </v-text-field>
v-model="userCopy.fullName"
:label="$t('user.full-name')"
required
validate-on="blur"
density="comfortable"
variant="underlined"
/>
<v-text-field
v-model="userCopy.email"
:label="$t('user.email')"
validate-on="blur"
required
density="comfortable"
variant="underlined"
/>
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<BaseButton <BaseButton update @click="updateUser" />
update
@click="updateUser"
/>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</div> </div>
<div <div v-else key="change-password">
v-else <BaseCardSectionTitle class="mt-10" :title="$t('settings.change-password')" />
key="change-password"
>
<BaseCardSectionTitle
class="mt-10"
:title="$t('settings.change-password')"
/>
<v-card variant="outlined"> <v-card variant="outlined">
<v-card-text class="pb-0"> <v-card-text class="pb-0">
<v-form ref="passChange"> <v-form ref="passChange">
<v-text-field <v-text-field v-model="password.current" :prepend-icon="$globals.icons.lock"
v-model="password.current" :label="$t('user.current-password')" validate-on="blur" :type="showPassword ? 'text' : 'password'"
:prepend-icon="$globals.icons.lock"
:label="$t('user.current-password')"
validate-on="blur"
:type="showPassword ? 'text' : 'password'"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff"
:rules="[validators.minLength(1)]" :rules="[validators.minLength(1)]" density="comfortable" variant="underlined"
density="comfortable" @click:append="showPassword = !showPassword" />
variant="underlined" <v-text-field v-model="password.newOne" :prepend-icon="$globals.icons.lock"
@click:append="showPassword = !showPassword" :label="$t('user.new-password')" :type="showPassword ? 'text' : 'password'"
/>
<v-text-field
v-model="password.newOne"
:prepend-icon="$globals.icons.lock"
:label="$t('user.new-password')"
:type="showPassword ? 'text' : 'password'"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff"
:rules="[validators.minLength(8)]" :rules="[validators.minLength(8)]" density="comfortable" variant="underlined"
density="comfortable" @click:append="showPassword = !showPassword" />
variant="underlined" <v-text-field v-model="password.newTwo" :prepend-icon="$globals.icons.lock"
@click:append="showPassword = !showPassword"
/>
<v-text-field
v-model="password.newTwo"
:prepend-icon="$globals.icons.lock"
:label="$t('user.confirm-password')" :label="$t('user.confirm-password')"
:rules="[password.newOne === password.newTwo || $t('user.password-must-match')]" :rules="[password.newOne === password.newTwo || $t('user.password-must-match')]"
validate-on="blur" validate-on="blur" :type="showPassword ? 'text' : 'password'"
:type="showPassword ? 'text' : 'password'" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" density="comfortable"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" variant="underlined" @click:append="showPassword = !showPassword" />
density="comfortable"
variant="underlined"
@click:append="showPassword = !showPassword"
/>
<UserPasswordStrength v-model="password.newOne" /> <UserPasswordStrength v-model="password.newOne" />
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<BaseButton <BaseButton update :disabled="!passwordsMatch || password.current.length < 0"
update @click="updatePassword" />
:disabled="!passwordsMatch || password.current.length < 0"
@click="updatePassword"
/>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</div> </div>
@ -167,30 +89,13 @@
</ToggleState> </ToggleState>
</section> </section>
<section> <section>
<BaseCardSectionTitle <BaseCardSectionTitle class="mt-10" :title="$t('profile.preferences')" />
class="mt-10" <v-checkbox v-model="userCopy.advanced" class="mt-n4" :label="$t('profile.show-advanced-description')"
:title="$t('profile.preferences')" color="primary" @change="updateUser" />
/> <nuxt-link class="mt-5 d-flex flex-column justify-center text-center" :to="`/group`"> {{
<v-checkbox
v-model="userCopy.advanced"
class="mt-n4"
:label="$t('profile.show-advanced-description')"
color="primary"
@change="updateUser"
/>
<nuxt-link
class="mt-5 d-flex flex-column justify-center text-center"
:to="`/group`"
> {{
$t('profile.looking-for-privacy-settings') }} </nuxt-link> $t('profile.looking-for-privacy-settings') }} </nuxt-link>
<div class="d-flex flex-wrap justify-center mt-5"> <div class="d-flex flex-wrap justify-center mt-5">
<v-btn <v-btn variant="outlined" class="rounded-xl my-1 mx-1" :to="`/user/profile`" nuxt exact>
variant="outlined"
class="rounded-xl my-1 mx-1"
:to="`/user/profile`"
nuxt
exact
>
<v-icon start> <v-icon start>
{{ $globals.icons.backArrow }} {{ $globals.icons.backArrow }}
</v-icon> </v-icon>