feat: matrix section for mobile
This commit is contained in:
@@ -1,4 +1,18 @@
|
||||
/* MatrixSection.css */
|
||||
/* Matrixsection.css (imported as './Matrixsection.css') */
|
||||
|
||||
/* ---------- Page wrapper ---------- */
|
||||
|
||||
.matrix-page {
|
||||
display: contents; /* invisible on desktop; a flex column on phones */
|
||||
}
|
||||
|
||||
.matrix-tabs,
|
||||
.matrix-rotate-hint {
|
||||
display: none; /* phones only */
|
||||
}
|
||||
|
||||
/* ---------- Routing strip ---------- */
|
||||
|
||||
.matrix-section {
|
||||
container-type: size;
|
||||
position: absolute;
|
||||
@@ -96,6 +110,19 @@
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.matrix-gain-stepper .choice-stepper__input {
|
||||
font-size: 2.8cqh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.matrix-gain-stepper .choice-stepper__arrows {
|
||||
flex: 0 0 20%;
|
||||
width: 20%;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
/* ---------- Signal flow ---------- */
|
||||
|
||||
.matrix-flow {
|
||||
flex: 0 0 calc(100% - var(--dsp-control-heigth));
|
||||
min-height: 0;
|
||||
@@ -107,13 +134,291 @@
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.matrix-gain-stepper .choice-stepper__input {
|
||||
font-size: 2.8cqh;
|
||||
text-align: center;
|
||||
/* ---------- Phone (shared) ----------
|
||||
Landscape: tabs (Routing / Signal flow), one view at a time.
|
||||
Portrait: routing only + a hint to rotate for the signal flow. */
|
||||
|
||||
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
|
||||
.matrix-page {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-panel);
|
||||
}
|
||||
|
||||
.matrix-gain-stepper .choice-stepper__arrows {
|
||||
flex: 0 0 20%;
|
||||
width: 20%;
|
||||
padding-right: 0;
|
||||
/* ----- Tabs ----- */
|
||||
|
||||
.matrix-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);
|
||||
}
|
||||
|
||||
.matrix-page .matrix-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;
|
||||
}
|
||||
|
||||
.matrix-page .matrix-tabs__tab[aria-selected='true'] {
|
||||
background: var(--bg-raised);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--accent-brand);
|
||||
}
|
||||
|
||||
/* ----- Which view is visible ----- */
|
||||
|
||||
.matrix-page[data-view='controls'] .matrix-flow,
|
||||
.matrix-page[data-view='flow'] .matrix-section {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ----- Flow view: fills everything ----- */
|
||||
|
||||
.matrix-flow {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
padding: var(--space-1);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* ----- Routing view: strips, swipe sideways, snap per panel ----- */
|
||||
|
||||
.matrix-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;
|
||||
}
|
||||
|
||||
.matrix-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;
|
||||
}
|
||||
|
||||
/* The group is as wide as its strips (never shrunk to the viewport),
|
||||
so .matrix-panels is the only thing that scrolls. */
|
||||
.matrix-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;
|
||||
}
|
||||
|
||||
.matrix-section .channel-group__label {
|
||||
top: 7px;
|
||||
font-size: var(--font-sm);
|
||||
}
|
||||
|
||||
.matrix-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 .matrix-panels */
|
||||
}
|
||||
|
||||
/* Centered when everything fits, left-aligned and scrollable when it doesn't */
|
||||
.matrix-panels > .channel-group:first-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.matrix-panels > .channel-group:last-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* One strip per output: 4 rows of [input button | gain stepper] */
|
||||
.matrix-panel {
|
||||
flex: 0 0 auto;
|
||||
width: clamp(180px, 26vw, 220px);
|
||||
height: auto; /* stretches to the row */
|
||||
aspect-ratio: auto;
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
|
||||
.matrix-panel__title {
|
||||
padding-block: var(--space-1);
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
.matrix-panel__rows {
|
||||
gap: var(--space-1);
|
||||
padding: var(--space-1);
|
||||
}
|
||||
|
||||
.matrix-panel__row {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
|
||||
gap: var(--space-1);
|
||||
padding-inline: 0;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Input toggle: fixed readable size, overrides the desktop inline cqh styles */
|
||||
.matrix-panel .matrix-panel__btn {
|
||||
width: 100%;
|
||||
height: 36px !important;
|
||||
min-height: 0 !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
font-size: 11px !important;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.matrix-panel__row .choice-stepper {
|
||||
aspect-ratio: auto;
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.matrix-gain-stepper .choice-stepper__input {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Portrait phone: routing only, 8 panels in 2 rows ---------- */
|
||||
|
||||
@media (max-width: 768px) and (orientation: portrait) {
|
||||
.matrix-tabs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.matrix-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;
|
||||
color: var(--text-muted);
|
||||
|
||||
border-bottom: var(--border-width) solid var(--border-hairline);
|
||||
}
|
||||
|
||||
/* Whatever tab was active in landscape, portrait always shows the routing */
|
||||
.matrix-page[data-view] .matrix-flow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.matrix-page[data-view] .matrix-section {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Swipe sideways: both rows move together (Out1-4 on top, Out5-8 below) */
|
||||
.matrix-panels {
|
||||
padding: var(--space-1);
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.matrix-section .channel-group {
|
||||
padding: 28px var(--space-1) var(--space-1);
|
||||
}
|
||||
|
||||
.matrix-section .channel-group__label {
|
||||
top: 6px;
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
.matrix-section .channel-group__items {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, clamp(170px, 50vw, 210px));
|
||||
grid-template-rows: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.matrix-panel {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.matrix-panel__title {
|
||||
padding-block: 4px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.matrix-panel__rows {
|
||||
grid-template-rows: repeat(4, minmax(0, 1fr));
|
||||
gap: 2px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.matrix-panel .matrix-panel__btn {
|
||||
height: min(36px, 100%) !important;
|
||||
}
|
||||
|
||||
.matrix-panel__row .choice-stepper {
|
||||
height: min(36px, 100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Landscape phone: thinner strips ---------- */
|
||||
|
||||
@media (max-height: 500px) and (pointer: coarse) {
|
||||
.matrix-panels {
|
||||
padding: var(--space-1) var(--space-2);
|
||||
}
|
||||
|
||||
.matrix-section .channel-group {
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.matrix-section .channel-group__label {
|
||||
top: 4px;
|
||||
font-size: var(--font-xs);
|
||||
}
|
||||
|
||||
.matrix-panel {
|
||||
width: clamp(170px, 24vw, 210px);
|
||||
}
|
||||
|
||||
.matrix-panel__title {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,14 @@ const GAIN_VALUES: number[] = (() => {
|
||||
return values;
|
||||
})();
|
||||
|
||||
// Phone only: one view at a time (CSS hides the tabs on desktop)
|
||||
type MatrixView = 'controls' | 'flow';
|
||||
|
||||
const MATRIX_VIEWS: { id: MatrixView; label: string }[] = [
|
||||
{ id: 'controls', label: 'Routing' },
|
||||
{ id: 'flow', label: 'Signal flow' },
|
||||
];
|
||||
|
||||
function getMatrixRoutes(dsp: DSP, output: OutputChannel): MatrixRoutes {
|
||||
return dsp.state.current_config.output_states[output].matrix_routes;
|
||||
}
|
||||
@@ -61,6 +69,8 @@ function MatrixSection({
|
||||
) => Promise<boolean>;
|
||||
setActiveSidebar: React.Dispatch<React.SetStateAction<SidebarId>>;
|
||||
}) {
|
||||
const [view, setView] = useState<MatrixView>('controls');
|
||||
|
||||
const handleToggle = (output: OutputChannel, input: InputChannel) => {
|
||||
const current = getRoutedInputs(dsp, output);
|
||||
|
||||
@@ -91,7 +101,28 @@ function MatrixSection({
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="matrix-page" data-view={view}>
|
||||
{/* Phone only (hidden on desktop by CSS): one view at a time */}
|
||||
<div className="matrix-tabs" role="tablist" aria-label="Matrix views">
|
||||
{MATRIX_VIEWS.map((v) => (
|
||||
<button
|
||||
key={v.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={view === v.id}
|
||||
className="matrix-tabs__tab"
|
||||
onClick={() => setView(v.id)}
|
||||
>
|
||||
{v.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Portrait phone only (CSS): the signal flow needs the width of landscape */}
|
||||
<div className="matrix-rotate-hint">
|
||||
Rotate your phone to landscape to see the signal flow.
|
||||
</div>
|
||||
|
||||
<div className="matrix-flow">
|
||||
<SignalFlowMatrix
|
||||
dsp={dsp}
|
||||
@@ -119,7 +150,7 @@ function MatrixSection({
|
||||
<div className="matrix-panel__row" key={String(input)}>
|
||||
<Button
|
||||
variant="toggle"
|
||||
className={connected ? 'active-info' : ''}
|
||||
className={`matrix-panel__btn${connected ? ' active-info' : ''}`}
|
||||
style={{
|
||||
fontSize: '4cqh',
|
||||
padding: 0,
|
||||
@@ -148,7 +179,7 @@ function MatrixSection({
|
||||
</ChannelGroup>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user