From 0367405ede78dea6a6e18eccc48fe5fed56763cd Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Tue, 9 Mar 2021 12:57:43 -0800 Subject: [PATCH] Tweak Twitter image layouts to fit in the timeline view without cropping --- src/app/screenshots/screenshots.js | 12 +++--- src/web/assets/css/screenshots.scss | 29 ++++++++++--- src/web/components/screenshots/Wrapper.vue | 41 +++++++++++++------ .../screenshots/schedules/ScheduleBox.vue | 29 ++++++++++--- .../screenshots/schedules/Schedules.vue | 6 +-- .../screenshots/splatfest/Splatfest.vue | 2 +- .../screenshots/splatnetgear/SplatNetGear.vue | 11 +---- 7 files changed, 86 insertions(+), 44 deletions(-) diff --git a/src/app/screenshots/screenshots.js b/src/app/screenshots/screenshots.js index 7f64623..29e0f37 100644 --- a/src/app/screenshots/screenshots.js +++ b/src/app/screenshots/screenshots.js @@ -5,8 +5,10 @@ const ecstatic = require('ecstatic'); const puppeteer = require('puppeteer'); const viewport = { - width: 1012, // Twitter's in-stream image width is 506px, 506*2 = 1012 - height: 600, + // Using a 16:9 ratio here by default to match Twitter's image card dimensions + // 1216 was chosen as the width because of Bulma's "widescreen" breakpoint + width: 1216, + height: 684, deviceScaleFactor: 2, }; @@ -57,15 +59,13 @@ async function captureScreenshot(options) { function captureScheduleScreenshot(now, splatfestBattle = false) { let hash = `/schedules/${now}`; - let viewport = (splatfestBattle) ? { height: 800 } : undefined; - - return captureScreenshot({ hash, viewport }); + return captureScreenshot({ hash }); } function captureGearScreenshot(now) { let hash = `/splatNetGear/${now}`; - return captureScreenshot({ hash, viewport: { height: 700 } }); + return captureScreenshot({ hash }); } function captureSalmonRunScreenshot(now, mode) { diff --git a/src/web/assets/css/screenshots.scss b/src/web/assets/css/screenshots.scss index 0ddbbc1..66900e3 100644 --- a/src/web/assets/css/screenshots.scss +++ b/src/web/assets/css/screenshots.scss @@ -4,7 +4,7 @@ #screenshots { .main-schedule-box { border-radius: 20px; - mask-size: 800px 1280px; // Original value: 500px 800px + mask-size: 900px 1440px; // Original value: 500px 800px padding-top: 50px; .stage-image:not(:last-child) { @@ -12,7 +12,7 @@ } .stage-title { - font-size: 1.35rem; + font-size: 1.65rem; } } @@ -27,7 +27,7 @@ } .featured-merchandise { - transform: scale(1.85) rotate(-1.4deg); + transform: scale(1.9) rotate(-1.4deg); min-width: 173px; .info-overlay { @@ -41,8 +41,21 @@ } } + .still-available-merchandise { + transform: scale(0.9); + margin: -60px 0; + + .merchandise-box { + font-size: 1.25rem; + } + + .remaining-time { + font-size: 1.25rem !important; + } + } + .salmon-run { - transform: scale(1.5) rotate(-1.4deg); + transform: scale(1.85) rotate(-1.4deg); } .salmon-run-gear .merchandise-box { @@ -74,7 +87,13 @@ .splatfest-results { width: 275px; - transform: scale(1.35); + transform: scale(1.65); + } + + .splatfest-screenshot { + .splatfest { + transform: scale(1.25) rotate(-1.4deg); + } } .twitter-logo { diff --git a/src/web/components/screenshots/Wrapper.vue b/src/web/components/screenshots/Wrapper.vue index dc69eb8..95b6beb 100644 --- a/src/web/components/screenshots/Wrapper.vue +++ b/src/web/components/screenshots/Wrapper.vue @@ -11,27 +11,39 @@
-
-

{{ title }}

-
- - @splatoon2inkbot -   •   - splatoon2.ink +
+ +
+
+
+

{{ title }}

+
+
 
+
+
+ + @splatoon2inkbot +
+
+
 
+
+
+ splatoon2.ink
+
+ {{ now | dateTime('en', 'UTC', 'MMMM D, YYYY HH:mm z') }} +
+
+
- - - @@ -55,7 +67,10 @@ import { mapGetters } from 'vuex'; import moment from 'moment-timezone'; export default { - props: ['title'], + props: { + title: null, + hideLocalTimes: Boolean, + }, filters: { dateTime(value, locale, timeZone, format = 'LLL z') { let date = moment.unix(value).tz(timeZone); diff --git a/src/web/components/screenshots/schedules/ScheduleBox.vue b/src/web/components/screenshots/schedules/ScheduleBox.vue index 18233f2..8d8e7fe 100644 --- a/src/web/components/screenshots/schedules/ScheduleBox.vue +++ b/src/web/components/screenshots/schedules/ScheduleBox.vue @@ -1,12 +1,12 @@ diff --git a/src/web/components/screenshots/schedules/Schedules.vue b/src/web/components/screenshots/schedules/Schedules.vue index f2cf0d5..3bee7c9 100644 --- a/src/web/components/screenshots/schedules/Schedules.vue +++ b/src/web/components/screenshots/schedules/Schedules.vue @@ -13,7 +13,7 @@ -
+
@@ -44,8 +44,8 @@
-
- +
+
diff --git a/src/web/components/screenshots/splatfest/Splatfest.vue b/src/web/components/screenshots/splatfest/Splatfest.vue index a20d6eb..1e6c189 100644 --- a/src/web/components/screenshots/splatfest/Splatfest.vue +++ b/src/web/components/screenshots/splatfest/Splatfest.vue @@ -1,5 +1,5 @@
{{ now | dateTime('en', 'UTC', 'MMMM D, YYYY HH:mm z') }}
{{ now | dateTime('en-us', 'America/Los_Angeles') }} {{ now | dateTime('en-gb', 'Europe/London') }}