From 9c41f8ff6bc52001a6fdefd74303042fe1558433 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sat, 15 Feb 2025 12:59:06 +0100 Subject: [PATCH] refactor: public design review --- .../components/progress-bar/ProgressBar.scss | 4 - .../components/progress-bar/ProgressBar.tsx | 5 +- .../common/components/state/Empty.module.scss | 2 +- .../common/components/view-logo/ViewLogo.scss | 5 + .../common/components/view-logo/ViewLogo.tsx | 10 +- .../client/src/views/backstage/Backstage.scss | 32 ++-- apps/client/src/views/backstage/Backstage.tsx | 94 ++++++------ .../src/views/backstage/backstage.options.ts | 44 +----- .../src/views/backstage/backstage.utils.ts | 9 +- .../views/common/schedule/PublicSchedule.tsx | 21 --- .../src/views/common/schedule/Schedule.scss | 20 +-- .../views/common/schedule/ScheduleContext.tsx | 4 +- ...ckstageSchedule.tsx => ScheduleExport.tsx} | 11 +- .../views/common/schedule/ScheduleItem.tsx | 6 +- .../views/common/schedule/schedule.options.ts | 48 ++++++ apps/client/src/views/public/Public.scss | 141 +++++++++++++++--- apps/client/src/views/public/Public.tsx | 117 ++++++++------- .../client/src/views/public/public.options.ts | 57 +++---- apps/client/src/views/public/public.utils.ts | 45 ++++++ e2e/tests/features/203-delay-block.spec.ts | 4 +- 20 files changed, 420 insertions(+), 259 deletions(-) create mode 100644 apps/client/src/common/components/view-logo/ViewLogo.scss delete mode 100644 apps/client/src/views/common/schedule/PublicSchedule.tsx rename apps/client/src/views/common/schedule/{BackstageSchedule.tsx => ScheduleExport.tsx} (59%) create mode 100644 apps/client/src/views/common/schedule/schedule.options.ts create mode 100644 apps/client/src/views/public/public.utils.ts diff --git a/apps/client/src/common/components/progress-bar/ProgressBar.scss b/apps/client/src/common/components/progress-bar/ProgressBar.scss index 73383cc25..21d502eab 100644 --- a/apps/client/src/common/components/progress-bar/ProgressBar.scss +++ b/apps/client/src/common/components/progress-bar/ProgressBar.scss @@ -9,10 +9,6 @@ $progress-bar-br: 3px; border-radius: $progress-bar-br; background-color: var(--timer-progress-bg-override, $viewer-card-bg-color); overflow: clip; - - &--hidden { - display: none; - } } .progress-bar__indicator { diff --git a/apps/client/src/common/components/progress-bar/ProgressBar.tsx b/apps/client/src/common/components/progress-bar/ProgressBar.tsx index 8098a0e65..720704260 100644 --- a/apps/client/src/common/components/progress-bar/ProgressBar.tsx +++ b/apps/client/src/common/components/progress-bar/ProgressBar.tsx @@ -7,16 +7,15 @@ import './ProgressBar.scss'; interface ProgressBarProps { current: MaybeNumber; duration: MaybeNumber; - hidden?: boolean; className?: string; } export default function ProgressBar(props: ProgressBarProps) { - const { current, duration, hidden, className = '' } = props; + const { current, duration, className } = props; const progress = getProgress(current, duration); return ( -
+
); diff --git a/apps/client/src/common/components/state/Empty.module.scss b/apps/client/src/common/components/state/Empty.module.scss index 193862ebc..9f0e9436f 100644 --- a/apps/client/src/common/components/state/Empty.module.scss +++ b/apps/client/src/common/components/state/Empty.module.scss @@ -5,7 +5,7 @@ .empty { width: 100%; - opacity: 0.6; + opacity: 0.8; } .text { diff --git a/apps/client/src/common/components/view-logo/ViewLogo.scss b/apps/client/src/common/components/view-logo/ViewLogo.scss new file mode 100644 index 000000000..f2b2491a9 --- /dev/null +++ b/apps/client/src/common/components/view-logo/ViewLogo.scss @@ -0,0 +1,5 @@ +.viewLogo { + max-width: 100%; + max-height: 100%; + display: block; +} diff --git a/apps/client/src/common/components/view-logo/ViewLogo.tsx b/apps/client/src/common/components/view-logo/ViewLogo.tsx index 6ddde4593..6ed80ae1f 100644 --- a/apps/client/src/common/components/view-logo/ViewLogo.tsx +++ b/apps/client/src/common/components/view-logo/ViewLogo.tsx @@ -1,5 +1,7 @@ import { projectLogoPath } from '../../api/constants'; +import './ViewLogo.scss'; + interface ViewLogoProps { name: string; className: string; @@ -7,5 +9,11 @@ interface ViewLogoProps { export default function ViewLogo(props: ViewLogoProps) { const { name, className } = props; - return ; + + // we wrap the image in a div to help maintain the aspect ratio + return ( +
+ +
+ ); } diff --git a/apps/client/src/views/backstage/Backstage.scss b/apps/client/src/views/backstage/Backstage.scss index 4955104bc..f914a84fd 100644 --- a/apps/client/src/views/backstage/Backstage.scss +++ b/apps/client/src/views/backstage/Backstage.scss @@ -12,6 +12,7 @@ color: var(--color-override, $viewer-color); gap: $view-element-gap; padding: $view-outer-padding; + font-size: $base-font-size; display: grid; grid-template-columns: 1fr 40vw; @@ -28,6 +29,7 @@ left: 0; right: 0; margin-top: 25vh; + color: var(--label-color-override, $viewer-label-color); } /* =================== HEADER + EXTRAS ===================*/ @@ -82,16 +84,6 @@ gap: $view-element-gap; } - .empty { - font-size: clamp(24px, 2vw, 32px); - width: 100%; - height: 100%; - display: grid; - place-content: center; - text-align: center; - color: var(--label-color-override, $viewer-label-color); - } - .event { background-color: var(--card-background-color-override, $viewer-card-bg-color); padding: $view-card-padding; @@ -106,7 +98,6 @@ } .timer-group { - grid-area: timer; border-top: 2px solid var(--background-color-override, $viewer-background-color); margin-top: max(1vh, 16px); padding-top: max(1vh, 16px); @@ -119,7 +110,7 @@ max-width: 7.5em; } - .aux-timers { + .time-entry { &__label { font-size: $timer-label-size; color: var(--label-color-override, $viewer-label-color); @@ -207,14 +198,27 @@ right: 0; } + .schedule-nav-container { + padding-left: 0; + justify-content: center; + } + .schedule-container { - margin-left: 0; + padding-left: 0; flex: 1; } .info { - flex: 1; width: 100%; + text-align: right; + } + + .qr { + display: none; + } + + .info--stretch { + flex: 1; } } } diff --git a/apps/client/src/views/backstage/Backstage.tsx b/apps/client/src/views/backstage/Backstage.tsx index eb89b66c5..6795a5db1 100644 --- a/apps/client/src/views/backstage/Backstage.tsx +++ b/apps/client/src/views/backstage/Backstage.tsx @@ -15,7 +15,7 @@ import { cx, timerPlaceholderMin } from '../../common/utils/styleUtils'; import { formatTime, getDefaultFormat } from '../../common/utils/time'; import SuperscriptTime from '../../features/viewers/common/superscript-time/SuperscriptTime'; import { useTranslation } from '../../translation/TranslationProvider'; -import BackstageSchedule from '../common/schedule/BackstageSchedule'; +import ScheduleExport from '../common/schedule/ScheduleExport'; import { getBackstageOptions, useBackstageOptions } from './backstage.options'; import { getCardData, getIsPendingStart, getShowProgressBar, isOvertime } from './backstage.utils'; @@ -68,6 +68,7 @@ export default function Backstage(props: BackstageProps) { }, [selectedId]); // gather card data + const hasEvents = backstageEvents.length > 0; const { showNow, nowMain, nowSecondary, showNext, nextMain, nextSecondary } = getCardData( eventNow, eventNext, @@ -80,16 +81,18 @@ export default function Backstage(props: BackstageProps) { const clock = formatTime(time.clock); const isPendingStart = getIsPendingStart(time.playback, time.phase); const startedAt = isPendingStart ? formatTime(time.secondaryTimer) : formatTime(time.startedAt); - const scheduledStart = showNow ? '' : formatTime(runtime.plannedStart, { format12: 'hh:mm a', format24: 'HH:mm' }); - const scheduledEnd = showNow ? '' : formatTime(runtime.plannedEnd, { format12: 'hh:mm a', format24: 'HH:mm' }); + const scheduledStart = + hasEvents && showNow ? '' : formatTime(runtime.plannedStart, { format12: 'hh:mm a', format24: 'HH:mm' }); + const scheduledEnd = + hasEvents && showNow ? '' : formatTime(runtime.plannedEnd, { format12: 'hh:mm a', format24: 'HH:mm' }); - let stageTimer = millisToString(time.current, { fallback: timerPlaceholderMin }); - stageTimer = removeLeadingZero(stageTimer); + let displayTimer = millisToString(time.current, { fallback: timerPlaceholderMin }); + displayTimer = removeLeadingZero(displayTimer); // gather presentation styles const qrSize = Math.max(window.innerWidth / 15, 72); const showProgress = getShowProgressBar(time.playback); - const showSchedule = screenHeight > 700; // in vertical screens we may not have space + const showSchedule = hasEvents && screenHeight > 700; // in vertical screens we may not have space // gather option data const defaultFormat = getDefaultFormat(settings?.timeFormat); @@ -107,71 +110,66 @@ export default function Backstage(props: BackstageProps) {
-