mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-04-25 15:36:31 -05:00
Add Salmon Run tweet
This commit is contained in:
parent
596ccf85eb
commit
27effd2c6f
41
app/twitter/generators/SalmonRunTweet.mjs
Normal file
41
app/twitter/generators/SalmonRunTweet.mjs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import TweetGenerator from "./TweetGenerator.mjs";
|
||||
import Media from "../Media.mjs";
|
||||
import { useSalmonRunSchedulesStore } from "../../../src/stores/schedules.mjs";
|
||||
|
||||
export default class SalmonRunTweet extends TweetGenerator
|
||||
{
|
||||
key = 'salmonrun';
|
||||
name = 'Salmon Run';
|
||||
|
||||
async getActiveSchedule() {
|
||||
await this.preparePinia();
|
||||
|
||||
return useSalmonRunSchedulesStore().activeSchedule
|
||||
}
|
||||
|
||||
async getDataTime() {
|
||||
let schedule = await this.getActiveSchedule();
|
||||
|
||||
return Date.parse(schedule.startTime);
|
||||
}
|
||||
|
||||
async _getStatus() {
|
||||
let schedule = await this.getActiveSchedule();
|
||||
|
||||
let hasMysteryWeapon = schedule.settings.weapons.some(w => w.name === 'Random');
|
||||
|
||||
if (hasMysteryWeapon) {
|
||||
return `Salmon Run is now open on ${schedule.settings.coopStage.name} with MYSTERY WEAPONS! #salmonrun #splatoon3`;
|
||||
}
|
||||
|
||||
return `Salmon Run is now open on ${schedule.settings.coopStage.name}! #salmonrun #splatoon3`;
|
||||
}
|
||||
|
||||
/** @param {ScreenshotHelper} screenshotHelper */
|
||||
async _getMedia(screenshotHelper) {
|
||||
let media = new Media;
|
||||
media.file = await screenshotHelper.capture('salmonrun');
|
||||
|
||||
return media;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import DailyDropGearTweet from "./generators/DailyDropGearTweet.mjs";
|
||||
import RegularGearTweet from "./generators/RegularGearTweet.mjs";
|
||||
import SalmonRunTweet from "./generators/SalmonRunTweet.mjs";
|
||||
import SchedulesTweet from "./generators/SchedulesTweet.mjs";
|
||||
import SplatfestResultsTweet from "./generators/SplatfestResultsTweet.mjs";
|
||||
import TwitterManager from "./TwitterManager.mjs"
|
||||
|
|
@ -9,6 +10,7 @@ export function defaultTwitterManager() {
|
|||
new SchedulesTweet,
|
||||
new DailyDropGearTweet,
|
||||
new RegularGearTweet,
|
||||
new SalmonRunTweet,
|
||||
new SplatfestResultsTweet,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,3 +69,17 @@ export function formatShortDurationFromNow(value) {
|
|||
|
||||
return formatShortDuration((Date.parse(value) - time.now) / 1000);
|
||||
}
|
||||
|
||||
export function formatDurationHours(value) {
|
||||
let { negative, days, hours } = getDurationParts(value);
|
||||
|
||||
hours += 24 * days;
|
||||
|
||||
return `${negative}${hours} ${hours === 1 ? 'hour' : 'hours'}`;
|
||||
}
|
||||
|
||||
export function formatDurationHoursFromNow(value) {
|
||||
let time = useTimeStore();
|
||||
|
||||
return formatDurationHours((Date.parse(value) - time.now) / 1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,14 @@
|
|||
–
|
||||
{{ formatDateTime(props.schedule.endTime) }}
|
||||
</div>
|
||||
<div class="text-shadow text-zinc-300 ss:text-white ss:text-xl">
|
||||
<div class="text-shadow text-zinc-300 ss:hidden">
|
||||
{{ formatDurationFromNow(props.schedule.endTime) }}
|
||||
remaining
|
||||
</div>
|
||||
<div class="hidden ss:block text-shadow text-white text-xl">
|
||||
{{ formatDurationHoursFromNow(props.schedule.endTime) }}
|
||||
remaining
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2">
|
||||
|
|
@ -32,7 +36,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { formatDateTime, formatDurationFromNow } from '@/common/time';
|
||||
import { formatDateTime, formatDurationFromNow, formatDurationHoursFromNow } from '@/common/time';
|
||||
import StageImage from '../StageImage.vue';
|
||||
import SalmonRunWeapons from './SalmonRunWeapons.vue';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user