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 @@ /> -