| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <v-app dark> | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  |     <TheSnackbar /> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |     <AppSidebar | 
					
						
							|  |  |  |       v-model="sidebar" | 
					
						
							|  |  |  |       absolute | 
					
						
							|  |  |  |       :top-link="topLinks" | 
					
						
							|  |  |  |       secondary-header="Cookbooks" | 
					
						
							| 
									
										
										
										
											2022-03-23 04:54:16 +01:00
										 |  |  |       secondary-header-link="/group/cookbooks" | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |       :secondary-links="cookbookLinks || []" | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |       :bottom-links="isAdmin ? bottomLink : []" | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |     > | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |       <v-menu offset-y nudge-bottom="5" close-delay="50" nudge-right="15"> | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |         <template #activator="{ on, attrs }"> | 
					
						
							|  |  |  |           <v-btn rounded large class="ml-2 mt-3" v-bind="attrs" v-on="on"> | 
					
						
							|  |  |  |             <v-icon left large color="primary"> | 
					
						
							|  |  |  |               {{ $globals.icons.createAlt }} | 
					
						
							|  |  |  |             </v-icon> | 
					
						
							|  |  |  |             {{ $t("general.create") }} | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </template> | 
					
						
							| 
									
										
										
										
											2021-10-02 16:11:50 -08:00
										 |  |  |         <v-list dense class="my-0 py-0"> | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |           <template v-for="(item, index) in createLinks"> | 
					
						
							|  |  |  |             <v-divider v-if="item.divider" :key="index" class="mx-2"></v-divider> | 
					
						
							|  |  |  |             <v-list-item v-else :key="item.title" :to="item.to" exact> | 
					
						
							|  |  |  |               <v-list-item-avatar> | 
					
						
							|  |  |  |                 <v-icon v-text="item.icon"></v-icon> | 
					
						
							|  |  |  |               </v-list-item-avatar> | 
					
						
							|  |  |  |               <v-list-item-content> | 
					
						
							|  |  |  |                 <v-list-item-title v-text="item.title"></v-list-item-title> | 
					
						
							|  |  |  |                 <v-list-item-subtitle v-text="item.subtitle"></v-list-item-subtitle> | 
					
						
							|  |  |  |               </v-list-item-content> | 
					
						
							|  |  |  |             </v-list-item> | 
					
						
							|  |  |  |           </template> | 
					
						
							|  |  |  |         </v-list> | 
					
						
							|  |  |  |       </v-menu> | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  |       <template #bottom> | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |         <v-list-item @click.stop="languageDialog = true"> | 
					
						
							|  |  |  |           <v-list-item-icon> | 
					
						
							|  |  |  |             <v-icon>{{ $globals.icons.translate }}</v-icon> | 
					
						
							|  |  |  |           </v-list-item-icon> | 
					
						
							|  |  |  |           <v-list-item-content> | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |             <v-list-item-title>{{ $t("sidebar.language") }}</v-list-item-title> | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |             <LanguageDialog v-model="languageDialog" /> | 
					
						
							|  |  |  |           </v-list-item-content> | 
					
						
							|  |  |  |         </v-list-item> | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  |         <v-list-item @click="toggleDark"> | 
					
						
							|  |  |  |           <v-list-item-icon> | 
					
						
							|  |  |  |             <v-icon> | 
					
						
							|  |  |  |               {{ $vuetify.theme.dark ? $globals.icons.weatherSunny : $globals.icons.weatherNight }} | 
					
						
							|  |  |  |             </v-icon> | 
					
						
							|  |  |  |           </v-list-item-icon> | 
					
						
							|  |  |  |           <v-list-item-title> {{ $vuetify.theme.dark ? "Light Mode" : "Dark Mode" }} </v-list-item-title> | 
					
						
							|  |  |  |         </v-list-item> | 
					
						
							|  |  |  |       </template> | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |     </AppSidebar> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <AppHeader> | 
					
						
							|  |  |  |       <v-btn icon @click.stop="sidebar = !sidebar"> | 
					
						
							|  |  |  |         <v-icon> {{ $globals.icons.menu }}</v-icon> | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |       </v-btn> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |     </AppHeader> | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |     <v-main> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       <v-scroll-x-transition> | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |         <Nuxt /> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       </v-scroll-x-transition> | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |     </v-main> | 
					
						
							|  |  |  |   </v-app> | 
					
						
							|  |  |  | </template> | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  | import { computed, defineComponent, onMounted, ref, useContext } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | import AppHeader from "@/components/Layout/AppHeader.vue"; | 
					
						
							|  |  |  | import AppSidebar from "@/components/Layout/AppSidebar.vue"; | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  | import LanguageDialog from "~/components/global/LanguageDialog.vue"; | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  | import TheSnackbar from "@/components/Layout/TheSnackbar.vue"; | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  | import { useCookbooks } from "~/composables/use-group-cookbooks"; | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  | import { useToggleDarkMode } from "~/composables/use-utils"; | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |   components: { AppHeader, AppSidebar, LanguageDialog, TheSnackbar }, | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |   middleware: "auth", | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |     const { cookbooks } = useCookbooks(); | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  |     const { $globals, $auth, $vuetify } = useContext(); | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const isAdmin = computed(() => $auth.user?.admin); | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |     const toggleDark = useToggleDarkMode(); | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |     const languageDialog = ref<boolean>(false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |     const sidebar = ref<boolean | null>(null); | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     onMounted(() => { | 
					
						
							|  |  |  |       sidebar.value = !$vuetify.breakpoint.md; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |     const cookbookLinks = computed(() => { | 
					
						
							|  |  |  |       if (!cookbooks.value) return []; | 
					
						
							|  |  |  |       return cookbooks.value.map((cookbook) => { | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |           icon: $globals.icons.pages, | 
					
						
							|  |  |  |           title: cookbook.name, | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |           to: `/cookbooks/${cookbook.slug as string}`, | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |         }; | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-03-19 22:27:40 +01:00
										 |  |  |     return { cookbookLinks, isAdmin, languageDialog, toggleDark, sidebar }; | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   data() { | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |     return { | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |       createLinks: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.link, | 
					
						
							|  |  |  |           title: "Import", | 
					
						
							|  |  |  |           subtitle: "Import a recipe by URL", | 
					
						
							|  |  |  |           to: "/recipe/create?tab=url", | 
					
						
							|  |  |  |           restricted: true, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-10-02 16:11:50 -08:00
										 |  |  |         { divider: true }, | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.edit, | 
					
						
							|  |  |  |           title: "Create", | 
					
						
							|  |  |  |           subtitle: "Create a recipe manually", | 
					
						
							|  |  |  |           to: "/recipe/create?tab=new", | 
					
						
							|  |  |  |           restricted: true, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-10-02 16:11:50 -08:00
										 |  |  |         { divider: true }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.pages, | 
					
						
							|  |  |  |           title: "Cookbook", | 
					
						
							|  |  |  |           subtitle: "Create a new cookbook", | 
					
						
							| 
									
										
										
										
											2022-03-23 04:54:16 +01:00
										 |  |  |           to: "/group/cookbooks", | 
					
						
							| 
									
										
										
										
											2021-10-02 16:11:50 -08:00
										 |  |  |           restricted: true, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-10-02 11:37:04 -08:00
										 |  |  |       ], | 
					
						
							| 
									
										
										
										
											2021-09-02 11:24:17 -08:00
										 |  |  |       bottomLink: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.cog, | 
					
						
							|  |  |  |           title: this.$t("general.settings"), | 
					
						
							| 
									
										
										
										
											2022-02-20 14:17:51 -09:00
										 |  |  |           to: "/admin/site-settings", | 
					
						
							| 
									
										
										
										
											2021-09-02 11:24:17 -08:00
										 |  |  |           restricted: true, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ], | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       topLinks: [ | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2021-11-08 21:12:13 -09:00
										 |  |  |           icon: this.$globals.icons.calendarMultiselect, | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           title: this.$t("meal-plan.meal-planner"), | 
					
						
							| 
									
										
										
										
											2022-02-07 19:03:11 -09:00
										 |  |  |           to: "/group/mealplan/planner", | 
					
						
							| 
									
										
										
										
											2021-11-08 21:12:13 -09:00
										 |  |  |           restricted: true, | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           icon: this.$globals.icons.formatListCheck, | 
					
						
							|  |  |  |           title: this.$t("shopping-list.shopping-lists"), | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |           to: "/shopping-lists", | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           restricted: true, | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.viewModule, | 
					
						
							|  |  |  |           to: "/recipes/all", | 
					
						
							|  |  |  |           title: this.$t("sidebar.all-recipes"), | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.search, | 
					
						
							|  |  |  |           to: "/search", | 
					
						
							|  |  |  |           title: this.$t("sidebar.search"), | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.tags, | 
					
						
							| 
									
										
										
										
											2021-08-08 20:52:44 -08:00
										 |  |  |           to: "/recipes/categories", | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |           title: this.$t("sidebar.categories"), | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.tags, | 
					
						
							| 
									
										
										
										
											2021-08-08 20:52:44 -08:00
										 |  |  |           to: "/recipes/tags", | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |           title: this.$t("sidebar.tags"), | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-12-10 19:48:06 -09:00
										 |  |  |         { | 
					
						
							|  |  |  |           icon: this.$globals.icons.potSteam, | 
					
						
							|  |  |  |           to: "/recipes/tools", | 
					
						
							|  |  |  |           title: "Tools", | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |       ], | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | </script> |