feat: misc section for mobile

This commit is contained in:
Lucas
2026-10-30 15:25:12 +01:00
parent 51c0c44ded
commit f78d872625
5 changed files with 387 additions and 30 deletions
@@ -137,20 +137,92 @@
margin-top: var(--space-2); margin-top: var(--space-2);
} }
/* Mobile */ /* ---------- Phone (shared) ---------- */
@media (max-width: 600px) { @media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
.copy-channel-overlay {
padding: var(--space-2);
box-sizing: border-box;
}
.copy-channel-modal {
--card-control-height: 44px;
width: 100%;
max-width: 440px;
max-height: calc(100dvh - var(--space-4));
box-sizing: border-box;
overflow-x: hidden;
overflow-y: auto;
}
/* From / arrow / To stacked */
.copy-channel-modal__transfer { .copy-channel-modal__transfer {
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
gap: var(--space-2);
} }
.copy-channel-modal__arrow { .copy-channel-modal__arrow {
width: 100%;
height: auto;
}
/* Rotate the SVG only, so the container keeps a sensible size */
.copy-channel-modal__arrow svg {
transform: rotate(90deg); transform: rotate(90deg);
} }
.copy-channel-modal__actions { .copy-channel-modal__actions {
justify-content: flex-start; flex-direction: column-reverse;
flex-wrap: wrap; align-items: stretch;
gap: var(--space-2);
}
.copy-channel-modal__actions > * {
width: 100%;
}
}
/* ---------- Landscape phone: From -> To on one row ---------- */
@media (max-height: 500px) and (pointer: coarse) {
.copy-channel-modal {
--card-control-height: 36px;
}
.copy-channel-modal__transfer {
flex-direction: row;
align-items: flex-end;
gap: var(--space-3);
}
.copy-channel-modal__arrow {
width: auto;
height: var(--card-control-height);
}
.copy-channel-modal__arrow svg {
transform: none;
}
.copy-channel-modal__actions {
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.copy-channel-modal__actions > * {
width: auto;
}
}
@keyframes copy-channel-slide-up {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
} }
} }
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { createPortal } from 'react-dom';
import { Channel, InputChannel, OutputChannel } from '../../types'; import { Channel, InputChannel, OutputChannel } from '../../types';
import Button from '../../../../components/Button/Button'; import Button from '../../../../components/Button/Button';
@@ -70,7 +71,7 @@ function CopyChannelModal({
} }
}; };
return ( return createPortal(
<div <div
className="copy-channel-overlay" className="copy-channel-overlay"
onMouseDown={(e) => { onMouseDown={(e) => {
@@ -138,7 +139,8 @@ function CopyChannelModal({
</Button> </Button>
</div> </div>
</Card> </Card>
</div> </div>,
document.body
); );
} }
@@ -223,15 +223,174 @@
margin-top: var(--space-2); margin-top: var(--space-2);
} }
/* Mobile */ /* ---------- Phone (shared) ---------- */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
.link-channels-overlay {
padding: var(--space-2);
box-sizing: border-box;
}
.link-channels-modal {
--card-control-height: 44px;
width: 100%;
max-width: 480px;
max-height: calc(100dvh - var(--space-4));
box-sizing: border-box;
overflow-x: hidden;
overflow-y: auto;
}
.link-channels-modal__mode-toggle {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
box-sizing: border-box;
}
/* Same specificity as the base rule, so it can't be beaten by a global touch rule */
.link-channels-modal .link-channels-modal__mode-btn {
flex: none;
height: 100%;
min-height: 0;
padding: 0 var(--space-2);
font-size: var(--font-sm);
border-width: var(--border-width);
-webkit-appearance: none;
appearance: none;
}
.link-channels-modal__mode-btn {
flex: 1;
}
/* Matrix: "Out1".."Out8" at --font-sm needs ~310px, so smaller labels and gaps */
.link-matrix {
gap: 2px;
width: 100%;
box-sizing: border-box;
}
.link-matrix__col-label,
.link-matrix__row-label {
min-width: 0;
font-size: 10px;
letter-spacing: -0.02em;
}
.link-matrix__row-label {
padding-right: var(--space-1);
}
@media (max-width: 600px) {
.link-matrix__cell { .link-matrix__cell {
min-width: 26px; position: relative;
width: 100%;
max-width: 32px;
height: auto;
min-width: 0;
aspect-ratio: 1 / 1;
}
/* Bigger invisible tap area, same visual size */
.link-matrix__cell--toggle::after {
content: '';
position: absolute;
inset: -2px;
}
/* No sticky hover state on touch */
.link-matrix__cell--toggle:hover {
border-color: var(--border-hairline);
}
.link-matrix__cell--toggle.is-active:hover {
border-color: var(--accent-brand);
} }
.link-channels-modal__actions { .link-channels-modal__actions {
justify-content: flex-start; flex-direction: column-reverse;
flex-wrap: wrap; align-items: stretch;
gap: var(--space-2);
}
.link-channels-modal__actions > * {
width: 100%;
}
}
/* ---------- Landscape phone: controls left, matrix right ---------- */
@media (max-height: 500px) and (pointer: coarse) {
.link-channels-modal {
--card-control-height: 34px;
max-width: 640px;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
grid-template-rows: auto auto 1fr;
grid-template-areas:
'header matrix'
'toggle matrix'
'actions matrix';
column-gap: var(--space-4);
align-items: start;
}
.link-channels-modal__header {
grid-area: header;
margin-bottom: var(--space-2);
}
.link-channels-modal__mode-toggle {
grid-area: toggle;
margin-bottom: 0;
}
.link-matrix {
grid-area: matrix;
align-self: center;
justify-self: center;
display: grid;
grid-auto-rows: 22px;
align-content: center;
width: max-content;
min-width: calc(38px + (8 * 22px) + (8 * 3px));
min-height: calc(9 * 22px + 8 * 3px);
gap: 3px;
box-sizing: border-box;
}
.link-matrix__cell {
width: 22px;
height: 16px;
min-height: 0;
aspect-ratio: auto;
align-self: center;
}
.link-channels-modal__actions {
grid-area: actions;
align-self: end;
flex-direction: row;
justify-content: flex-end;
}
.link-channels-modal__actions > * {
width: auto;
}
}
@keyframes link-channels-slide-up {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
} }
} }
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import { DSP408 } from '../../../../types'; import { DSP408 } from '../../../../types';
import { Channel, InputChannel, OutputChannel } from '../../types'; import { Channel, InputChannel, OutputChannel } from '../../types';
@@ -244,7 +245,7 @@ function LinkChannelsModal({
} }
}; };
return ( return createPortal(
<div <div
className="link-channels-overlay" className="link-channels-overlay"
onMouseDown={(e) => { onMouseDown={(e) => {
@@ -286,7 +287,9 @@ function LinkChannelsModal({
<div <div
className="link-matrix" className="link-matrix"
style={{ gridTemplateColumns: `auto repeat(${channels.length}, 1fr)` }} style={{
gridTemplateColumns: `minmax(38px, auto) repeat(${channels.length}, minmax(28px, 1fr))`,
}}
> >
<div className="link-matrix__corner" /> <div className="link-matrix__corner" />
@@ -361,7 +364,8 @@ function LinkChannelsModal({
</Button> </Button>
</div> </div>
</Card> </Card>
</div> </div>,
document.body
); );
} }
@@ -178,21 +178,6 @@
height: 65%; height: 65%;
} }
/* Mobile */
@media (max-width: 600px) {
.miscellaneous-panel__row {
flex-direction: column;
}
.miscellaneous-panel__actions {
justify-content: flex-start;
flex-wrap: wrap;
}
}
.miscellaneous-panel { .miscellaneous-panel {
user-select: none; user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
@@ -247,4 +232,139 @@
margin-top: var(--space-5); margin-top: var(--space-5);
} }
/* ---------- Phone (shared) ---------- */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
/* Scrolls when the content is taller than the screen */
.miscellaneous-section {
height: 100%;
min-height: 0;
padding: var(--space-3);
box-sizing: border-box;
overflow-x: hidden;
overflow-y: auto;
}
/* margin: auto centers both ways when it fits, and starts at the top
(no clipping) when it doesn't. align-items: center can't do that. */
.miscellaneous-panel {
--card-control-height: 44px;
width: 100%;
max-width: 720px;
margin: auto;
box-sizing: border-box;
}
.miscellaneous-panel__section-header {
flex-direction: column;
align-items: flex-start;
gap: var(--space-1);
}
.miscellaneous-panel__row {
flex-direction: column;
gap: var(--space-2);
}
/* 16px stops iOS Safari from zooming on focus */
.miscellaneous-panel__field input {
width: 100%;
box-sizing: border-box;
font-size: 16px;
}
.miscellaneous-panel__password-toggle {
right: 0;
width: 44px;
}
.miscellaneous-panel__actions {
flex-direction: column;
align-items: stretch;
gap: var(--space-2);
}
.miscellaneous-panel__actions > * {
width: 100%;
}
.miscellaneous-panel__section--danger .miscellaneous-panel__section-header p {
max-width: none;
}
/* Confirm modal: still centered, the margin lives on the overlay */
.confirm-modal-overlay {
padding: var(--space-3);
box-sizing: border-box;
}
.confirm-modal {
width: 100%;
max-width: 400px;
max-height: 100%;
margin: 0;
box-sizing: border-box;
overflow-y: auto;
}
.confirm-modal__actions {
flex-direction: column-reverse; /* primary action on top */
gap: var(--space-2);
}
.confirm-modal__actions > * {
width: 100%;
}
}
/* ---------- Landscape phone ---------- */
@media (max-height: 500px) and (pointer: coarse) {
.miscellaneous-section {
padding: var(--space-2);
}
.miscellaneous-panel {
--card-control-height: 36px;
}
/* Title left, description right, wraps if it doesn't fit */
.miscellaneous-panel__section-header {
flex-direction: row;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 0 var(--space-3);
}
.miscellaneous-panel__section-header p {
flex: 1 1 200px;
min-width: 0;
text-align: right;
}
.miscellaneous-panel__row {
flex-direction: row;
gap: var(--space-3);
}
.miscellaneous-panel__actions {
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.miscellaneous-panel__actions > * {
width: auto;
}
.confirm-modal__actions {
flex-direction: row;
}
.confirm-modal__actions > * {
width: auto;
}
}