diff --git a/app/components/admin/Answer.vue b/app/components/admin/Answer.vue new file mode 100644 index 0000000..68f5dcf --- /dev/null +++ b/app/components/admin/Answer.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 54a2017..c345013 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -9,10 +9,6 @@ const titleStore = useTitleStore(); const isSidebarVisible = ref(breakpoints.mdUp); -watchEffect(() => { - isSidebarVisible.value = breakpoints.smUp; -}); - const slugs = computed(() => checkSlug(route.params)); @@ -67,6 +63,21 @@ const slugs = computed(() => checkSlug(route.params)); }} + + + + Hunt Admin + + + + + Quest Admin + + checkSlug(route.params)); - + diff --git a/app/middleware/admin.ts b/app/middleware/admin.ts new file mode 100644 index 0000000..0fe62ad --- /dev/null +++ b/app/middleware/admin.ts @@ -0,0 +1,18 @@ +export default defineNuxtRouteMiddleware((to) => { + const { loggedIn, user } = useUserSession(); + + if (!loggedIn.value || !user.value || user.value?.role !== 'ADMIN') { + const split = to.path.endsWith('/') + ? to.path.substring(0, to.path.length - 1).split('/') + : to.path.split('/'); + + const localePath = useLocalePath(); + return navigateTo( + !user.value + ? localePath(`/login?to=${to.path}`) + : localePath( + split.length > 1 ? split.slice(0, split.length - 1).join('/') : '/' + ) + ); + } +}); diff --git a/app/pages/hunt/[huntSlug]/[questSlug]/admin.vue b/app/pages/hunt/[huntSlug]/[questSlug]/admin.vue new file mode 100644 index 0000000..753b8f0 --- /dev/null +++ b/app/pages/hunt/[huntSlug]/[questSlug]/admin.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/app/pages/hunt/[huntSlug]/[questSlug]/index.vue b/app/pages/hunt/[huntSlug]/[questSlug]/index.vue index d8b0df7..6882ea8 100644 --- a/app/pages/hunt/[huntSlug]/[questSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/[questSlug]/index.vue @@ -7,6 +7,8 @@ definePageMeta({ }); const app = useNuxtApp(); + +const { user } = useUserSession(); const { huntSlug, questSlug } = app.$slugData; const { t, locale } = useI18n(); @@ -86,6 +88,16 @@ const createImageURL = (file: File) => URL.createObjectURL(file); :loading="pending" color="success" >{{ $t('layouts.refresh') }} + Admin
@@ -131,7 +143,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);

{{ data.answer.review }}

- + Submission
diff --git a/app/pages/hunt/[huntSlug]/admin.vue b/app/pages/hunt/[huntSlug]/admin.vue new file mode 100644 index 0000000..ac8f306 --- /dev/null +++ b/app/pages/hunt/[huntSlug]/admin.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/app/pages/hunt/[huntSlug]/index.vue b/app/pages/hunt/[huntSlug]/index.vue index 0b1787b..bca3c3d 100644 --- a/app/pages/hunt/[huntSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/index.vue @@ -43,7 +43,12 @@ async function invite() {