diff --git a/src/css/screenshots.scss b/src/css/screenshots.scss index 72ba2c2..da50e6b 100644 --- a/src/css/screenshots.scss +++ b/src/css/screenshots.scss @@ -49,6 +49,10 @@ transform: scale(1.25); } + .splatfest { + transform: scale(1.2) rotate(-1.4deg); + } + .twitter-logo { display: inline-block; line-height: 1.4rem; diff --git a/src/js/components/screenshots/ScreenshotHelper.vue b/src/js/components/screenshots/ScreenshotHelper.vue index 1c99856..461fd20 100644 --- a/src/js/components/screenshots/ScreenshotHelper.vue +++ b/src/js/components/screenshots/ScreenshotHelper.vue @@ -33,6 +33,18 @@ + +
+ Splatfest: + + + {{ splatfest.region }} + + +
@@ -48,6 +60,7 @@ export default { merchandises: null, timeline: null, salmonruncalendar: null, + festivals: null, }; }, computed: { @@ -77,6 +90,20 @@ export default { return this.timeline.weapon_availability.availabilities[0]; } }, + splatfests() { + if (this.festivals) { + let splatfests = []; + + for (let region in this.festivals) { + let festival = this.festivals[region].festivals[0]; + if (festival) + splatfests.push({ region, festival }); + } + + if (splatfests.length) + return splatfests; + } + }, }, created() { axios.get('data/schedules.json') @@ -87,6 +114,8 @@ export default { .then(response => this.timeline = response.data); axios.get('data/salmonruncalendar.json') .then(response => this.salmonruncalendar = response.data); + axios.get('data/festivals.json') + .then(response => this.festivals = response.data); }, } diff --git a/src/js/components/screenshots/splatfest/Splatfest.vue b/src/js/components/screenshots/splatfest/Splatfest.vue new file mode 100644 index 0000000..b7ea6b2 --- /dev/null +++ b/src/js/components/screenshots/splatfest/Splatfest.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/js/components/splatoon/SplatfestBox.vue b/src/js/components/splatoon/SplatfestBox.vue index f217916..1aa6877 100644 --- a/src/js/components/splatoon/SplatfestBox.vue +++ b/src/js/components/splatoon/SplatfestBox.vue @@ -18,7 +18,7 @@ -
+
{{ festival.times.start | date }} {{ festival.times.start | time }} @@ -28,7 +28,7 @@
-
+
+ +
+ + {{ festival.times.end - now | durationHours }} remaining + +
@@ -45,7 +51,7 @@ import Vue from 'vue'; export default { - props: ['festival', 'now'], + props: ['festival', 'now', 'screenshotMode'], computed: { title() { if (this.festival.times.start > this.now) diff --git a/src/js/regions.js b/src/js/regions.js index afc0d18..edc2051 100644 --- a/src/js/regions.js +++ b/src/js/regions.js @@ -1,8 +1,8 @@ const splatoonRegions = [ - { key: null, name: 'Global' }, - { key: 'na', name: 'North America & Oceania' }, - { key: 'eu', name: 'Europe' }, - { key: 'jp', name: 'Japan' }, + { key: null, name: 'Global', demonym: 'Global' }, + { key: 'na', name: 'North America & Oceania', demonym: 'North American & Oceanian' }, + { key: 'eu', name: 'Europe', demonym: 'European' }, + { key: 'jp', name: 'Japan', demonym: 'Japanese' }, ]; function getRegionByKey(key) { @@ -62,7 +62,7 @@ function detectSplatoonRegionFromLanguage(language) { return null; } -export default { +module.exports = { splatoonRegions, getRegionByKey, detectSplatoonRegion, diff --git a/src/js/screenshots.js b/src/js/screenshots.js index a01f939..d596d02 100644 --- a/src/js/screenshots.js +++ b/src/js/screenshots.js @@ -12,12 +12,14 @@ import Schedules from './components/screenshots/schedules/Schedules.vue'; import SplatNetGear from './components/screenshots/splatnetgear/SplatNetGear.vue'; import SalmonRun from './components/screenshots/salmonrun/SalmonRun.vue'; import NewWeapon from './components/screenshots/newweapon/NewWeapon.vue'; +import Splatfest from './components/screenshots/splatfest/Splatfest.vue'; const routes = [ { path: '/', component: ScreenshotHelper }, { path: '/schedules/:startTime', component: Schedules, props: true }, { path: '/splatNetGear/:startTime/:endTime', component: SplatNetGear, props: true }, { path: '/salmonRun/:startTime', component: SalmonRun, props: true }, { path: '/newWeapon/:releaseTime', component: NewWeapon, props: true }, + { path: '/splatfest/:region/:startTime', component: Splatfest, props: true }, ]; const router = new VueRouter({ routes }); diff --git a/src/updater/screenshots.js b/src/updater/screenshots.js index 39f855b..b1c6955 100644 --- a/src/updater/screenshots.js +++ b/src/updater/screenshots.js @@ -68,9 +68,17 @@ function captureNewWeaponScreenshot(releaseTime) { return captureScreenshot({ url }); } +function captureSplatfestScreenshot(region, startTime) { + let url = new URL(htmlUrl); + url.hash = `/splatfest/${region}/${startTime}`; + + return captureScreenshot({ url }); +} + module.exports = { captureScheduleScreenshot, captureGearScreenshot, captureSalmonRunScreenshot, captureNewWeaponScreenshot, + captureSplatfestScreenshot, } diff --git a/src/updater/twitter.js b/src/updater/twitter.js index a919a0f..753b2aa 100644 --- a/src/updater/twitter.js +++ b/src/updater/twitter.js @@ -4,12 +4,16 @@ const ScheduleTweet = require('./twitter/ScheduleTweet'); const GearTweet = require('./twitter/GearTweet'); const SalmonRunTweet = require('./twitter/SalmonRunTweet'); const NewWeaponTweet = require('./twitter/NewWeaponTweet'); +const SplatfestTweet = require('./twitter/SplatfestTweet'); let tweets = [ new ScheduleTweet, new GearTweet, new SalmonRunTweet, new NewWeaponTweet, + new SplatfestTweet('na'), + new SplatfestTweet('eu'), + new SplatfestTweet('jp'), ]; async function maybePostTweets() { diff --git a/src/updater/twitter/SplatfestTweet.js b/src/updater/twitter/SplatfestTweet.js new file mode 100644 index 0000000..8495cfd --- /dev/null +++ b/src/updater/twitter/SplatfestTweet.js @@ -0,0 +1,46 @@ +const TwitterPostBase = require('./TwitterPostBase'); +const { captureSplatfestScreenshot } = require('../screenshots'); +const { readData } = require('./utilities'); +const regions = require('../../js/regions'); + +class SplatfestTweet extends TwitterPostBase { + constructor(region) { + super(); + + this.region = region; + + let regionInfo = this.getRegionInfo(); + this.regionName = regionInfo.name; + this.regionDemonym = regionInfo.demonym; + } + + getRegionInfo() { + return regions.splatoonRegions.find(r => r.key == this.region); + } + + getKey() { return `splatfest-${this.region}`; } + getName() { return `Splatfest: ${this.regionName}`; } + + getFestivals() { + let festivals = readData('festivals.json'); + return festivals[this.region].festivals; + } + + getData() { + return this.getFestivals().find(f => f.times.start == this.getDataTime()); + } + + getTestData() { + return this.getFestivals()[0]; + } + + getImage(data) { + return captureSplatfestScreenshot(this.region, data.times.start); + } + + getText(data) { + return `The ${this.regionDemonym} Splatfest is now open! #splatfest #splatoon2`; + } +} + +module.exports = SplatfestTweet;