From bd9ec023eefc4b5d26fa8b66c4338e97104f0f96 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 1 Apr 2026 19:27:49 +0200 Subject: refactor: split constants by domain and isolate timeline panel from core --- .../editor/panels/assets/views/assets.tsx | 4 +- .../panels/assets/views/settings/background.tsx | 14 +- .../editor/panels/assets/views/settings/index.tsx | 2 +- .../editor/panels/preview/preview-viewport.tsx | 2 +- .../components/editor/panels/preview/toolbar.tsx | 2 +- .../editor/panels/properties/tabs/speed-tab.tsx | 2 +- .../editor/panels/properties/tabs/text-tab.tsx | 6 +- .../editor/panels/timeline/bookmarks.tsx | 24 +- .../editor/panels/timeline/drag-line.tsx | 4 +- .../editor/panels/timeline/drop-target.ts | 251 +++++++++++++++++++++ .../components/editor/panels/timeline/index.tsx | 50 ++-- .../editor/panels/timeline/interaction.ts | 4 + .../components/editor/panels/timeline/layers.ts | 6 + .../components/editor/panels/timeline/layout.ts | 16 ++ .../panels/timeline/selection-hit-testing.ts | 136 +++++++++++ .../editor/panels/timeline/snap-indicator.tsx | 2 +- .../src/components/editor/panels/timeline/theme.ts | 29 +++ .../editor/panels/timeline/timeline-element.tsx | 12 +- .../editor/panels/timeline/timeline-playhead.tsx | 4 +- .../editor/panels/timeline/timeline-ruler.tsx | 14 +- .../editor/panels/timeline/timeline-toolbar.tsx | 11 +- .../editor/panels/timeline/timeline-track.tsx | 5 +- .../editor/panels/timeline/track-layout.ts | 37 +++ 23 files changed, 569 insertions(+), 68 deletions(-) create mode 100644 apps/web/src/components/editor/panels/timeline/drop-target.ts create mode 100644 apps/web/src/components/editor/panels/timeline/interaction.ts create mode 100644 apps/web/src/components/editor/panels/timeline/layers.ts create mode 100644 apps/web/src/components/editor/panels/timeline/layout.ts create mode 100644 apps/web/src/components/editor/panels/timeline/selection-hit-testing.ts create mode 100644 apps/web/src/components/editor/panels/timeline/theme.ts create mode 100644 apps/web/src/components/editor/panels/timeline/track-layout.ts (limited to 'apps/web/src/components/editor/panels') diff --git a/apps/web/src/components/editor/panels/assets/views/assets.tsx b/apps/web/src/components/editor/panels/assets/views/assets.tsx index e17e4d4a..031d2e6a 100644 --- a/apps/web/src/components/editor/panels/assets/views/assets.tsx +++ b/apps/web/src/components/editor/panels/assets/views/assets.tsx @@ -25,7 +25,7 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; -import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants"; +import { DEFAULT_NEW_ELEMENT_DURATION_SECONDS } from "@/lib/timeline/creation"; import { useEditor } from "@/hooks/use-editor"; import { useFileUpload } from "@/hooks/use-file-upload"; import { invokeAction } from "@/lib/actions"; @@ -257,7 +257,7 @@ function MediaAssetDraggable({ startTime: number; }) => { const duration = - asset.duration ?? TIMELINE_CONSTANTS.DEFAULT_ELEMENT_DURATION; + asset.duration ?? DEFAULT_NEW_ELEMENT_DURATION_SECONDS; const element = buildElementFromMedia({ mediaId: asset.id, mediaType: asset.type, diff --git a/apps/web/src/components/editor/panels/assets/views/settings/background.tsx b/apps/web/src/components/editor/panels/assets/views/settings/background.tsx index 7a81188f..bbceac7d 100644 --- a/apps/web/src/components/editor/panels/assets/views/settings/background.tsx +++ b/apps/web/src/components/editor/panels/assets/views/settings/background.tsx @@ -8,10 +8,10 @@ import { SectionTitle, } from "@/components/section"; import { - BLUR_INTENSITY_PRESETS, - DEFAULT_BLUR_INTENSITY, - DEFAULT_COLOR, -} from "@/constants/project-constants"; + BACKGROUND_BLUR_INTENSITY_PRESETS, + DEFAULT_BACKGROUND_BLUR_INTENSITY, + DEFAULT_BACKGROUND_COLOR, +} from "@/lib/background/constants"; import { patternCraftGradients } from "@/data/colors/pattern-craft"; import { colors } from "@/data/colors/solid"; import { syntaxUIGradients } from "@/data/colors/syntax-ui"; @@ -164,16 +164,16 @@ export function BackgroundContent() { const currentBlurIntensity = isBlurBackground ? (activeProject.settings.background as { blurIntensity: number }) .blurIntensity - : DEFAULT_BLUR_INTENSITY; + : DEFAULT_BACKGROUND_BLUR_INTENSITY; const currentBackgroundColor = isColorBackground ? (activeProject.settings.background as { color: string }).color - : DEFAULT_COLOR; + : DEFAULT_BACKGROUND_COLOR; const canvasSize = activeProject.settings.canvasSize; const blurPreviews = useMemo( () => - BLUR_INTENSITY_PRESETS.map((blur) => ( + BACKGROUND_BLUR_INTENSITY_PRESETS.map((blur) => (