diff --git a/TODO.md b/TODO.md index 680c489..4c48284 100644 --- a/TODO.md +++ b/TODO.md @@ -28,22 +28,22 @@ - [ ] Create hunt - [ ] Add Questions - [ ] View Answers on Map - - [ ] Image Diashow + - [x] Image Diashow - **Hunt User** + - [x] View all images on one page + - [ ] i18n data + - [ ] Mark image as private - [ ] How-to/Guide/Good explanation + - [ ] Leave/Remove/Edit team + - [ ] Support chat + - [ ] Copy team from different hunt - [ ] Get Geo-Location - - [ ] Track walking distance - [ ] View other answers - [ ] View other reviews and scores - - [ ] Review other answers (Fan-Favorite) - - [ ] View all images on one page - - [ ] Notifications - - [ ] i18n data - [ ] Process image uploads (resize, remove EXIF, etc.) - - [ ] Mark image as private - - [ ] Support chat - - [ ] Leave/Remove team - - [ ] Copy team from different hunt + - [ ] Review other answers (Fan-Favorite) + - [ ] Track walking distance + - [ ] Notifications - **General** - [x] Pretty slugified urls - [ ] All static texts translated diff --git a/app/lang/de.json b/app/lang/de.json index 1a48fcc..29ad975 100644 --- a/app/lang/de.json +++ b/app/lang/de.json @@ -34,7 +34,8 @@ "default_tile": "PicHunt", "refresh": "Aktualisieren", "switch_lang": "Sprache ändern zu {locale}", - "title": "{title} {'|'} PicHunt" + "title": "{title} {'|'} PicHunt", + "two_title": "{subtitle} {'|'} {title} {'|'} PicHunt" }, "locales": { "de": "Deutsch", diff --git a/app/lang/en.json b/app/lang/en.json index 4a1acac..a402d5c 100644 --- a/app/lang/en.json +++ b/app/lang/en.json @@ -34,7 +34,8 @@ "default_tile": "PicHunt", "refresh": "Refresh", "switch_lang": "Switch locale to {locale}", - "title": "{title} {'|'} PicHunt" + "title": "{title} {'|'} PicHunt", + "two_title": "{subtitle} {'|'} {title} {'|'} PicHunt" }, "locales": { "de": "German", diff --git a/app/pages/hunt/[huntSlug]/diashow.vue b/app/pages/hunt/[huntSlug]/diashow.vue new file mode 100644 index 0000000..00e038a --- /dev/null +++ b/app/pages/hunt/[huntSlug]/diashow.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/app/pages/hunt/[huntSlug]/index.vue b/app/pages/hunt/[huntSlug]/index.vue index 73b4569..df2ead1 100644 --- a/app/pages/hunt/[huntSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/index.vue @@ -44,38 +44,57 @@ async function invite() { -

{{ quest.description }}

+

{{ quest.description }}

-

- {{ quest.answer?.text }} -

+

{{ quest.answer?.text }}

- + Open + +import { useTitleStore } from '~/stores/title'; + +definePageMeta({ + layout: 'full' +}); +const app = useNuxtApp(); +const { loggedIn } = useUserSession(); +const { t } = useI18n(); + +const { name, id } = app.$slugData.huntSlug!; + +const titleStore = useTitleStore(); + +type Picture = { + quest: { id: number; title: string }; + team: { + name: string; + id: number; + }; + picture: { + creator: { + name: string; + }; + url: string; + }; +}; +const { data, refresh, error } = await useFetch(`/api/hunt/${id}/diashow`, { + transform: (input) => { + if (!input || input.quests.length <= 0) + return { id: 0, name: '', cols: [] as Picture[][], count: 0 }; + const { quests, ...rest } = input; + const pictures: Picture[] = []; + + quests.forEach(({ answers, ...quest }) => { + answers.forEach(({ team, picture }) => { + if (!picture) return; + pictures.push({ + team, + picture, + quest + }); + }); + }); + + pictures.sort(() => Math.random() - 0.5); + + const cols = pictures.reduce( + (c, p, i) => { + c[i % 4].push(p); + return c; + }, + new Array(4).fill(0).map(() => [] as Picture[]) + ); + + return { ...rest, cols, count: pictures.length }; + } +}); + +useHead({ + title: t('layouts.two_title', { + title: data.value?.name || name, + subtitle: 'Diashow' + }) +}); + +watch(loggedIn, () => refresh()); + +titleStore.title = data.value?.name; + + + + + diff --git a/app/pages/hunt/[huntSlug]/showcase.vue b/app/pages/hunt/[huntSlug]/showcase.vue index e4c6025..3535e17 100644 --- a/app/pages/hunt/[huntSlug]/showcase.vue +++ b/app/pages/hunt/[huntSlug]/showcase.vue @@ -4,15 +4,13 @@ import NumberCard from '~/components/showcase/NumberCard.vue'; import { fullDate } from '~~/server/utils/date'; definePageMeta({ - // TODO: re-enable perms - // middleware: ['admin'], layout: 'full' }); const { t, d } = useI18n(); const app = useNuxtApp(); const { name, id } = app.$slugData.huntSlug!; -const { data } = await useFetch(`/api/admin/hunt/${id}/showcase`); +const { data, error } = await useFetch(`/api/hunt/${id}/showcase`); const { toggle, isFullscreen, isSupported } = useFullscreen(); @@ -243,7 +241,23 @@ const columns = leaderboardColumns.map((c) => -
pending...
+ +
+ Answers are not revealed yet, please wait until the end! + {{ + error + }}Back to Hunt +