1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 07:39:41 +02:00

refactor: Sidebar UI (#3390)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions

* Refactor sidebar links in DefaultLayout.vue

* 🧹
This commit is contained in:
Kuchenpirat 2024-04-01 10:16:52 +02:00 committed by GitHub
parent 7c365b7c03
commit a283828461
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 44 deletions

View file

@ -6,8 +6,6 @@
v-model="sidebar" v-model="sidebar"
absolute absolute
:top-link="topLinks" :top-link="topLinks"
:secondary-header="cookbookLinks.length ? $tc('sidebar.cookbooks') : undefined"
:secondary-header-link="isOwnGroup && cookbookLinks.length ? `/g/${groupSlug}/cookbooks` : undefined"
:secondary-links="cookbookLinks || []" :secondary-links="cookbookLinks || []"
:bottom-links="isAdmin ? bottomLinks : []" :bottom-links="isAdmin ? bottomLinks : []"
> >
@ -146,14 +144,6 @@
to: `/g/${groupSlug.value}/r/create/new`, to: `/g/${groupSlug.value}/r/create/new`,
restricted: true, restricted: true,
}, },
{
insertDivider: true,
icon: $globals.icons.pages,
title: i18n.tc("sidebar.cookbook"),
subtitle: i18n.tc("sidebar.create-cookbook"),
to: `/g/${groupSlug.value}/cookbooks`,
restricted: true,
},
]); ]);
const bottomLinks = computed<SidebarLinks>(() => [ const bottomLinks = computed<SidebarLinks>(() => [
@ -191,22 +181,35 @@
restricted: true, restricted: true,
}, },
{ {
icon: $globals.icons.categories, icon: $globals.icons.book,
to: `/g/${groupSlug.value}/recipes/categories`, to: `/g/${groupSlug.value}/cookbooks`,
title: i18n.tc("sidebar.categories"), title: i18n.tc("cookbook.cookbooks"),
restricted: true, restricted: true,
}, },
{ {
icon: $globals.icons.tags, icon: $globals.icons.organizers,
to: `/g/${groupSlug.value}/recipes/tags`, title: "Organizers",
title: i18n.tc("sidebar.tags"),
restricted: true,
},
{
icon: $globals.icons.potSteam,
to: `/g/${groupSlug.value}/recipes/tools`,
title: i18n.tc("tool.tools"),
restricted: true, restricted: true,
children: [
{
icon: $globals.icons.categories,
to: `/g/${groupSlug.value}/recipes/categories`,
title: i18n.tc("sidebar.categories"),
restricted: true,
},
{
icon: $globals.icons.tags,
to: `/g/${groupSlug.value}/recipes/tags`,
title: i18n.tc("sidebar.tags"),
restricted: true,
},
{
icon: $globals.icons.potSteam,
to: `/g/${groupSlug.value}/recipes/tools`,
title: i18n.tc("tool.tools"),
restricted: true,
},
],
}, },
]); ]);

View file

@ -39,13 +39,12 @@
<v-list-item-title>{{ nav.title }}</v-list-item-title> <v-list-item-title>{{ nav.title }}</v-list-item-title>
</template> </template>
<v-list-item v-for="child in nav.children" :key="child.title" exact :to="child.to"> <v-list-item v-for="child in nav.children" :key="child.title" exact :to="child.to" class="ml-2">
<v-list-item-icon> <v-list-item-icon>
<v-icon>{{ child.icon }}</v-icon> <v-icon>{{ child.icon }}</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ child.title }}</v-list-item-title> <v-list-item-title>{{ child.title }}</v-list-item-title>
</v-list-item> </v-list-item>
<v-divider class="mb-4"></v-divider>
</v-list-group> </v-list-group>
<!-- Single Item --> <!-- Single Item -->
@ -68,18 +67,8 @@
</template> </template>
<!-- Secondary Links --> <!-- Secondary Links -->
<template v-if="secondaryLinks"> <template v-if="secondaryLinks.length > 0">
<router-link v-if="secondaryHeader && secondaryHeaderLink" :to="secondaryHeaderLink" style="text-decoration: none;"> <v-divider class="mt-2"></v-divider>
<v-subheader :to="secondaryHeaderLink" class="pb-0">
{{ secondaryHeader }}
</v-subheader>
</router-link>
<div v-else-if="secondaryHeader">
<v-subheader :to="secondaryHeaderLink" class="pb-0">
{{ secondaryHeader }}
</v-subheader>
</div>
<v-divider v-if="secondaryHeader"></v-divider>
<v-list nav dense exact> <v-list nav dense exact>
<template v-for="nav in secondaryLinks"> <template v-for="nav in secondaryLinks">
<div v-if="!nav.restricted || isOwnGroup" :key="nav.title"> <div v-if="!nav.restricted || isOwnGroup" :key="nav.title">
@ -179,14 +168,6 @@ export default defineComponent({
required: false, required: false,
default: null, default: null,
}, },
secondaryHeader: {
type: String,
default: null,
},
secondaryHeaderLink: {
type: String,
default: null,
},
}, },
setup(props, context) { setup(props, context) {
// V-Model Support // V-Model Support

View file

@ -146,6 +146,8 @@ import {
mdiFlipVertical, mdiFlipVertical,
mdiRotateLeft, mdiRotateLeft,
mdiRotateRight, mdiRotateRight,
mdiBookOpenPageVariant,
mdiFileCabinet,
} from "@mdi/js"; } from "@mdi/js";
export const icons = { export const icons = {
@ -293,6 +295,8 @@ export const icons = {
tagArrowUp: mdiTagArrowUpOutline, tagArrowUp: mdiTagArrowUpOutline,
categories: mdiShapeOutline, categories: mdiShapeOutline,
pages: mdiBookOutline, pages: mdiBookOutline,
book: mdiBookOpenPageVariant,
organizers: mdiFileCabinet,
// Admin // Admin
user: mdiAccount, user: mdiAccount,