refactor: split constants by domain and isolate timeline panel from core

This commit is contained in:
Maze Winther
2026-04-01 19:27:49 +02:00
parent f4b9f40ab1
commit bd9ec023ee
72 changed files with 939 additions and 775 deletions
+39
View File
@@ -0,0 +1,39 @@
import type { MediaAsset } from "@/lib/media/types";
type MediaAssetFpsInput = Pick<MediaAsset, "type" | "fps">;
export function getHighestImportedVideoFps({
mediaAssets,
}: {
mediaAssets: MediaAssetFpsInput[];
}): number | null {
let highestFps: number | null = null;
for (const asset of mediaAssets) {
const fps = asset.fps ?? Number.NaN;
if (asset.type !== "video") continue;
if (!Number.isFinite(fps) || fps <= 0) continue;
highestFps = highestFps === null ? fps : Math.max(highestFps, fps);
}
return highestFps;
}
export function getRaisedProjectFpsForImportedMedia({
currentFps,
importedAssets,
}: {
currentFps: number;
importedAssets: MediaAssetFpsInput[];
}): number | null {
const highestImportedVideoFps = getHighestImportedVideoFps({
mediaAssets: importedAssets,
});
if (highestImportedVideoFps === null || highestImportedVideoFps <= currentFps) {
return null;
}
return highestImportedVideoFps;
}