mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 22:08:03 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user