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"; +}