feat: group gain + scale logo

This commit is contained in:
2026-07-23 14:12:11 +02:00
parent a77c0668aa
commit 4c146902e3
18 changed files with 440 additions and 256 deletions
@@ -0,0 +1,43 @@
.channel-group {
position: relative;
height: calc(100% - var(--space-1) - var(--space-1));
flex: 0 0 auto;
display: flex;
align-items: flex-end;
border: 1px solid var(--border-hairline);
border-radius: var(--radius-md);
/* enough top padding to fully clear the label's own height, not just its border-overlap */
padding: calc(1.2vh + var(--space-3)) var(--space-3) 0;
margin-bottom: var(--space-1);
margin-top: var(--space-1);
box-sizing: border-box;
overflow: visible; /* in case something upstream set hidden */
}
.channel-group__label {
position: absolute;
top: var(--space-2); /* sits inside the padded space, not straddling the border */
left: 50%;
transform: translateX(-50%); /* only horizontal centering now — no vertical overlap */
padding: 0 var(--space-2);
font-family: var(--font-ui);
font-size: var(--tab-close-font);
font-weight: 600;
color: var(--text-muted);
white-space: nowrap;
line-height: 1;
}
.channel-group__items {
display: flex;
flex-direction: row;
align-items: stretch;
height: 100%;
gap: var(--space-4);
}
@@ -0,0 +1,13 @@
// ChannelGroup.tsx
import './ChannelGroup.css';
function ChannelGroup({ title, children }: { title: string; children: React.ReactNode }) {
return (
<div className="channel-group">
<div className="channel-group__label">{title}</div>
<div className="channel-group__items">{children}</div>
</div>
);
}
export default ChannelGroup;
@@ -14,6 +14,13 @@
position: relative;
}
.panel-type {
margin-top: var(--space-1);
font-size: 12px;
color: var(--text-muted);
font-family: var(--font-mono);
letter-spacing: 0.03em;
}
.panel-header {
display: flex;
@@ -32,6 +39,9 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
font-size: 18px;
font-weight: 600;
}
.mono {
@@ -48,15 +58,15 @@
position: absolute;
right: 16px;
bottom: 16px;
margin: 0; /* drop margin-top: auto, no longer needed */
padding: 0; /* drop padding-top: 16px, spacing now handled by right/bottom offsets */
margin: 0; /* drop margin-top: auto, no longer needed */
padding: 0; /* drop padding-top: 16px, spacing now handled by right/bottom offsets */
}
.connection-section {
position: absolute; /* was: fixed — relative to .dsp-content now */
inset: 0; /* replaces top:0; right:0; bottom:0; left:0 */
position: absolute; /* was: fixed — relative to .dsp-content now */
inset: 0; /* replaces top:0; right:0; bottom:0; left:0 */
display: flex;
justify-content: center;
align-items: center;
}
}
@@ -27,71 +27,77 @@ function ConnectionPanel({
: 'Disconnected';
return (
<div className='connection-section'>
<div
className="connection-panel-frame"
style={{ '--panel-w': DESIGN_WIDTH, '--panel-h': DESIGN_HEIGHT } as React.CSSProperties}
>
<AutoScale designWidth={DESIGN_WIDTH} designHeight={DESIGN_HEIGHT}>
<div className="card panel" style={{ width: DESIGN_WIDTH, height: DESIGN_HEIGHT }}>
<div className="panel-header">
<div className="panel-header-text">
<h1 className="panel-title" title={dsp.name}>
{dsp.name}
</h1>
<div className="panel-type">{dsp.type}</div>
<div className="connection-section">
<div
className="connection-panel-frame"
style={{ '--panel-w': DESIGN_WIDTH, '--panel-h': DESIGN_HEIGHT } as React.CSSProperties}
>
<AutoScale designWidth={DESIGN_WIDTH} designHeight={DESIGN_HEIGHT}>
<div className="card panel" style={{ width: DESIGN_WIDTH, height: DESIGN_HEIGHT }}>
<div className="panel-header">
<div className="panel-header-text">
<h1 className="panel-title" title={dsp.name}>
{dsp.name}
</h1>
<div className="panel-type">{dsp.type}</div>
</div>
<div className="status-block">
<span className={`led led--lg led--${dsp.status}`} />
<span className={`status-label status-label--${dsp.status}`}>{statusLabel}</span>
</div>
</div>
<div className="status-block">
<span className={`led led--lg led--${dsp.status}`} />
<span className={`status-label status-label--${dsp.status}`}>{statusLabel}</span>
<dl className="specs">
<div className="spec">
<dt>IP address</dt>
<dd className="mono" title={dsp.ip}>
{dsp.ip}
</dd>
</div>
<div className="spec">
<dt>Port</dt>
<dd className="mono">{dsp.port}</dd>
</div>
<div className="spec">
<dt>Device ID</dt>
<dd className="mono" title={dsp.deviceId || undefined}>
{dsp.deviceId || '—'}
</dd>
</div>
</dl>
<div className="panel-actions">
{dsp.status === 'connected' ? (
<Button
variant="outline"
designWidth={BTN_W}
designHeight={BTN_H}
scale={false}
onClick={onDisconnect}
>
Disconnect
</Button>
) : (
<Button
variant="primary"
designWidth={BTN_W}
designHeight={BTN_H}
scale={false}
onClick={onConnect}
disabled={dsp.status === 'connecting'}
>
{dsp.status === 'connecting' ? 'Connecting…' : 'Connect'}
</Button>
)}
</div>
</div>
<dl className="specs">
<div className="spec">
<dt>IP address</dt>
<dd className="mono" title={dsp.ip}>
{dsp.ip}
</dd>
</div>
<div className="spec">
<dt>Port</dt>
<dd className="mono">{dsp.port}</dd>
</div>
<div className="spec">
<dt>Device ID</dt>
<dd className="mono" title={dsp.deviceId || undefined}>
{dsp.deviceId || '—'}
</dd>
</div>
</dl>
<div className="panel-actions">
{dsp.status === 'connected' ? (
<Button variant="outline" designWidth={BTN_W} designHeight={BTN_H} scale={false} onClick={onDisconnect}>
Disconnect
</Button>
) : (
<Button
variant="primary"
designWidth={BTN_W}
designHeight={BTN_H}
scale={false}
onClick={onConnect}
disabled={dsp.status === 'connecting'}
>
{dsp.status === 'connecting' ? 'Connecting…' : 'Connect'}
</Button>
)}
</div>
</div>
</AutoScale>
</div>
</AutoScale>
</div>
</div>
);
}
export default ConnectionPanel;
export default ConnectionPanel;
@@ -1,10 +1,6 @@
:root {
--gain-section-height: 40vh;
}
.gain-section {
position: absolute; /* was: fixed — now relative to .dsp-content, which is the fixed+inset parent */
left: 0; /* was: var(--sidebar-width-collapsed) — .dsp-content already excludes the sidebar */
position: absolute; /* was: fixed — now relative to .dsp-content, which is the fixed+inset parent */
left: 0; /* was: var(--sidebar-width-collapsed) — .dsp-content already excludes the sidebar */
right: 0;
bottom: 0;
@@ -42,7 +38,7 @@
.gain-panel-frame {
flex: 0 0 auto;
height: calc(100% - 8px);
aspect-ratio: var(--panel-w) / var(--panel-h); /* now driven by JS, not duplicated */
aspect-ratio: var(--panel-w) / var(--panel-h); /* now driven by JS, not duplicated */
margin: 4px 0;
box-sizing: border-box;
}
@@ -6,6 +6,7 @@ import { NotificationType } from '../../../types/types';
import { useState } from 'react';
import Button from '../../Button/Button';
import AutoScale from '../../AutoScale/AutoScale';
import ChannelGroup from '../ChannelGroup/ChannelGroup';
import './GainSection.css';
const DESIGN_WIDTH = 90;
@@ -139,12 +140,14 @@ function GainSection({
dsp: DSP;
notify: (message: string, type?: NotificationType, dspName?: string) => void;
}) {
const channels: { channel: Channel; title: string }[] = [
const inputs: { channel: Channel; title: string }[] = [
{ channel: { Input: InputChannel.InA }, title: 'In A' },
{ channel: { Input: InputChannel.InB }, title: 'In B' },
{ channel: { Input: InputChannel.InC }, title: 'In C' },
{ channel: { Input: InputChannel.InD }, title: 'In D' },
];
const outputs: { channel: Channel; title: string }[] = [
{ channel: { Output: OutputChannel.Out1 }, title: 'Out 1' },
{ channel: { Output: OutputChannel.Out2 }, title: 'Out 2' },
{ channel: { Output: OutputChannel.Out3 }, title: 'Out 3' },
@@ -158,9 +161,17 @@ function GainSection({
return (
<div className="gain-section">
<div className="gain-panels">
{channels.map(({ channel, title }) => (
<GainPanel key={title} dsp={dsp} notify={notify} channel={channel} title={title} />
))}
<ChannelGroup title="Input">
{inputs.map(({ channel, title }) => (
<GainPanel key={title} dsp={dsp} notify={notify} channel={channel} title={title} />
))}
</ChannelGroup>
<ChannelGroup title="Output">
{outputs.map(({ channel, title }) => (
<GainPanel key={title} dsp={dsp} notify={notify} channel={channel} title={title} />
))}
</ChannelGroup>
</div>
</div>
);