diff --git a/frontend/assets/main.css b/frontend/assets/main.css index b5ff067e..91c64313 100644 --- a/frontend/assets/main.css +++ b/frontend/assets/main.css @@ -6,3 +6,7 @@ .layout-leave-active { opacity: 0; } + +.narrow-container { + max-width: 700px !important; +} diff --git a/frontend/components/Domain/Recipe/RecipeCardSection.vue b/frontend/components/Domain/Recipe/RecipeCardSection.vue index 1288b9ff..4ec0f09c 100644 --- a/frontend/components/Domain/Recipe/RecipeCardSection.vue +++ b/frontend/components/Domain/Recipe/RecipeCardSection.vue @@ -102,9 +102,9 @@ - diff --git a/frontend/components/Domain/User/UserProfileCard.vue b/frontend/components/Domain/User/UserProfileCard.vue deleted file mode 100644 index 02f148a6..00000000 --- a/frontend/components/Domain/User/UserProfileCard.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - - - diff --git a/frontend/components/Domain/User/UserProfileLinkCard.vue b/frontend/components/Domain/User/UserProfileLinkCard.vue new file mode 100644 index 00000000..dd8adf89 --- /dev/null +++ b/frontend/components/Domain/User/UserProfileLinkCard.vue @@ -0,0 +1,56 @@ + + + + diff --git a/frontend/components/global/BaseButton.vue b/frontend/components/global/BaseButton.vue index 06ed35af..1496e7b7 100644 --- a/frontend/components/global/BaseButton.vue +++ b/frontend/components/global/BaseButton.vue @@ -131,7 +131,7 @@ export default { }, cancel: { text: "Cancel", - icon: this.$globals.icons.cancel, + icon: this.$globals.icons.close, color: "grey", }, download: { diff --git a/frontend/components/global/BaseCardSectionTitle.vue b/frontend/components/global/BaseCardSectionTitle.vue index a027c9ae..5ea6236f 100644 --- a/frontend/components/global/BaseCardSectionTitle.vue +++ b/frontend/components/global/BaseCardSectionTitle.vue @@ -1,10 +1,11 @@ diff --git a/frontend/components/global/BasePageTitle.vue b/frontend/components/global/BasePageTitle.vue new file mode 100644 index 00000000..c0919d38 --- /dev/null +++ b/frontend/components/global/BasePageTitle.vue @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/frontend/components/global/ToggleState.vue b/frontend/components/global/ToggleState.vue new file mode 100644 index 00000000..d2fb0bf9 --- /dev/null +++ b/frontend/components/global/ToggleState.vue @@ -0,0 +1,29 @@ + + + + \ No newline at end of file diff --git a/frontend/composables/use-recipes.ts b/frontend/composables/use-recipes.ts index 8229e2f1..f0b7a401 100644 --- a/frontend/composables/use-recipes.ts +++ b/frontend/composables/use-recipes.ts @@ -7,6 +7,56 @@ import { Recipe } from "~/types/api-types/recipe"; export const allRecipes = ref([]); export const recentRecipes = ref([]); +const rand = (n: number) => Math.floor(Math.random() * n); + +function swap(t: Array, i: number, j: number) { + const q = t[i]; + t[i] = t[j]; + t[j] = q; + return t; +} + +export const useSorter = () => { + function sortAToZ(list: Array) { + list.sort((a, b) => { + const textA = a.name.toUpperCase(); + const textB = b.name.toUpperCase(); + return textA < textB ? -1 : textA > textB ? 1 : 0; + }); + } + function sortByCreated(list: Array) { + list.sort((a, b) => (a.dateAdded > b.dateAdded ? -1 : 1)); + } + function sortByUpdated(list: Array) { + list.sort((a, b) => (a.dateUpdated > b.dateUpdated ? -1 : 1)); + } + function sortByRating(list: Array) { + list.sort((a, b) => (a.rating > b.rating ? -1 : 1)); + } + + function randomRecipe(list: Array): Recipe { + return list[Math.floor(Math.random() * list.length)]; + } + + function shuffle(list: Array) { + let last = list.length; + let n; + while (last > 0) { + n = rand(last); + swap(list, n, --last); + } + } + + return { + sortAToZ, + sortByCreated, + sortByUpdated, + sortByRating, + randomRecipe, + shuffle, + }; +}; + export const useRecipes = (all = false, fetchRecipes = true) => { const api = useApiSingleton(); diff --git a/frontend/layouts/admin.vue b/frontend/layouts/admin.vue index 66c36570..fad72f95 100644 --- a/frontend/layouts/admin.vue +++ b/frontend/layouts/admin.vue @@ -46,28 +46,6 @@ export default defineComponent({ return { sidebar: null, topLinks: [ - { - icon: this.$globals.icons.user, - to: "/user/profile", - title: this.$t("sidebar.profile"), - }, - { - icon: this.$globals.icons.group, - to: "/user/group", - title: this.$t("group.group"), - }, - { - icon: this.$globals.icons.pages, - to: "/user/group/cookbooks", - title: this.$t("sidebar.cookbooks"), - }, - { - icon: this.$globals.icons.webhook, - to: "/user/group/webhooks", - title: "Webhooks", - }, - ], - adminLinks: [ { icon: this.$globals.icons.viewDashboard, to: "/admin/dashboard", @@ -157,9 +135,6 @@ export default defineComponent({ ], }; }, - head: { - title: "Admin", - }, }); diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vue index 643dfcc4..906eb5c3 100644 --- a/frontend/layouts/default.vue +++ b/frontend/layouts/default.vue @@ -8,7 +8,7 @@ :top-link="topLinks" secondary-header="Cookbooks" :secondary-links="cookbookLinks || []" - :bottom-links="bottomLink" + :bottom-links="$auth.user.admin ? bottomLink : []" @input="sidebar = !sidebar" /> @@ -62,7 +62,7 @@ export default defineComponent({ { icon: this.$globals.icons.cog, title: this.$t("general.settings"), - to: "/user/profile", + to: "/admin/dashboard", restricted: true, }, ], diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index 16baa9fd..0a0ee485 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -30,7 +30,7 @@ export default { css: [{ src: "~/assets/main.css" }, { src: "~/assets/style-overrides.scss" }], // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins - plugins: ["~/plugins/globals.js"], + plugins: ["~/plugins/globals.ts"], // Auto import components: https://go.nuxtjs.dev/config-components components: true, diff --git a/frontend/pages/recipes/categories/_slug.vue b/frontend/pages/recipes/categories/_slug.vue index b1ac7be0..cefa0206 100644 --- a/frontend/pages/recipes/categories/_slug.vue +++ b/frontend/pages/recipes/categories/_slug.vue @@ -1,6 +1,7 @@ diff --git a/frontend/pages/recipes/tags/index.vue b/frontend/pages/recipes/tags/index.vue index f4be4669..e4c8c624 100644 --- a/frontend/pages/recipes/tags/index.vue +++ b/frontend/pages/recipes/tags/index.vue @@ -7,9 +7,10 @@ {{ $t("tag.tags") }} - +
+ - + @@ -21,12 +22,12 @@ - +
diff --git a/frontend/pages/search.vue b/frontend/pages/search.vue index af3ce41e..15cfa49e 100644 --- a/frontend/pages/search.vue +++ b/frontend/pages/search.vue @@ -16,31 +16,47 @@ - - -

- {{ $t("category.category-filter") }} -

- - -
- -

- {{ $t("search.tag-filter") }} -

- - -
-
+ + + + - - + + + + + Arrange and edit your cookbooks here. + + @@ -48,7 +55,6 @@ import draggable from "vuedraggable"; export default defineComponent({ components: { draggable }, - layout: "admin", setup() { const { cookbooks, actions } = useCookbooks(); @@ -62,6 +68,6 @@ export default defineComponent({ \ No newline at end of file diff --git a/frontend/pages/user/group/index.vue b/frontend/pages/user/group/index.vue index 6f5c088c..153cb5ba 100644 --- a/frontend/pages/user/group/index.vue +++ b/frontend/pages/user/group/index.vue @@ -1,17 +1,23 @@ @@ -20,7 +26,6 @@ import { defineComponent } from "@nuxtjs/composition-api"; import { useGroup } from "~/composables/use-groups"; export default defineComponent({ - layout: "admin", setup() { const { categories, actions } = useGroup(); @@ -32,5 +37,3 @@ export default defineComponent({ }); - \ No newline at end of file diff --git a/frontend/pages/user/group/webhooks.vue b/frontend/pages/user/group/webhooks.vue index f3541650..32a6ac2d 100644 --- a/frontend/pages/user/group/webhooks.vue +++ b/frontend/pages/user/group/webhooks.vue @@ -1,11 +1,14 @@