Skip to content

The VS Code of video editing, built for agents.

TypeScript

Refactor soundboard layout and styling for improved responsiveness

konstantin-paulus24ed4435e03f
diff --git a/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx b/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx
index 00584e2e..8a4cdee0 100644
--- a/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx
+++ b/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx
@@ -122,7 +122,7 @@ export function Soundboard() {
const layerName = (eid: number) => c.Name[eid] ?? `Layer ${eid}`;
return (
- <div class="flex items-stretch h-full w-full justify-between px-4 pt-4 pb-1">
+ <div class="soundboard flex items-stretch h-full w-full justify-between px-4 pt-4 pb-1">
<div class="flex flex-col items-center h-full gap-2">
<div class="flex flex-1 min-h-0">
<VolumeControl
diff --git a/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx b/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx
index e3428dcd..64b05a50 100644
--- a/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx
+++ b/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx
@@ -188,7 +188,7 @@ export function VolumeControl(props: VolumeControlProps) {
return (
<div
ref={trackRef}
- class="relative w-3 h-full mr-3 flex flex-col justify-between items-end"
+ class="soundboard-ticks relative w-3 h-full mr-3 flex flex-col justify-between items-end"
classList={{ 'opacity-50 pointer-events-none': props.disabled }}
onPointerDown={handlePointerDown}
>
@@ -198,7 +198,7 @@ export function VolumeControl(props: VolumeControlProps) {
return (
<div
- class="h-px pointer-events-none"
+ class="soundboard-tick h-px pointer-events-none"
classList={{
'bg-muted-foreground': isMajor,
'bg-muted-foreground/70': !isMajor,
@@ -221,7 +221,7 @@ export function VolumeControl(props: VolumeControlProps) {
export function MeterScale() {
return (
- <div class="relative flex flex-col justify-between h-full ml-1">
+ <div class="soundboard-scale relative flex flex-col justify-between h-full ml-1">
<For each={SCALE_LABELS}>
{(label) => {
const needsPad = !label.startsWith('-');
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index bfba856b..45301cb9 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -290,3 +290,43 @@
display: flex;
}
}
+
+/**
+ * The soundboard is as tall as the timeline the user drags, not as tall as the
+ * viewport, so its scale thins itself out against its own box. Both columns are
+ * laid out with justify-between, so hiding an element re-spreads the rest —
+ * dropping a label and its major tick together keeps the two lined up.
+ *
+ * Heights below are the soundboard's content box; the meters themselves sit
+ * 32px shorter than that (row gap + the layer picker underneath).
+ */
+.soundboard {
+ container: soundboard / size;
+}
+
+/* Halve the minor ticks — the labels still have room at this height. */
+@container soundboard (max-height: 188px) {
+ .soundboard-tick:nth-child(even) {
+ display: none;
+ }
+}
+
+/**
+ * Halve the scale itself. Majors sit at 4n+1 of the 21 ticks, so keeping
+ * 6n+1 plus the last one leaves major-minor-major-minor-major: three majors for
+ * the three surviving labels, still with a minor between each pair.
+ */
+@container soundboard (max-height: 167px) {
+ .soundboard-tick {
+ display: none;
+ }
+
+ .soundboard-tick:nth-child(6n + 1),
+ .soundboard-tick:nth-last-child(2) {
+ display: block;
+ }
+
+ .soundboard-scale > span:nth-child(even) {
+ display: none;
+ }
+}