mealie/frontend/layouts/default.vue

131 lines
3.5 KiB
Vue
Raw Normal View History

2021-07-31 22:00:28 +00:00
<template>
<v-app dark>
2021-08-02 03:24:47 +00:00
<!-- <TheSnackbar /> -->
<AppSidebar
v-model="sidebar"
absolute
:top-link="topLinks"
secondary-header="Cookbooks"
:secondary-links="cookbookLinks || []"
:bottom-links="$auth.user.admin ? bottomLink : []"
@input="sidebar = !sidebar"
/>
2021-08-02 03:24:47 +00:00
<AppHeader>
<v-btn icon @click.stop="sidebar = !sidebar">
<v-icon> {{ $globals.icons.menu }}</v-icon>
2021-07-31 22:00:28 +00:00
</v-btn>
2021-08-02 03:24:47 +00:00
</AppHeader>
2021-07-31 22:00:28 +00:00
<v-main>
2021-08-02 03:24:47 +00:00
<v-scroll-x-transition>
2021-07-31 22:00:28 +00:00
<Nuxt />
2021-08-02 03:24:47 +00:00
</v-scroll-x-transition>
2021-07-31 22:00:28 +00:00
</v-main>
2021-08-02 03:24:47 +00:00
<AppFloatingButton absolute />
2021-07-31 22:00:28 +00:00
</v-app>
</template>
2021-08-02 03:24:47 +00:00
<script lang="ts">
import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
2021-08-02 03:24:47 +00:00
import AppHeader from "@/components/Layout/AppHeader.vue";
import AppSidebar from "@/components/Layout/AppSidebar.vue";
import AppFloatingButton from "@/components/Layout/AppFloatingButton.vue";
import { useCookbooks } from "~/composables/use-group-cookbooks";
2021-07-31 22:00:28 +00:00
2021-08-02 03:24:47 +00:00
export default defineComponent({
components: { AppHeader, AppSidebar, AppFloatingButton },
// @ts-ignore
2021-08-10 00:19:23 +00:00
// middleware: process.env.GLOBAL_MIDDLEWARE,
2021-08-02 03:24:47 +00:00
setup() {
const { cookbooks } = useCookbooks();
// @ts-ignore
const { $globals } = useContext();
const cookbookLinks = computed(() => {
if (!cookbooks.value) return [];
return cookbooks.value.map((cookbook) => {
return {
icon: $globals.icons.pages,
title: cookbook.name,
to: `/cookbooks/${cookbook.slug}`,
};
});
});
return { cookbookLinks };
2021-08-02 03:24:47 +00:00
},
data() {
2021-07-31 22:00:28 +00:00
return {
2021-08-02 03:24:47 +00:00
sidebar: null,
bottomLink: [
{
icon: this.$globals.icons.cog,
title: this.$t("general.settings"),
to: "/admin/dashboard",
restricted: true,
},
],
2021-08-02 03:24:47 +00:00
topLinks: [
2021-07-31 22:00:28 +00:00
{
icon: this.$globals.icons.calendar,
restricted: true,
title: this.$t("meal-plan.meal-planner"),
children: [
{
icon: this.$globals.icons.calendarMultiselect,
title: this.$t("meal-plan.planner"),
to: "/meal-plan/planner",
restricted: true,
},
{
icon: this.$globals.icons.calendarWeek,
title: this.$t("meal-plan.dinner-this-week"),
to: "/meal-plan/this-week",
restricted: true,
},
{
icon: this.$globals.icons.calendarToday,
title: this.$t("meal-plan.dinner-today"),
to: "/meal-plan/today",
restricted: true,
},
],
2021-07-31 22:00:28 +00:00
},
{
icon: this.$globals.icons.formatListCheck,
title: this.$t("shopping-list.shopping-lists"),
to: "/shopping-list",
restricted: true,
2021-08-02 03:24:47 +00:00
},
{
icon: this.$globals.icons.viewModule,
to: "/recipes/all",
title: this.$t("sidebar.all-recipes"),
},
{
icon: this.$globals.icons.search,
to: "/search",
title: this.$t("sidebar.search"),
},
2021-08-02 03:24:47 +00:00
{
icon: this.$globals.icons.tags,
to: "/recipes/categories",
2021-08-02 03:24:47 +00:00
title: this.$t("sidebar.categories"),
},
{
icon: this.$globals.icons.tags,
to: "/recipes/tags",
2021-08-02 03:24:47 +00:00
title: this.$t("sidebar.tags"),
},
2021-07-31 22:00:28 +00:00
],
2021-08-02 03:24:47 +00:00
};
},
head: {
title: "Home",
},
2021-08-02 03:24:47 +00:00
});
2021-07-31 22:00:28 +00:00
</script>
2021-08-02 03:24:47 +00:00
<style scoped>
</style>+