From 33100d2ecfed9b8cd50ce3d2dbaeabf12eeebcc6 Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Tue, 11 Aug 2026 19:44:23 -0700 Subject: [PATCH] refactor(studio): lift audioFxSummary out of PropertyPanelFlat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `PropertyPanelFlat.tsx` is 612 lines here against the repo's 600-line cap, so the required File size check is red — the sole reason this PR is blocked. The review says as much: "mechanical fix (~5 min), not a design problem. Code itself is LGTM." Moves `audioFxSummary` to `audioFxSummary.ts`, the same file a later branch creates for it. Deliberately the smallest cut that clears the cap rather than the whole `AudioFxGroup` extraction: every later commit in the stack edits AudioFxGroup, so moving it here would collide with each of them, while almost nothing touches this function. 595 lines. --- .../components/editor/PropertyPanelFlat.tsx | 19 +------------ .../src/components/editor/audioFxSummary.ts | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 packages/studio/src/components/editor/audioFxSummary.ts diff --git a/packages/studio/src/components/editor/PropertyPanelFlat.tsx b/packages/studio/src/components/editor/PropertyPanelFlat.tsx index 6be33840de..7ecc0a4278 100644 --- a/packages/studio/src/components/editor/PropertyPanelFlat.tsx +++ b/packages/studio/src/components/editor/PropertyPanelFlat.tsx @@ -24,6 +24,7 @@ import { normalizeCarveSettings, type HfCarveSettings, } from "@hyperframes/core/audio-carve"; +import { audioFxSummary } from "./audioFxSummary"; import { FlatMediaSection } from "./propertyPanelFlatMediaSection"; import type { DomEditSelection } from "./domEditing"; import { FxSection, type AudioTrackOption } from "./propertyPanelFxSection"; @@ -536,24 +537,6 @@ export function PropertyPanelFlat({ ); } -/** Chain length at a glance, so the collapsed group says whether anything is on. */ -function audioFxSummary(element: DomEditSelection): string { - const raw = element.dataAttributes?.["fx-chain"]; - const carve = element.dataAttributes?.["fx-carve"]; - let count = 0; - if (raw) { - try { - count = parseAudioFxChain(raw).nodes.filter((n) => n.enabled !== false).length; - } catch { - return "unreadable"; - } - } - const parts: string[] = []; - if (count > 0) parts.push(`${count} effect${count === 1 ? "" : "s"}`); - if (carve) parts.push("carve"); - return parts.length > 0 ? parts.join(" + ") : "none"; -} - /** * Bridges the FX panel to the element/attribute world. Chain and carve are * serialised onto the element the way colour grading carries its config, so diff --git a/packages/studio/src/components/editor/audioFxSummary.ts b/packages/studio/src/components/editor/audioFxSummary.ts new file mode 100644 index 0000000000..9accb8cfad --- /dev/null +++ b/packages/studio/src/components/editor/audioFxSummary.ts @@ -0,0 +1,27 @@ +/** + * What the collapsed Audio FX group says it holds. + * + * Its own module because `PropertyPanelFlat.tsx` is at the repo's 600-line + * budget, and this is the piece with no dependency on the panel around it. + */ + +import { parseAudioFxChain } from "@hyperframes/core/audio-fx"; +import type { DomEditSelection } from "./domEditing"; + +/** Chain length at a glance, so the collapsed group says whether anything is on. */ +export function audioFxSummary(element: DomEditSelection): string { + const raw = element.dataAttributes?.["fx-chain"]; + const carve = element.dataAttributes?.["fx-carve"]; + let count = 0; + if (raw) { + try { + count = parseAudioFxChain(raw).nodes.filter((n) => n.enabled !== false).length; + } catch { + return "unreadable"; + } + } + const parts: string[] = []; + if (count > 0) parts.push(`${count} effect${count === 1 ? "" : "s"}`); + if (carve) parts.push("carve"); + return parts.length > 0 ? parts.join(" + ") : "none"; +}