2021-09-04 20:24:32 -08:00
|
|
|
<template>
|
2025-06-28 15:59:58 +02:00
|
|
|
<v-container v-if="user" class="mb-8">
|
2023-10-07 21:36:47 +02:00
|
|
|
<section class="d-flex flex-column align-center mt-4">
|
2025-06-20 00:09:12 +07:00
|
|
|
<UserAvatar
|
|
|
|
:tooltip="false"
|
|
|
|
size="96"
|
|
|
|
:user-id="user.id"
|
|
|
|
/>
|
2021-12-18 19:04:36 -09:00
|
|
|
|
2025-06-28 15:59:58 +02:00
|
|
|
<h2 class="text-h4 text-center">
|
2025-06-20 00:09:12 +07:00
|
|
|
{{ $t('profile.welcome-user', [user.fullName]) }}
|
|
|
|
</h2>
|
2023-10-07 21:36:47 +02:00
|
|
|
<p class="subtitle-1 mb-0 text-center">
|
2025-06-20 00:09:12 +07:00
|
|
|
{{ $t('profile.description') }}
|
2021-09-04 20:24:32 -08:00
|
|
|
</p>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-card
|
|
|
|
flat
|
|
|
|
color="transparent"
|
|
|
|
width="100%"
|
|
|
|
max-width="600px"
|
|
|
|
>
|
2023-10-07 21:36:47 +02:00
|
|
|
<v-card-actions class="d-flex justify-center my-4">
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-btn
|
|
|
|
v-if="user.canInvite"
|
|
|
|
variant="outlined"
|
|
|
|
rounded
|
|
|
|
:prepend-icon="$globals.icons.createAlt"
|
|
|
|
:text="$t('profile.get-invite-link')"
|
|
|
|
@click="inviteDialog = true"
|
|
|
|
/>
|
2021-09-09 08:51:29 -08:00
|
|
|
</v-card-actions>
|
2024-11-12 04:30:08 +01:00
|
|
|
<UserInviteDialog v-model="inviteDialog" />
|
2021-09-09 08:51:29 -08:00
|
|
|
</v-card>
|
2021-09-04 20:24:32 -08:00
|
|
|
</section>
|
2022-03-27 15:12:18 -08:00
|
|
|
<section class="my-3">
|
|
|
|
<div>
|
2025-06-20 00:09:12 +07:00
|
|
|
<h3 class="text-h5">
|
|
|
|
{{ $t('profile.account-summary') }}
|
|
|
|
</h3>
|
2023-01-29 02:39:51 +01:00
|
|
|
<p>{{ $t('profile.account-summary-description') }}</p>
|
2022-03-27 15:12:18 -08:00
|
|
|
</div>
|
|
|
|
<v-row tag="section">
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="12"
|
|
|
|
>
|
|
|
|
<v-card variant="outlined" style="border-color: lightgray;" class="mt-4">
|
|
|
|
<v-card-title class="text-h6 pb-0">
|
|
|
|
{{ $t('profile.household-statistics') }}
|
|
|
|
</v-card-title>
|
2022-03-27 15:12:18 -08:00
|
|
|
<v-card-text class="py-0">
|
2024-08-22 10:14:32 -05:00
|
|
|
{{ $t('profile.household-statistics-description') }}
|
2022-03-27 15:12:18 -08:00
|
|
|
</v-card-text>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-card-text
|
|
|
|
class="d-flex flex-wrap justify-center align-center"
|
|
|
|
style="gap: 0.8rem"
|
|
|
|
>
|
2022-03-27 15:12:18 -08:00
|
|
|
<StatsCards
|
|
|
|
v-for="(value, key) in stats"
|
|
|
|
:key="`${key}-${value}`"
|
2025-06-20 00:09:12 +07:00
|
|
|
:min-width="$vuetify.display.xs ? '100%' : '158'"
|
2022-03-27 15:12:18 -08:00
|
|
|
:icon="getStatsIcon(key)"
|
|
|
|
:to="getStatsTo(key)"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ getStatsTitle(key) }}
|
|
|
|
</template>
|
|
|
|
<template #value>
|
|
|
|
{{ value }}
|
|
|
|
</template>
|
2022-03-27 15:12:18 -08:00
|
|
|
</StatsCards>
|
|
|
|
</v-card-text>
|
|
|
|
</v-card>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</section>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-divider class="my-7" />
|
2021-09-04 20:24:32 -08:00
|
|
|
<section>
|
|
|
|
<div>
|
2025-06-20 00:09:12 +07:00
|
|
|
<h3 class="text-h6">
|
|
|
|
{{ $t('profile.personal') }}
|
|
|
|
</h3>
|
2023-01-29 02:39:51 +01:00
|
|
|
<p>{{ $t('profile.personal-description') }}</p>
|
2021-09-04 20:24:32 -08:00
|
|
|
</div>
|
|
|
|
<v-row tag="section">
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2021-09-04 20:24:32 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-user-profile'), to: `/user/profile/edit` }"
|
2021-09-04 20:24:32 -08:00
|
|
|
:image="require('~/static/svgs/manage-profile.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.user-settings') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.user-settings-description') }}
|
2021-09-04 20:24:32 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2022-04-09 19:08:48 -08:00
|
|
|
<AdvancedOnly>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2022-04-09 19:08:48 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-your-api-tokens'), to: `/user/profile/api-tokens` }"
|
2022-04-09 19:08:48 -08:00
|
|
|
:image="require('~/static/svgs/manage-api-tokens.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('settings.token.api-tokens') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.api-tokens-description') }}
|
2022-04-09 19:08:48 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
|
|
|
</AdvancedOnly>
|
2021-09-04 20:24:32 -08:00
|
|
|
</v-row>
|
|
|
|
</section>
|
2024-08-22 10:14:32 -05:00
|
|
|
<v-divider class="my-7" />
|
2021-09-04 20:24:32 -08:00
|
|
|
<section>
|
|
|
|
<div>
|
2025-06-20 00:09:12 +07:00
|
|
|
<h3 class="text-h6">
|
|
|
|
{{ $t('household.household') }}
|
|
|
|
</h3>
|
2024-08-22 10:14:32 -05:00
|
|
|
<p>{{ $t('profile.household-description') }}</p>
|
2021-09-04 20:24:32 -08:00
|
|
|
</div>
|
|
|
|
<v-row tag="section">
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
v-if="user.canManageHousehold"
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2021-09-04 20:24:32 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.household-settings'), to: `/household` }"
|
2021-09-04 20:24:32 -08:00
|
|
|
:image="require('~/static/svgs/manage-group-settings.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.household-settings') }}
|
|
|
|
</template>
|
2024-08-22 10:14:32 -05:00
|
|
|
{{ $t('profile.household-settings-description') }}
|
2021-09-04 20:24:32 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2021-09-04 20:24:32 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-cookbooks'), to: `/g/${groupSlug}/cookbooks` }"
|
2021-09-04 20:24:32 -08:00
|
|
|
:image="require('~/static/svgs/manage-cookbooks.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('sidebar.cookbooks') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.cookbooks-description') }}
|
2021-09-04 20:24:32 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
v-if="user.canManage"
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2021-10-04 20:16:37 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-members'), to: `/household/members` }"
|
2021-10-04 20:16:37 -08:00
|
|
|
:image="require('~/static/svgs/manage-members.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.members') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.members-description') }}
|
2021-10-04 20:16:37 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2022-04-09 19:08:48 -08:00
|
|
|
<AdvancedOnly>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
v-if="user.advanced"
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2022-04-09 19:08:48 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-webhooks'), to: `/household/webhooks` }"
|
2022-04-09 19:08:48 -08:00
|
|
|
:image="require('~/static/svgs/manage-webhooks.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('settings.webhooks.webhooks') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.webhooks-description') }}
|
2022-04-09 19:08:48 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
|
|
|
</AdvancedOnly>
|
|
|
|
<AdvancedOnly>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2022-04-09 19:08:48 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-notifiers'), to: `/household/notifiers` }"
|
2022-04-09 19:08:48 -08:00
|
|
|
:image="require('~/static/svgs/manage-notifiers.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.notifiers') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.notifiers-description') }}
|
2022-04-09 19:08:48 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
|
|
|
</AdvancedOnly>
|
2024-08-22 10:14:32 -05:00
|
|
|
</v-row>
|
|
|
|
</section>
|
|
|
|
<v-divider class="my-7" />
|
2024-09-17 10:48:14 -05:00
|
|
|
<section v-if="user.canManage || user.canOrganize || user.advanced">
|
2024-08-22 10:14:32 -05:00
|
|
|
<div>
|
2025-06-20 00:09:12 +07:00
|
|
|
<h3 class="text-h6">
|
|
|
|
{{ $t('group.group') }}
|
|
|
|
</h3>
|
2024-08-22 10:14:32 -05:00
|
|
|
<p>{{ $t('profile.group-description') }}</p>
|
|
|
|
</div>
|
|
|
|
<v-row tag="section">
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
v-if="user.canManage"
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2024-08-22 10:14:32 -05:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.group-settings'), to: `/group` }"
|
2024-08-22 10:14:32 -05:00
|
|
|
:image="require('~/static/svgs/manage-group-settings.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.group-settings') }}
|
|
|
|
</template>
|
2024-08-22 10:14:32 -05:00
|
|
|
{{ $t('profile.group-settings-description') }}
|
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
v-if="user.canOrganize"
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2024-01-31 10:33:05 +00:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-data'), to: `/group/data/foods` }"
|
2024-01-31 10:33:05 +00:00
|
|
|
:image="require('~/static/svgs/manage-recipes.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.manage-data') }}
|
|
|
|
</template>
|
2024-01-31 10:33:05 +00:00
|
|
|
{{ $t('profile.manage-data-description') }}
|
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
2022-04-09 19:08:48 -08:00
|
|
|
<AdvancedOnly>
|
2025-06-20 00:09:12 +07:00
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="12"
|
|
|
|
md="6"
|
|
|
|
>
|
2022-04-09 19:08:48 -08:00
|
|
|
<UserProfileLinkCard
|
2025-06-20 00:09:12 +07:00
|
|
|
:link="{ text: $t('profile.manage-data-migrations'), to: `/group/migrations` }"
|
2022-04-09 19:08:48 -08:00
|
|
|
:image="require('~/static/svgs/manage-data-migrations.svg')"
|
|
|
|
>
|
2025-06-20 00:09:12 +07:00
|
|
|
<template #title>
|
|
|
|
{{ $t('profile.data-migrations') }}
|
|
|
|
</template>
|
2023-01-29 02:39:51 +01:00
|
|
|
{{ $t('profile.data-migrations-description') }}
|
2022-04-09 19:08:48 -08:00
|
|
|
</UserProfileLinkCard>
|
|
|
|
</v-col>
|
|
|
|
</AdvancedOnly>
|
2021-09-04 20:24:32 -08:00
|
|
|
</v-row>
|
|
|
|
</section>
|
|
|
|
</v-container>
|
|
|
|
</template>
|
2022-01-09 21:04:24 -09:00
|
|
|
|
2021-09-04 20:24:32 -08:00
|
|
|
<script lang="ts">
|
|
|
|
import UserProfileLinkCard from "@/components/Domain/User/UserProfileLinkCard.vue";
|
2021-11-06 11:28:47 -08:00
|
|
|
import { useUserApi } from "~/composables/api";
|
2021-12-18 19:04:36 -09:00
|
|
|
import UserAvatar from "@/components/Domain/User/UserAvatar.vue";
|
2022-03-27 15:12:18 -08:00
|
|
|
import { useAsyncKey } from "~/composables/use-utils";
|
|
|
|
import StatsCards from "~/components/global/StatsCards.vue";
|
2025-06-20 00:09:12 +07:00
|
|
|
import type { UserOut } from "~/lib/api/types/user";
|
2024-11-12 04:30:08 +01:00
|
|
|
import UserInviteDialog from "~/components/Domain/User/UserInviteDialog.vue";
|
2021-09-04 20:24:32 -08:00
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
export default defineNuxtComponent({
|
2021-12-18 19:04:36 -09:00
|
|
|
name: "UserProfile",
|
2021-09-04 20:24:32 -08:00
|
|
|
components: {
|
2024-11-12 04:30:08 +01:00
|
|
|
UserInviteDialog,
|
2021-09-04 20:24:32 -08:00
|
|
|
UserProfileLinkCard,
|
2021-12-18 19:04:36 -09:00
|
|
|
UserAvatar,
|
2022-03-27 15:12:18 -08:00
|
|
|
StatsCards,
|
2021-09-04 20:24:32 -08:00
|
|
|
},
|
2025-06-20 00:09:12 +07:00
|
|
|
middleware: "sidebase-auth",
|
2021-10-18 19:41:41 -08:00
|
|
|
scrollToTop: true,
|
2025-06-20 00:09:12 +07:00
|
|
|
async setup() {
|
|
|
|
const i18n = useI18n();
|
|
|
|
const $auth = useMealieAuth();
|
2023-11-05 19:07:02 -06:00
|
|
|
const route = useRoute();
|
2025-06-20 00:09:12 +07:00
|
|
|
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
|
2021-09-04 20:24:32 -08:00
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
useSeoMeta({
|
|
|
|
title: i18n.t("settings.profile"),
|
|
|
|
});
|
|
|
|
|
|
|
|
const user = computed<UserOut | null>(() => $auth.user.value);
|
2023-09-14 09:01:24 -05:00
|
|
|
|
2024-11-12 04:30:08 +01:00
|
|
|
const inviteDialog = ref(false);
|
2021-11-06 11:28:47 -08:00
|
|
|
const api = useUserApi();
|
2023-09-14 09:01:24 -05:00
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
const { data: stats } = useAsyncData(useAsyncKey(), async () => {
|
2024-08-22 10:14:32 -05:00
|
|
|
const { data } = await api.households.statistics();
|
2022-03-27 15:12:18 -08:00
|
|
|
|
|
|
|
if (data) {
|
|
|
|
return data;
|
|
|
|
}
|
2025-06-20 00:09:12 +07:00
|
|
|
});
|
2022-03-27 15:12:18 -08:00
|
|
|
|
|
|
|
const statsText: { [key: string]: string } = {
|
2025-06-20 00:09:12 +07:00
|
|
|
totalRecipes: i18n.t("general.recipes"),
|
|
|
|
totalUsers: i18n.t("user.users"),
|
|
|
|
totalCategories: i18n.t("sidebar.categories"),
|
|
|
|
totalTags: i18n.t("sidebar.tags"),
|
|
|
|
totalTools: i18n.t("tool.tools"),
|
2022-03-27 15:12:18 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
function getStatsTitle(key: string) {
|
|
|
|
return statsText[key] ?? "unknown";
|
|
|
|
}
|
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
const { $globals } = useNuxtApp();
|
2022-03-27 15:12:18 -08:00
|
|
|
|
|
|
|
const iconText: { [key: string]: string } = {
|
|
|
|
totalUsers: $globals.icons.user,
|
2023-10-25 17:08:58 +02:00
|
|
|
totalCategories: $globals.icons.categories,
|
2022-03-27 15:12:18 -08:00
|
|
|
totalTags: $globals.icons.tags,
|
|
|
|
totalTools: $globals.icons.potSteam,
|
|
|
|
};
|
|
|
|
|
|
|
|
function getStatsIcon(key: string) {
|
|
|
|
return iconText[key] ?? $globals.icons.primary;
|
|
|
|
}
|
|
|
|
|
2024-11-12 04:30:08 +01:00
|
|
|
const statsTo = computed<{ [key: string]: string }>(() => {
|
|
|
|
return {
|
|
|
|
totalRecipes: `/g/${groupSlug.value}/`,
|
|
|
|
totalUsers: "/household/members",
|
|
|
|
totalCategories: `/g/${groupSlug.value}/recipes/categories`,
|
|
|
|
totalTags: `/g/${groupSlug.value}/recipes/tags`,
|
|
|
|
totalTools: `/g/${groupSlug.value}/recipes/tools`,
|
2025-06-20 00:09:12 +07:00
|
|
|
};
|
2024-11-12 04:30:08 +01:00
|
|
|
});
|
2022-03-27 15:12:18 -08:00
|
|
|
|
|
|
|
function getStatsTo(key: string) {
|
2023-11-05 19:07:02 -06:00
|
|
|
return statsTo.value[key] ?? "unknown";
|
2022-03-27 15:12:18 -08:00
|
|
|
}
|
|
|
|
|
2021-10-04 20:16:37 -08:00
|
|
|
return {
|
2023-11-05 19:07:02 -06:00
|
|
|
groupSlug,
|
2022-03-27 15:12:18 -08:00
|
|
|
getStatsTitle,
|
|
|
|
getStatsIcon,
|
|
|
|
getStatsTo,
|
2024-11-12 04:30:08 +01:00
|
|
|
inviteDialog,
|
2022-03-27 15:12:18 -08:00
|
|
|
stats,
|
2021-10-04 20:16:37 -08:00
|
|
|
user,
|
|
|
|
};
|
2021-09-04 20:24:32 -08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|