feat: geq section for mobile
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/* GeqSection.css */
|
||||
|
||||
/* ---------- Page wrapper ---------- */
|
||||
|
||||
.geq-page {
|
||||
display: contents; /* invisible on desktop; a flex column on phones */
|
||||
}
|
||||
|
||||
.geq-tabs,
|
||||
.geq-rotate-hint {
|
||||
display: none; /* phones only */
|
||||
}
|
||||
|
||||
/* ---------- Control strip ---------- */
|
||||
|
||||
.geq-section {
|
||||
container-type: size;
|
||||
|
||||
@@ -45,8 +60,6 @@
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
|
||||
/* padding: 2cqh 1.5cqh; */
|
||||
|
||||
border: var(--border-width) solid var(--border-hairline);
|
||||
border-radius: var(--radius-md);
|
||||
box-sizing: border-box;
|
||||
@@ -106,6 +119,8 @@
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* ---------- Graph ---------- */
|
||||
|
||||
.geq-linear-graph-section {
|
||||
flex: 0 0 calc(100% - var(--dsp-control-heigth));
|
||||
min-height: 0;
|
||||
@@ -175,3 +190,378 @@
|
||||
opacity: 0.85;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* ---------- Phone (shared) ----------
|
||||
Landscape: tabs (Faders / GEQ curve), one view at a time.
|
||||
Portrait: faders only + a hint to rotate for the graph. */
|
||||
|
||||
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
|
||||
.geq-page {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-panel);
|
||||
}
|
||||
|
||||
/* ----- Tabs ----- */
|
||||
|
||||
.geq-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);
|
||||
}
|
||||
|
||||
.geq-page .geq-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;
|
||||
}
|
||||
|
||||
.geq-page .geq-tabs__tab[aria-selected='true'] {
|
||||
background: var(--bg-raised);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--accent-brand);
|
||||
}
|
||||
|
||||
/* ----- Which view is visible ----- */
|
||||
|
||||
.geq-page[data-view='faders'] .geq-linear-graph-section,
|
||||
.geq-page[data-view='curve'] .geq-section {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ----- Curve view: graph fills everything ----- */
|
||||
|
||||
.geq-linear-graph-section {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
gap: 0;
|
||||
padding: var(--space-1);
|
||||
}
|
||||
|
||||
.geq-graph-panel {
|
||||
flex: 1 1 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.geq-graph-title {
|
||||
padding: var(--space-1);
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
/* ----- Faders view: [Input | Actions] then 31 bands, all in one sideways swipe ----- */
|
||||
|
||||
.geq-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;
|
||||
}
|
||||
|
||||
.geq-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;
|
||||
}
|
||||
|
||||
.geq-section .channel-group {
|
||||
flex: 0 0 auto;
|
||||
width: max-content;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
padding: 30px var(--space-2) var(--space-2);
|
||||
}
|
||||
|
||||
.geq-section .channel-group__label {
|
||||
top: 7px;
|
||||
font-size: var(--font-sm);
|
||||
}
|
||||
|
||||
.geq-section .channel-group__items {
|
||||
height: auto;
|
||||
align-self: stretch;
|
||||
justify-content: flex-start;
|
||||
overflow: visible; /* no nested scroller: it would fight with .geq-panels */
|
||||
}
|
||||
|
||||
/* Input selector + actions come first so they are always one swipe away */
|
||||
.geq-side-panels {
|
||||
order: -1;
|
||||
flex: 0 0 auto;
|
||||
height: auto;
|
||||
align-self: stretch;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.geq-side-panels > :first-child,
|
||||
.geq-side-panels > :last-child {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.geq-side-panels .channel-group {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Input: 2x2 buttons. Actions: Bypass above Reset. */
|
||||
.geq-channel-selector {
|
||||
width: 124px;
|
||||
height: auto;
|
||||
align-self: stretch;
|
||||
justify-content: center;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.geq-side-panels > :first-child .geq-channel-selector {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.geq-channel-selector .geq-btn {
|
||||
width: 100% !important;
|
||||
height: 34px !important;
|
||||
min-height: 0 !important;
|
||||
padding: 0 !important;
|
||||
font-size: 11px !important;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* The 31 bands: fixed width per band so they stay usable, the strip scrolls */
|
||||
.geq-band-panel {
|
||||
flex: 0 0 auto;
|
||||
width: calc(var(--geq-bands, 31) * 40px + 8px);
|
||||
height: auto; /* stretches to the row */
|
||||
aspect-ratio: auto;
|
||||
padding-block: var(--space-1);
|
||||
}
|
||||
|
||||
.geq-band-cell {
|
||||
flex: 0 0 40px;
|
||||
min-width: 40px;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.geq-band-cell__label {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
.geq-band-cell > :first-child,
|
||||
.geq-band-cell > :first-child * {
|
||||
touch-action: pan-x !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Portrait phone: buttons on top, bands in 2 rows below ---------- */
|
||||
|
||||
@media (max-width: 768px) and (orientation: portrait) {
|
||||
.geq-tabs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.geq-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 */
|
||||
.geq-page[data-view] .geq-linear-graph-section {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.geq-page[data-view] .geq-section {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Column: [Input | Actions] bar on top, bands below taking all the rest */
|
||||
.geq-panels {
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
overflow: hidden;
|
||||
scroll-snap-type: none;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
}
|
||||
|
||||
.geq-section .channel-group {
|
||||
padding: 24px var(--space-2) var(--space-2);
|
||||
}
|
||||
|
||||
.geq-section .channel-group__label {
|
||||
top: 5px;
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
/* ----- Buttons bar ----- */
|
||||
|
||||
.geq-side-panels {
|
||||
flex-direction: row;
|
||||
flex: 0 0 auto;
|
||||
align-self: stretch;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.geq-side-panels > :first-child {
|
||||
flex: 2 1 0;
|
||||
}
|
||||
|
||||
.geq-side-panels > :last-child {
|
||||
flex: 1 1 0;
|
||||
}
|
||||
|
||||
.geq-side-panels .channel-group {
|
||||
width: auto;
|
||||
height: auto;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.geq-side-panels .channel-group__items {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.geq-channel-selector {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
/* Input: 4 buttons in a row. Actions: Bypass | Reset in a row. */
|
||||
.geq-side-panels > :first-child .geq-channel-selector {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.geq-side-panels > :last-child .geq-channel-selector {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.geq-channel-selector .geq-btn {
|
||||
height: 40px !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
/* ----- Bands: 2 rows, both rows scroll together ----- */
|
||||
|
||||
.geq-panels > .channel-group {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.geq-panels > .channel-group .channel-group__items {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
scroll-snap-type: none;
|
||||
overscroll-behavior-x: contain;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* Bands 1-16 on the first row, 17-31 on the second: column N holds band N and N+16 */
|
||||
.geq-band-panel {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--geq-cols, 16), 40px);
|
||||
grid-template-rows: repeat(2, minmax(0, 1fr));
|
||||
grid-auto-flow: row;
|
||||
gap: var(--space-1) 0;
|
||||
|
||||
width: calc(var(--geq-cols, 16) * 40px + 8px);
|
||||
padding: var(--space-1);
|
||||
}
|
||||
|
||||
/* Each slider cell is its own size container: the slider's cqh sizes
|
||||
(thumb, track, readout) scale to this cell, i.e. about half the height. */
|
||||
.geq-band-cell {
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
container-type: size;
|
||||
|
||||
/* room for the thumb sticking out of the track at min/max */
|
||||
padding-block: 8px;
|
||||
box-sizing: border-box;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.geq-band-cell > :first-child {
|
||||
min-height: 0;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Landscape phone: thinner strips ---------- */
|
||||
|
||||
@media (max-height: 500px) and (pointer: coarse) {
|
||||
.geq-panels {
|
||||
padding: var(--space-1) var(--space-2);
|
||||
}
|
||||
|
||||
.geq-section .channel-group {
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.geq-section .channel-group__label {
|
||||
top: 4px;
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
.geq-channel-selector .geq-btn {
|
||||
height: 32px !important;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,14 @@ type SetGeqBandFn = (
|
||||
|
||||
type SetGeqBypassFn = (input: InputChannel, bypass: boolean) => Promise<boolean>;
|
||||
|
||||
// Phone only: one view at a time (CSS hides the tabs on desktop)
|
||||
type GeqView = 'faders' | 'curve';
|
||||
|
||||
const GEQ_VIEWS: { id: GeqView; label: string }[] = [
|
||||
{ id: 'faders', label: 'Faders' },
|
||||
{ id: 'curve', label: 'GEQ curve' },
|
||||
];
|
||||
|
||||
function GeqBandPanel({
|
||||
channel,
|
||||
dsp,
|
||||
@@ -39,7 +47,15 @@ function GeqBandPanel({
|
||||
const geq = inputState.geq;
|
||||
|
||||
return (
|
||||
<div className="geq-band-panel">
|
||||
<div
|
||||
className="geq-band-panel"
|
||||
style={
|
||||
{
|
||||
'--geq-bands': GEQ_BANDS_LABEL.length,
|
||||
'--geq-cols': Math.ceil(GEQ_BANDS_LABEL.length / 2),
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
{GEQ_BANDS_LABEL.map(({ frequency, label }) => (
|
||||
<div className="geq-band-cell" key={frequency}>
|
||||
<VerticalSlider
|
||||
@@ -76,7 +92,7 @@ function GeqChannelSelector({
|
||||
<Button
|
||||
key={c}
|
||||
variant="toggle"
|
||||
className={c === channel ? 'active-info' : ''}
|
||||
className={`geq-btn${c === channel ? ' active-info' : ''}`}
|
||||
onClick={() => onSelect(c)}
|
||||
style={{
|
||||
width: '100%',
|
||||
@@ -109,7 +125,7 @@ function GeqActions({
|
||||
<div className="geq-channel-selector">
|
||||
<Button
|
||||
variant="toggle"
|
||||
className={bypass ? 'active-warning' : ''}
|
||||
className={`geq-btn${bypass ? ' active-warning' : ''}`}
|
||||
onClick={onBypass}
|
||||
style={{
|
||||
width: '100%',
|
||||
@@ -125,6 +141,7 @@ function GeqActions({
|
||||
|
||||
<Button
|
||||
variant="toggle"
|
||||
className="geq-btn"
|
||||
onClick={onReset}
|
||||
disabled={resetting}
|
||||
style={{
|
||||
@@ -154,6 +171,7 @@ function GeqSection({
|
||||
const [liveGeq, setLiveGeq] = useState<Partial<Record<InputChannel, LiveBands>>>({});
|
||||
const [resetting, setResetting] = useState(false);
|
||||
const [isResetConfirmOpen, setIsResetConfirmOpen] = useState(false);
|
||||
const [view, setView] = useState<GeqView>('faders');
|
||||
|
||||
useEffect(() => {
|
||||
if (!isResetConfirmOpen) return;
|
||||
@@ -228,7 +246,26 @@ function GeqSection({
|
||||
}));
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="geq-page" data-view={view}>
|
||||
{/* Phone only (hidden on desktop by CSS): one view at a time */}
|
||||
<div className="geq-tabs" role="tablist" aria-label="GEQ views">
|
||||
{GEQ_VIEWS.map((v) => (
|
||||
<button
|
||||
key={v.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={view === v.id}
|
||||
className="geq-tabs__tab"
|
||||
onClick={() => setView(v.id)}
|
||||
>
|
||||
{v.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Portrait phone only (CSS): the graph needs the width of landscape */}
|
||||
<div className="geq-rotate-hint">Rotate your phone to landscape to see the GEQ graph.</div>
|
||||
|
||||
<div className="geq-linear-graph-section">
|
||||
<GeqGraph
|
||||
title={`${activeInputState.name} - GEQ`}
|
||||
@@ -290,8 +327,8 @@ function GeqSection({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default GeqSection;
|
||||
export default GeqSection;
|
||||
Reference in New Issue
Block a user