From dd58425ec2444b09b14a598191be8dc8c1133618 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 29 Oct 2026 11:12:59 +0100 Subject: [PATCH] feat: delay section for mobile --- .../components/DelaySection/DelaySection.css | 355 ++++++++++++++++++ .../components/DelaySection/DelaySection.tsx | 47 ++- 2 files changed, 396 insertions(+), 6 deletions(-) diff --git a/src/features/dsp408/components/DelaySection/DelaySection.css b/src/features/dsp408/components/DelaySection/DelaySection.css index fc89cab..3b26589 100644 --- a/src/features/dsp408/components/DelaySection/DelaySection.css +++ b/src/features/dsp408/components/DelaySection/DelaySection.css @@ -1,3 +1,22 @@ +/* DelaySection.css */ + +/* ---------- Page wrapper ---------- */ + +.delay-page { + display: contents; /* invisible on desktop; a flex column on phones */ +} + +.delay-tabs, +.delay-rotate-hint { + display: none; /* phones only */ +} + +.delay-graph-wrap { + display: contents; /* invisible on desktop: the graphs stay direct flex children */ +} + +/* ---------- Fader strip ---------- */ + .delay-section { container-type: size; @@ -80,6 +99,8 @@ box-sizing: border-box; } +/* ---------- Graphs ---------- */ + .delay-linear-graph-section { flex: 0 0 calc(100% - var(--dsp-control-heigth)); min-height: 0; @@ -123,3 +144,337 @@ flex: 1; min-height: 0; } + +/* ---------- Phone (shared) ---------- + Landscape: tabs (Faders / Input delay / Output delay), one view at a time. + Portrait: faders only + a hint to rotate for the graphs. */ + +@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) { + .delay-page { + flex: 1 1 0; + min-height: 0; + width: 100%; + + display: flex; + flex-direction: column; + background: var(--bg-panel); + } + + /* ----- Tabs ----- */ + + .delay-tabs { + flex: 0 0 auto; + display: flex; + gap: var(--space-1); + padding: var(--space-1) var(--space-2); + border-bottom: var(--border-width) solid var(--border-hairline); + } + + .delay-page .delay-tabs__tab { + flex: 1 1 0; + min-width: 0; + min-height: 0; + height: 34px; + padding: 0 var(--space-2); + + font-family: var(--font-ui); + font-size: var(--font-xs); + font-weight: var(--font-weight-semibold); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + + background: var(--bg-void); + color: var(--text-muted); + border: var(--border-width) solid var(--border-hairline); + border-radius: var(--radius-sm); + cursor: pointer; + } + + .delay-page .delay-tabs__tab[aria-selected='true'] { + background: var(--bg-raised); + color: var(--text-primary); + border-color: var(--accent-brand); + } + + /* ----- Which view is visible ----- */ + + .delay-page[data-view='faders'] .delay-linear-graph-section, + .delay-page:not([data-view='faders']) .delay-section, + .delay-page[data-view='input'] .delay-graph-wrap[data-panel='output'], + .delay-page[data-view='output'] .delay-graph-wrap[data-panel='input'] { + display: none; + } + + /* ----- Curve views: graph fills everything ----- */ + + .delay-linear-graph-section { + flex: 1 1 0; + min-height: 0; + flex-direction: column; + gap: 0; + padding: var(--space-1); + } + + .delay-graph-wrap { + flex: 1 1 0; + min-height: 0; + display: flex; + flex-direction: column; + } + + .delay-graph-wrap .delay-graph-panel { + flex: 1 1 0; + height: auto; + } + + .delay-graph-title { + display: none; /* the tab already says which graph this is */ + } + + /* ----- Faders view: mixer strips, swipe sideways, snap per group ----- */ + + .delay-section { + position: relative; + z-index: auto; + flex: 1 1 0; + height: auto; + min-height: 0; + + align-items: stretch; + justify-content: flex-start; + border-top: none; + } + + .delay-panels { + display: flex; + justify-content: flex-start; /* desktop's "center" would clip the left side on overflow */ + width: 100%; + min-width: 0; + height: auto; + gap: var(--space-3); + padding: var(--space-2); + box-sizing: border-box; + + overflow-x: auto; + overflow-y: hidden; + scroll-snap-type: x proximity; + overscroll-behavior-x: contain; + -webkit-overflow-scrolling: touch; + } + + .delay-section .channel-group { + flex: 0 0 auto; + width: max-content; + max-width: none; + margin: 0; + padding: 30px var(--space-2) var(--space-2); + scroll-snap-align: start; + } + + .delay-section .channel-group__label { + top: 7px; + font-size: var(--font-sm); + } + + .delay-section .channel-group__items { + height: auto; + align-self: stretch; + justify-content: flex-start; + overflow: visible; /* no nested scroller: it would fight with .delay-panels */ + } + + /* Centered when everything fits, left-aligned and scrollable when it doesn't */ + .delay-panels > .channel-group:first-child { + margin-left: auto; + } + + .delay-panels > .channel-group:last-child { + margin-right: auto; + } + + .delay-panel { + flex: 0 0 auto; + width: clamp(72px, 10vw, 90px); + height: auto; /* stretches to the row */ + aspect-ratio: auto; + gap: var(--space-2); + padding-bottom: var(--space-2); + } + + .delay-panel__title { + padding-block: var(--space-2); + font-size: var(--font-xs); + } + + /* The fader (element right after the title) takes all remaining height. + pan-x: vertical drags move the fader, horizontal swipes still scroll the strip. */ + .delay-panel__title + * { + flex: 1 1 0; + min-height: 0; + width: 100%; + } + + .delay-panel__title + *, + .delay-panel__title + * * { + touch-action: pan-x !important; + } + + /* Unit selector: ms / m / ft stacked */ + .delay-unit-selector { + width: 72px; + height: auto; + align-self: center; + gap: var(--space-2); + } + + .delay-unit-selector .delay-unit-selector__btn { + width: 100% !important; + min-height: 44px !important; + padding: 0 !important; + font-size: var(--font-xs) !important; + } +} + +/* ---------- Portrait phone: faders only, Input row + Output row + Unit row ---------- */ + +@media (max-width: 768px) and (orientation: portrait) { + .delay-tabs { + display: none; + } + + .delay-rotate-hint { + flex: 0 0 auto; + display: block; + padding: var(--space-2) var(--space-3); + + font-family: var(--font-ui); + font-size: var(--font-xs); + text-align: center; + color: var(--text-muted); + + border-bottom: var(--border-width) solid var(--border-hairline); + } + + /* Whatever tab was active in landscape, portrait always shows the faders */ + .delay-page[data-view] .delay-linear-graph-section { + display: none; + } + + .delay-page[data-view] .delay-section { + display: flex; + } + + /* Rows: Input on top, Output below (scrolls on its own), Unit at the bottom */ + .delay-panels { + flex-direction: column; + gap: var(--space-2); + overflow: hidden; + scroll-snap-type: none; + } + + .delay-section .channel-group { + flex: 1 1 0; + min-height: 0; + width: 100%; + box-sizing: border-box; + padding: 28px var(--space-2) var(--space-2); + scroll-snap-align: none; + } + + /* Input and Output rows are their own size containers: everything the slider + sizes in cqh (thumb, track, readout) scales to the row height, like in landscape. */ + .delay-section .channel-group:not(:last-child) { + container-type: size; + } + + .delay-section .channel-group__label { + top: 6px; + font-size: var(--font-xs); + } + + .delay-section .channel-group__items { + flex: 1 1 auto; + width: 100%; + min-width: 0; + gap: var(--space-1); + + overflow-x: auto; + overflow-y: hidden; + scroll-snap-type: x proximity; + overscroll-behavior-x: contain; + -webkit-overflow-scrolling: touch; + } + + .delay-section .channel-group__items > :first-child { + margin-left: auto; + } + + .delay-section .channel-group__items > :last-child { + margin-right: auto; + } + + .delay-panel { + width: clamp(64px, 18vw, 76px); + gap: var(--space-1); + padding-bottom: var(--space-1); + scroll-snap-align: start; + } + + .delay-panel__title { + padding-block: var(--space-1); + font-size: 11px; + } + + /* Unit row: compact, buttons side by side, sized by its content */ + .delay-section .channel-group:last-child { + flex: 0 0 auto; + padding-top: 24px; + } + + .delay-unit-selector { + flex-direction: row; + width: 100%; + gap: var(--space-2); + align-self: stretch; + } + + .delay-unit-selector .delay-unit-selector__btn { + flex: 1 1 0; + min-height: 36px !important; + font-size: 11px !important; + } +} + +/* ---------- Landscape phone: thinner strips ---------- */ + +@media (max-height: 500px) and (pointer: coarse) { + .delay-panels { + padding: var(--space-1) var(--space-2); + } + + .delay-section .channel-group { + padding-top: 24px; + } + + .delay-section .channel-group__label { + top: 4px; + font-size: var(--font-xs); + } + + .delay-panel { + width: clamp(64px, 8vw, 84px); + gap: var(--space-1); + padding-bottom: var(--space-1); + } + + .delay-panel__title { + padding-block: var(--space-1); + font-size: 11px; + } + + .delay-unit-selector .delay-unit-selector__btn { + min-height: 36px !important; + font-size: 11px !important; + } +} \ No newline at end of file diff --git a/src/features/dsp408/components/DelaySection/DelaySection.tsx b/src/features/dsp408/components/DelaySection/DelaySection.tsx index 83daf17..3e3a880 100644 --- a/src/features/dsp408/components/DelaySection/DelaySection.tsx +++ b/src/features/dsp408/components/DelaySection/DelaySection.tsx @@ -19,6 +19,15 @@ const DELAY_STEP: Record = { type SetDelayFn = (channel: Channel, delay: number) => Promise; +// Phone only: one view at a time (CSS hides the tabs on desktop) +type DelayView = 'faders' | 'input' | 'output'; + +const DELAY_VIEWS: { id: DelayView; label: string }[] = [ + { id: 'faders', label: 'Faders' }, + { id: 'input', label: 'Input delay' }, + { id: 'output', label: 'Output delay' }, +]; + function channelKey(channel: Channel): string { return 'Input' in channel ? `Input:${channel.Input}` : `Output:${channel.Output}`; } @@ -76,7 +85,7 @@ function DelayUnitSelector({ + ))} + + + {/* Portrait phone only (CSS): graphs need the width of landscape */} +
+ Rotate your phone to landscape to see the delay graphs. +
+
- - +
+ +
+
+ +
@@ -218,8 +253,8 @@ function DelaySection({
- + ); } -export default DelaySection; +export default DelaySection; \ No newline at end of file