Skip to content

Commit 8eac905

Browse files
committed
refactor(studio): lift audioFxSummary out of PropertyPanelFlat
`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.
1 parent 1031190 commit 8eac905

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

packages/studio/src/components/editor/PropertyPanelFlat.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
normalizeCarveSettings,
2525
type HfCarveSettings,
2626
} from "@hyperframes/core/audio-carve";
27+
import { audioFxSummary } from "./audioFxSummary";
2728
import { FlatMediaSection } from "./propertyPanelFlatMediaSection";
2829
import type { DomEditSelection } from "./domEditing";
2930
import { FxSection, type AudioTrackOption } from "./propertyPanelFxSection";
@@ -536,24 +537,6 @@ export function PropertyPanelFlat({
536537
);
537538
}
538539

539-
/** Chain length at a glance, so the collapsed group says whether anything is on. */
540-
function audioFxSummary(element: DomEditSelection): string {
541-
const raw = element.dataAttributes?.["fx-chain"];
542-
const carve = element.dataAttributes?.["fx-carve"];
543-
let count = 0;
544-
if (raw) {
545-
try {
546-
count = parseAudioFxChain(raw).nodes.filter((n) => n.enabled !== false).length;
547-
} catch {
548-
return "unreadable";
549-
}
550-
}
551-
const parts: string[] = [];
552-
if (count > 0) parts.push(`${count} effect${count === 1 ? "" : "s"}`);
553-
if (carve) parts.push("carve");
554-
return parts.length > 0 ? parts.join(" + ") : "none";
555-
}
556-
557540
/**
558541
* Bridges the FX panel to the element/attribute world. Chain and carve are
559542
* serialised onto the element the way colour grading carries its config, so
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* What the collapsed Audio FX group says it holds.
3+
*
4+
* Its own module because `PropertyPanelFlat.tsx` is at the repo's 600-line
5+
* budget, and this is the piece with no dependency on the panel around it.
6+
*/
7+
8+
import { parseAudioFxChain } from "@hyperframes/core/audio-fx";
9+
import type { DomEditSelection } from "./domEditing";
10+
11+
/** Chain length at a glance, so the collapsed group says whether anything is on. */
12+
export function audioFxSummary(element: DomEditSelection): string {
13+
const raw = element.dataAttributes?.["fx-chain"];
14+
const carve = element.dataAttributes?.["fx-carve"];
15+
let count = 0;
16+
if (raw) {
17+
try {
18+
count = parseAudioFxChain(raw).nodes.filter((n) => n.enabled !== false).length;
19+
} catch {
20+
return "unreadable";
21+
}
22+
}
23+
const parts: string[] = [];
24+
if (count > 0) parts.push(`${count} effect${count === 1 ? "" : "s"}`);
25+
if (carve) parts.push("carve");
26+
return parts.length > 0 ? parts.join(" + ") : "none";
27+
}

0 commit comments

Comments
 (0)