diff --git a/app/social/generators/ChallengeStatus.mjs b/app/social/generators/ChallengeStatus.mjs new file mode 100644 index 0000000..bf4e80f --- /dev/null +++ b/app/social/generators/ChallengeStatus.mjs @@ -0,0 +1,42 @@ +import StatusGenerator from "./StatusGenerator.mjs"; +import Media from "../Media.mjs"; +import { useEventSchedulesStore } from "../../../src/stores/schedules.mjs"; +export default class ChallengeStatus extends StatusGenerator +{ + key = 'challenge'; + name = 'Challenge'; + + async getActiveSchedule() { + await this.preparePinia(); + + let schedule = useEventSchedulesStore().activeSchedule; + + if (schedule.activeTimePeriod) { + return schedule; + } + } + + async getDataTime() { + let schedule = await this.getActiveSchedule(); + + return Date.parse(schedule?.activeTimePeriod?.start_time); + } + + async _getStatus() { + let schedule = await this.getActiveSchedule(); + + return [ + `A challenge event is now open! ${schedule.settings.leagueMatchEvent.name} – ${schedule.settings.leagueMatchEvent.desc}`, + '', + `Play ${schedule.settings.vsRule.name} on ${schedule.settings.vsStages[0].name} and ${schedule.settings.vsStages[0].name}! #splatoon3` + ].join('\n'); + } + + /** @param {ScreenshotHelper} screenshotHelper */ + async _getMedia(screenshotHelper) { + let media = new Media; + media.file = await screenshotHelper.capture('challenges'); + + return media; + } +} diff --git a/app/social/index.mjs b/app/social/index.mjs index d6e4c0e..5e45942 100644 --- a/app/social/index.mjs +++ b/app/social/index.mjs @@ -14,12 +14,14 @@ import SalmonRunUpcomingStatus from "./generators/SalmonRunUpcomingStatus.mjs"; import EggstraWorkStatus from "./generators/EggstraWorkStatus.mjs"; import EggstraWorkUpcomingStatus from "./generators/EggstraWorkUpcomingStatus.mjs"; import BlueskyClient from "./clients/BlueskyClient.mjs"; +import ChallengeStatus from "./generators/ChallengeStatus.mjs"; function defaultStatusGenerators() { return [ new SchedulesStatus, new DailyDropGearStatus, new RegularGearStatus, + new ChallengeStatus, new SalmonRunStatus, new SalmonRunUpcomingStatus, new SalmonRunGearStatus, diff --git a/src/components/challenge/ChallengeScheduleBox.vue b/src/components/challenge/ChallengeScheduleBox.vue index 510deb7..b35a401 100644 --- a/src/components/challenge/ChallengeScheduleBox.vue +++ b/src/components/challenge/ChallengeScheduleBox.vue @@ -46,7 +46,7 @@ /> -
+
{{ $t('times.future') }}
diff --git a/src/router/screenshots.js b/src/router/screenshots.js index 445f9e4..7629ea2 100644 --- a/src/router/screenshots.js +++ b/src/router/screenshots.js @@ -2,6 +2,7 @@ import { createRouter, createWebHashHistory } from 'vue-router' import ScreenshotsHomeView from '@/views/screenshots/ScreenshotsHomeView.vue' import CountdownView from '@/views/screenshots/CountdownView.vue' import SchedulesView from '@/views/screenshots/SchedulesView.vue' +import ChallengesView from '@/views/screenshots/ChallengesView.vue' import SalmonRunView from '@/views/screenshots/SalmonRunView.vue' import SalmonRunGearView from '@/views/screenshots/SalmonRunGearView.vue' import RegularGearView from '@/views/screenshots/RegularGearView.vue' @@ -23,6 +24,10 @@ const router = createRouter({ path: '/schedules', component: SchedulesView, }, + { + path: '/challenges', + component: ChallengesView, + }, { path: '/salmonrun', component: SalmonRunView, diff --git a/src/views/screenshots/ChallengesView.vue b/src/views/screenshots/ChallengesView.vue new file mode 100644 index 0000000..7ef6888 --- /dev/null +++ b/src/views/screenshots/ChallengesView.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/views/screenshots/ScreenshotsHomeView.vue b/src/views/screenshots/ScreenshotsHomeView.vue index a99aefd..8262212 100644 --- a/src/views/screenshots/ScreenshotsHomeView.vue +++ b/src/views/screenshots/ScreenshotsHomeView.vue @@ -9,6 +9,9 @@
Schedules
+
+ Challenges +
Salmon Run