feat: peq section for mobile

This commit is contained in:
Lucas
2026-10-30 15:39:33 +01:00
parent f78d872625
commit 3caec30413
2 changed files with 737 additions and 172 deletions
@@ -1,4 +1,35 @@
/* InputSection.css */ /* ChannelSection.css */
/* Font-size hooks: desktop uses the cqh values, the phone block below
overrides them with fixed px sizes.
--ch-fs main text in the control strip (titles, steppers, buttons)
--ch-fs-action buttons in the Actions group
--ch-fs-label small labels under the sliders */
/* ---------- Page wrapper ---------- */
.channel-page {
display: contents; /* invisible on desktop; a flex column on phones */
}
.channel-tabs,
.channel-rotate-hint {
display: none; /* phones only */
}
.channel-panel__label-short,
.peq-band-list__label-short {
display: none;
}
/* Invisible wrappers on desktop (layout identical to before) */
.peq-block,
.crossover-panel__slider {
display: contents;
}
/* ---------- Graph ---------- */
.channel-graph-section { .channel-graph-section {
flex: 0 0 calc(100% - var(--dsp-control-heigth)); flex: 0 0 calc(100% - var(--dsp-control-heigth));
min-height: 0; min-height: 0;
@@ -65,9 +96,55 @@
min-height: 0; min-height: 0;
} }
/* Bottom control bar — same pattern as .compressor-section: absolute, .channel-graph-panel__magnitude-wrap {
flex: 1 1 0;
min-height: 0;
min-width: 0;
position: relative;
}
.channel-graph__title-row {
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
padding: 1cqh 1.5cqh;
}
.channel-graph__title-row .channel-graph__title {
padding: 0; /* was on the standalone title element; row now owns spacing */
}
.channel-graph-view-toggle {
display: flex;
gap: 0.4cqh;
border: var(--border-width) solid var(--border-hairline);
border-radius: var(--radius-sm);
padding: 0.3cqh;
background: var(--bg-void);
}
.channel-graph-view-toggle__btn {
font-family: var(--font-ui);
font-size: 2cqh;
padding: 0.6cqh 1.2cqh;
background: transparent;
color: var(--text-muted);
border: none;
border-radius: var(--radius-sm);
cursor: pointer;
}
.channel-graph-view-toggle__btn.active {
background: var(--accent-brand);
color: var(--bg-void);
}
/* ---------- Control strip ----------
Bottom control bar — same pattern as .compressor-section: absolute,
bottom-anchored, panels flow in a row and scroll horizontally instead bottom-anchored, panels flow in a row and scroll horizontally instead
of squeezing into a fixed max-width. */ of squeezing into a fixed max-width. */
.channel-control-section { .channel-control-section {
container-type: size; container-type: size;
position: absolute; position: absolute;
@@ -105,7 +182,8 @@
padding: 2cqh; padding: 2cqh;
} }
/* Peq Sliders */ /* ---------- PEQ sliders ---------- */
.channel-panel { .channel-panel {
position: relative; position: relative;
height: 100%; height: 100%;
@@ -129,7 +207,7 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 4cqh; font-size: var(--ch-fs, 4cqh);
font-weight: var(--font-weight-semibold); font-weight: var(--font-weight-semibold);
padding-top: 2cqh; padding-top: 2cqh;
padding-bottom: 2cqh; padding-bottom: 2cqh;
@@ -167,11 +245,13 @@
.channel-panel__cell-label { .channel-panel__cell-label {
flex: 0 0 auto; flex: 0 0 auto;
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 3.2cqh; font-size: var(--ch-fs-label, 3.2cqh);
color: var(--text-muted); color: var(--text-muted);
white-space: nowrap; white-space: nowrap;
} }
/* ---------- Crossover ---------- */
.crossover-panel { .crossover-panel {
position: relative; position: relative;
height: 100%; height: 100%;
@@ -196,7 +276,7 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 4cqh; font-size: var(--ch-fs, 4cqh);
font-weight: var(--font-weight-semibold); font-weight: var(--font-weight-semibold);
padding-top: 2cqh; padding-top: 2cqh;
padding-bottom: 2cqh; padding-bottom: 2cqh;
@@ -207,36 +287,20 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
/* Now the root of a ChoiceSelect rather than a native <select>. */ /* Root of a ChoiceSelect rather than a native <select>. */
.crossover-panel__select { .crossover-panel__select {
flex: 0 0 auto; flex: 0 0 auto;
width: 85%; width: 85%;
height: auto;
min-height: 0;
font-family: var(--font-ui); font-family: var(--font-ui);
} font-size: var(--ch-fs, 4cqh);
.crossover-panel__select .choice-select__input,
.crossover-panel__select .choice-select__input option {
font-size: 4cqh;
color: var(--accent-brand); color: var(--accent-brand);
/* padding-left: 1cqh; */
} }
.crossover-panel__select { /* ---------- PEQ band list ---------- */
flex: 0 0 auto;
width: 85%;
font-family: var(--font-ui);
font-size: 4cqh;
}
.crossover-panel__select .choice-select__input,
.crossover-panel__select .choice-select__input option {
height: 100%;
padding: 0;
padding-left: 2cqh;
font-size: 4cqh;
color: var(--accent-brand);
border-radius: var(--radius-sm);
}
.peq-band-list { .peq-band-list {
flex: 1 1 auto; flex: 1 1 auto;
@@ -267,6 +331,8 @@
align-items: stretch; align-items: stretch;
gap: 1cqh; gap: 1cqh;
color: var(--accent-brand);
box-sizing: border-box; box-sizing: border-box;
} }
@@ -274,7 +340,7 @@
flex: 0 0 auto; flex: 0 0 auto;
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 4cqh; font-size: var(--ch-fs, 4cqh);
color: var(--text-primary); color: var(--text-primary);
text-align: center; text-align: center;
font-weight: var(--font-weight-semibold); font-weight: var(--font-weight-semibold);
@@ -334,66 +400,494 @@
min-height: 0; min-height: 0;
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 4cqh; font-size: var(--ch-fs, 4cqh);
} }
.channel-graph-panel__magnitude-wrap { .peq-channel-selector {
width: 80px;
height: 100%;
align-self: stretch;
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
gap: var(--space-1);
box-sizing: border-box;
}
/* ---------- Phone (shared) ----------
Landscape: tabs (Controls / Filter response), one view at a time.
Portrait: controls only + a hint to rotate for the graphs. */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
.channel-page {
--ch-fs: 11px;
--ch-fs-action: 12px;
--ch-fs-label: 10px;
--peq-list-width: 480px;
flex: 1 1 0; flex: 1 1 0;
min-height: 0; min-height: 0;
min-width: 0; width: 100%;
position: relative;
display: flex;
flex-direction: column;
background: var(--bg-panel);
} }
.channel-graph__title-row { /* ----- Tabs ----- */
.channel-tabs {
flex: 0 0 auto; flex: 0 0 auto;
display: flex; display: flex;
align-items: center; gap: var(--space-1);
justify-content: space-between; padding: var(--space-1) var(--space-2);
padding: 1cqh 1.5cqh; border-bottom: var(--border-width) solid var(--border-hairline);
} }
.channel-graph__title-row .channel-graph__title { .channel-page .channel-tabs__tab {
padding: 0; /* was on the standalone title element; row now owns spacing */ flex: 1 1 0;
} min-width: 0;
min-height: 0;
height: 34px;
padding: 0 var(--space-2);
.channel-graph-view-toggle {
display: flex;
gap: 0.4cqh;
border: var(--border-width) solid var(--border-hairline);
border-radius: var(--radius-sm);
padding: 0.3cqh;
background: var(--bg-void);
}
.channel-graph-view-toggle__btn {
font-family: var(--font-ui); font-family: var(--font-ui);
font-size: 2cqh; font-size: var(--font-xs);
padding: 0.6cqh 1.2cqh; font-weight: var(--font-weight-semibold);
background: transparent; white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
background: var(--bg-void);
color: var(--text-muted); color: var(--text-muted);
border: none; border: var(--border-width) solid var(--border-hairline);
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
} }
.channel-graph-view-toggle__btn.active { .channel-page .channel-tabs__tab[aria-selected='true'] {
background: var(--accent-brand); background: var(--bg-raised);
color: var(--bg-void); color: var(--text-primary);
border-color: var(--accent-brand);
} }
.peq-band-list__stepper .choice-stepper__input, /* ----- Which view is visible ----- */
.peq-band-list__select .choice-select__input {
height: 100%; .channel-page[data-view='controls'] .channel-graph-section,
.channel-page:not([data-view='controls']) .channel-control-section {
display: none;
}
/* ----- Magnitude / Phase tabs: one graph fills everything ----- */
.channel-graph-section {
flex: 1 1 0;
min-height: 0;
gap: var(--space-1);
padding: var(--space-1);
}
.channel-graph__title {
padding: 0;
font-size: var(--font-xs);
}
.channel-graph__title-row {
padding: var(--space-1);
gap: var(--space-2);
}
.channel-graph-view-toggle {
gap: 2px;
padding: 2px;
}
.channel-graph-view-toggle__btn {
font-size: 11px;
padding: 4px 10px;
}
.channel-bypass-overlay span {
font-size: 28px;
}
/* ----- Controls view: groups, swipe sideways, snap per group ----- */
.channel-control-section {
position: relative;
z-index: auto;
flex: 1 1 0;
height: auto;
min-height: 0; min-height: 0;
font-family: var(--font-mono); align-items: stretch;
font-size: 4cqh; justify-content: flex-start;
color: var(--accent-brand); border-top: none;
}
background: transparent; .channel-control-panel {
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;
}
/* Each group is as wide as its content (never shrunk to the viewport),
so .channel-control-panel is the only thing that scrolls. */
.channel-control-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;
}
.channel-control-section .channel-group__label {
top: 7px;
font-size: var(--font-sm);
}
.channel-control-section .channel-group__items {
height: auto;
align-self: stretch;
justify-content: flex-start;
gap: var(--space-2);
overflow: visible; /* no nested scroller: it would fight with .channel-control-panel */
}
/* Centered when everything fits, left-aligned and scrollable when it doesn't */
.channel-control-panel > .channel-group:first-child {
margin-left: auto;
}
.channel-control-panel > .channel-group:last-child {
margin-right: auto;
}
/* PEQ group: band table + slider panel side by side (landscape) */
.peq-block {
display: flex;
flex-direction: row;
align-items: stretch;
gap: var(--space-2);
min-height: 0;
}
.peq-band-list {
flex: 0 0 auto;
width: var(--peq-list-width);
gap: 3px;
padding: 3px;
}
.peq-band-list__row {
gap: 3px;
}
.peq-band-list__row--header {
padding-block: 3px;
}
.channel-panel {
flex: 0 0 auto;
width: clamp(210px, 28vw, 260px);
height: auto; /* stretches to the row */
aspect-ratio: auto;
}
.channel-panel__title {
padding-block: var(--space-1);
}
.channel-panel__grid {
gap: var(--space-1);
padding: var(--space-2) var(--space-1);
}
.channel-panel__cell {
gap: var(--space-1);
}
.channel-panel__cell-label {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
/* Crossover: two narrow strips */
.crossover-panel {
flex: 0 0 auto;
width: clamp(80px, 8vw, 100px);
height: auto; /* stretches to the row */
aspect-ratio: auto;
gap: var(--space-2);
padding-bottom: var(--space-2);
}
.peq-channel-selector {
width: 80px;
height: 100%;
align-self: stretch;
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
gap: var(--space-2);
box-sizing: border-box;
}
.crossover-panel__title {
padding-block: var(--space-1);
}
.crossover-panel__slider > * {
min-height: 0;
}
.peq-band-list__label-long {
display: none;
}
.peq-band-list__label-short {
display: inline;
}
.channel-panel__label-long {
display: none;
}
.channel-panel__label-short {
display: inline;
}
/* pan-x: vertical drags move the fader, horizontal swipes still scroll the strip.
Applied to the thumb/track too so a swipe that starts on them scrolls. */
.channel-panel__cell > :first-child,
.channel-panel__cell > :first-child *,
.crossover-panel__slider,
.crossover-panel__slider * {
touch-action: pan-x !important;
}
}
/* ---------- Portrait phone: controls only, no groups ----------
Row 1: PEQ band table (full width)
Row 2: PEQ sliders | HighPass | LowPass | Actions (all on the same row)
The groups are flattened (display: contents) so panels from different
groups can share a row. Nothing scrolls. */
@media (max-width: 768px) and (orientation: portrait) {
.channel-page {
--ch-fs: 11px;
--ch-fs-action: 13px;
}
.channel-tabs {
display: none;
}
.channel-rotate-hint {
flex: 0 0 auto;
display: block;
padding: var(--space-1) var(--space-2);
font-family: var(--font-ui);
font-size: 11px;
text-align: center; text-align: center;
text-align-last: center; color: var(--text-muted);
padding: 0;
border-bottom: var(--border-width) solid var(--border-hairline);
}
/* Whatever tab was active in landscape, portrait always shows the controls */
.channel-page[data-view] .channel-graph-section {
display: none;
}
.channel-page[data-view] .channel-control-section {
display: flex;
}
.channel-control-panel {
flex: 1 1 auto;
display: grid;
width: 100%;
min-width: 0;
box-sizing: border-box;
/* Fixed widths (same idea as the 40px GEQ cells): the strip scrolls instead of shrinking.
Total ≈ the landscape band-table width (--peq-list-width), so the table stays readable. */
grid-template-columns:
210px /* PEQ sliders */
100px /* HighPass */
100px /* LowPass */
110px; /* Actions */
grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
justify-content: start; /* desktop's "center" would clip the left side on overflow */
gap: var(--space-1);
padding: var(--space-1) var(--space-2);
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: none;
overscroll-behavior-x: contain;
-webkit-overflow-scrolling: touch;
}
/* Flatten the groups (and hide their labels) */
.channel-control-section .channel-group,
.channel-control-section .channel-group__items,
.peq-block {
display: contents;
}
.channel-control-section .channel-group__label {
display: none;
}
/* Each panel is its own size container (like the panels in CompressorSection):
the cqh sizes inside (slider thumb, track, readout, paddings) scale to the panel. */
.peq-band-list {
grid-row: 1;
grid-column: 1 / -1;
width: auto;
min-width: var(--peq-list-width); /* 480px, same as landscape */
min-height: 0;
container-type: size;
--peq-cols: 0.45fr 0.9fr 0.55fr 0.9fr 1.1fr 0.55fr;
}
.peq-band-list__row {
grid-template-columns: var(--peq-cols);
}
/* Row 2: columns fill in DOM order = PEQ sliders, HighPass, LowPass, Actions */
.channel-panel,
.crossover-panel {
grid-row: 2;
width: auto; /* fills its fixed grid column */
min-width: 0;
min-height: 0;
height: auto;
margin: 0; margin: 0;
container-type: size;
}
.channel-panel__title,
.crossover-panel__title {
padding-block: 4px;
}
.channel-panel__grid {
gap: 2px;
padding: 4px;
position: relative;
z-index: 1; /* paint above the title if a thumb still reaches it */
}
/* The thumb sticks out of the track by half its height at min/max: leave that
room inside the cell instead of clipping it or letting it slide under the title. */
.channel-panel__cell {
overflow: visible;
padding-block: 3cqh;
box-sizing: border-box;
gap: 2px;
}
.channel-panel__cell > :first-child {
min-height: 0;
max-height: 100%;
}
.crossover-panel {
gap: 4px;
padding-bottom: 4px;
}
.crossover-panel__slider {
display: contents;
}
.crossover-panel__select {
width: 90%;
}
/* Actions: its own panel in the 4th column, Bypass above Reset */
.channel-control-section .peq-channel-selector {
grid-row: 2;
width: auto;
height: auto;
min-width: 0;
min-height: 0;
align-self: stretch;
display: flex;
flex-direction: column;
justify-content: center;
gap: var(--space-1);
padding: var(--space-1);
box-sizing: border-box;
background: var(--bg-void);
border: var(--border-width) solid var(--border-hairline);
border-radius: var(--radius-md);
}
.channel-control-section .peq-channel-selector > * {
flex: 1 1 0;
min-height: 0;
max-height: 64px;
width: 100% !important;
padding: 0 !important; /* inline paddings are in cqh: too big on a phone */
font-size: var(--ch-fs-action) !important;
overflow: hidden;
text-overflow: ellipsis;
}
}
/* ---------- Landscape phone: thinner strips ---------- */
@media (max-height: 500px) and (pointer: coarse) {
.channel-control-panel {
padding: var(--space-1) var(--space-2);
}
.channel-control-section .channel-group {
padding-top: 24px;
}
.channel-control-section .channel-group__label {
top: 4px;
font-size: var(--font-xs);
}
.channel-panel {
width: clamp(200px, 26vw, 240px);
}
.channel-panel__title,
.crossover-panel__title {
padding-block: var(--space-1);
}
.channel-panel__grid {
padding: var(--space-1);
}
} }
@@ -28,6 +28,10 @@ import {
} from '../../constants'; } from '../../constants';
import { MagnitudeGraph, PhaseGraph } from './ChannelGraph'; import { MagnitudeGraph, PhaseGraph } from './ChannelGraph';
// Font size used by the buttons below. On desktop it falls back to the cqh value;
// the mobile CSS overrides --ch-fs with a fixed px size.
const BTN_FS = 'var(--ch-fs, 4cqh)';
function nearestQValue(q: number, values: readonly number[] = PEAK_Q_VALUES): number { function nearestQValue(q: number, values: readonly number[] = PEAK_Q_VALUES): number {
return values.reduce((nearest, current) => return values.reduce((nearest, current) =>
Math.abs(current - q) < Math.abs(nearest - q) ? current : nearest Math.abs(current - q) < Math.abs(nearest - q) ? current : nearest
@@ -36,6 +40,32 @@ function nearestQValue(q: number, values: readonly number[] = PEAK_Q_VALUES): nu
type GraphView = 'both' | 'magnitude' | 'phase'; type GraphView = 'both' | 'magnitude' | 'phase';
// Phone only: one view at a time (CSS hides the tabs on desktop)
type ChannelView = 'controls' | 'magnitude' | 'phase';
const CHANNEL_VIEWS: { id: ChannelView; label: string }[] = [
{ id: 'controls', label: 'Controls' },
{ id: 'magnitude', label: 'Magnitude' },
{ id: 'phase', label: 'Phase' },
];
// Must match the phone media query in ChannelSection.css
const MOBILE_QUERY = '(max-width: 768px), (max-height: 500px) and (pointer: coarse)';
function useIsMobile(): boolean {
const [matches, setMatches] = useState(() => window.matchMedia(MOBILE_QUERY).matches);
useEffect(() => {
const mql = window.matchMedia(MOBILE_QUERY);
const onChange = () => setMatches(mql.matches);
onChange();
mql.addEventListener('change', onChange);
return () => mql.removeEventListener('change', onChange);
}, []);
return matches;
}
function GraphViewToggle({ function GraphViewToggle({
view, view,
onChange, onChange,
@@ -77,14 +107,14 @@ function ChannelActions({
onReset: () => void; onReset: () => void;
}) { }) {
return ( return (
<div className="geq-channel-selector"> <div className="peq-channel-selector">
<Button <Button
variant="toggle" variant="toggle"
className={bypass ? 'active-warning' : ''} className={bypass ? 'active-warning' : ''}
onClick={onBypass} onClick={onBypass}
style={{ style={{
width: '100%', width: '100%',
fontSize: '3.5cqh', fontSize: 'var(--ch-fs-action, 3.5cqh)',
paddingTop: '2cqh', paddingTop: '2cqh',
paddingBottom: '2cqh', paddingBottom: '2cqh',
minHeight: 0, minHeight: 0,
@@ -100,7 +130,7 @@ function ChannelActions({
disabled={resetting} disabled={resetting}
style={{ style={{
width: '100%', width: '100%',
fontSize: '3.5cqh', fontSize: 'var(--ch-fs-action, 3.5cqh)',
paddingTop: '2cqh', paddingTop: '2cqh',
paddingBottom: '2cqh', paddingBottom: '2cqh',
minHeight: 0, minHeight: 0,
@@ -160,7 +190,10 @@ function PeqPanelSliders({
style={{ width: '100%', flex: '1 1 auto' }} style={{ width: '100%', flex: '1 1 auto' }}
/> />
<div className="channel-panel__cell-label">Frequency</div> <div className="channel-panel__cell-label">
<span className="channel-panel__label-long">Frequency</span>
<span className="channel-panel__label-short">Freq</span>
</div>
</div> </div>
<div className="channel-panel__cell channel-panel__cell--q"> <div className="channel-panel__cell channel-panel__cell--q">
@@ -249,6 +282,8 @@ function CrossoverPanel({
<div className="crossover-panel"> <div className="crossover-panel">
<div className="crossover-panel__title">{title}</div> <div className="crossover-panel__title">{title}</div>
{/* display: contents on desktop; lets the mobile CSS target the slider for touch-action */}
<div className="crossover-panel__slider">
<VerticalSlider <VerticalSlider
min={FREQUENCY_MIN} min={FREQUENCY_MIN}
max={FREQUENCY_MAX} max={FREQUENCY_MAX}
@@ -264,6 +299,7 @@ function CrossoverPanel({
onInput={(value) => onLiveValue(value)} onInput={(value) => onLiveValue(value)}
style={{ width: '100%', flex: '1 1 auto' }} style={{ width: '100%', flex: '1 1 auto' }}
/> />
</div>
<ChoiceSelect <ChoiceSelect
className="crossover-panel__select" className="crossover-panel__select"
@@ -283,7 +319,7 @@ function CrossoverPanel({
width: '85%', width: '85%',
paddingLeft: 0, paddingLeft: 0,
paddingRight: 0, paddingRight: 0,
fontSize: '4cqh', fontSize: BTN_FS,
paddingTop: '2cqh', paddingTop: '2cqh',
paddingBottom: '2cqh', paddingBottom: '2cqh',
minHeight: 0, minHeight: 0,
@@ -363,7 +399,6 @@ function PeqBandList({
onClick={() => setActiveBand(band)} onClick={() => setActiveBand(band)}
style={{ style={{
minHeight: 0, minHeight: 0,
fontSize: '4cqh',
}} }}
> >
{`B${i + 1}`} {`B${i + 1}`}
@@ -423,9 +458,10 @@ function PeqBandList({
variant="toggle" variant="toggle"
className={peq.bypass ? 'active-warning' : ''} className={peq.bypass ? 'active-warning' : ''}
onClick={() => commit(band, { bypass: !peq.bypass })} onClick={() => commit(band, { bypass: !peq.bypass })}
style={{ minHeight: 0, fontSize: '4cqh', paddingInline: 0 }} style={{ minHeight: 0, fontSize: BTN_FS, paddingInline: 0 }}
> >
{peq.bypass ? 'Bypassed' : 'Bypass'} <span className="peq-band-list__label-long">{peq.bypass ? 'Bypassed' : 'Bypass'}</span>
<span className="peq-band-list__label-short">Byp</span>
</Button> </Button>
</div> </div>
); );
@@ -468,6 +504,15 @@ function ChannelSection({
const [graphView, setGraphView] = useState<GraphView>('both'); const [graphView, setGraphView] = useState<GraphView>('both');
const [resetting, setResetting] = useState(false); const [resetting, setResetting] = useState(false);
const [isResetConfirmOpen, setIsResetConfirmOpen] = useState(false); const [isResetConfirmOpen, setIsResetConfirmOpen] = useState(false);
const [view, setView] = useState<ChannelView>('controls');
const isMobile = useIsMobile();
// Phone: one tab per graph, so the Both / Mag / Phase toggle is not shown
const shownGraph: GraphView = isMobile
? view === 'phase'
? 'phase'
: 'magnitude'
: graphView;
// Live values // Live values
const [liveHpFreq, setLiveHpFreq] = useState<number>(FREQUENCY_MIN); const [liveHpFreq, setLiveHpFreq] = useState<number>(FREQUENCY_MIN);
@@ -595,20 +640,42 @@ function ChannelSection({
return ( return (
<> <>
<div className="channel-page" data-view={view}>
{/* Phone only (hidden on desktop by CSS): one view at a time */}
<div className="channel-tabs" role="tablist" aria-label="Channel views">
{CHANNEL_VIEWS.map((v) => (
<button
key={v.id}
type="button"
role="tab"
aria-selected={view === v.id}
className="channel-tabs__tab"
onClick={() => setView(v.id)}
>
{v.label}
</button>
))}
</div>
{/* Portrait phone only (CSS): the graphs need the width of landscape */}
<div className="channel-rotate-hint">
Rotate your phone to landscape to see the filter graphs.
</div>
<div className="channel-graph-section"> <div className="channel-graph-section">
<div className="channel-graph-panel"> <div className="channel-graph-panel">
<div className="channel-graph__title-row"> <div className="channel-graph__title-row">
<div className="channel-graph__title">{activeChannelState.name} - Filters</div> <div className="channel-graph__title">{activeChannelState.name} - Filters</div>
<GraphViewToggle view={graphView} onChange={setGraphView} /> {!isMobile && <GraphViewToggle view={graphView} onChange={setGraphView} />}
</div> </div>
{(graphView === 'both' || graphView === 'magnitude') && ( {(shownGraph === 'both' || shownGraph === 'magnitude') && (
<div className="channel-graph-panel__magnitude-wrap"> <div className="channel-graph-panel__magnitude-wrap">
<MagnitudeGraph {...graphProps} /> <MagnitudeGraph {...graphProps} />
</div> </div>
)} )}
{(graphView === 'both' || graphView === 'phase') && <PhaseGraph {...graphProps} />} {(shownGraph === 'both' || shownGraph === 'phase') && <PhaseGraph {...graphProps} />}
{ActivePeq.bypass && ( {ActivePeq.bypass && (
<div className="channel-bypass-overlay"> <div className="channel-bypass-overlay">
@@ -621,6 +688,8 @@ function ChannelSection({
<div className="channel-control-section"> <div className="channel-control-section">
<div className="channel-control-panel"> <div className="channel-control-panel">
<ChannelGroup title="PEQ"> <ChannelGroup title="PEQ">
{/* display: contents on desktop; a row (landscape) / column (portrait) on phones */}
<div className="peq-block">
<PeqBandList <PeqBandList
bands={ActivePeq.bands} bands={ActivePeq.bands}
liveBands={livePeq} liveBands={livePeq}
@@ -636,6 +705,7 @@ function ChannelSection({
} }
onLiveValue={(value) => handleLivePEQValue(activeBand, value)} onLiveValue={(value) => handleLivePEQValue(activeBand, value)}
/> />
</div>
</ChannelGroup> </ChannelGroup>
<ChannelGroup title="CrossOver"> <ChannelGroup title="CrossOver">
@@ -663,6 +733,7 @@ function ChannelSection({
</ChannelGroup> </ChannelGroup>
</div> </div>
</div> </div>
</div>
{isResetConfirmOpen && ( {isResetConfirmOpen && (
<div className="confirm-modal-overlay" onClick={() => setIsResetConfirmOpen(false)}> <div className="confirm-modal-overlay" onClick={() => setIsResetConfirmOpen(false)}>