From 9d2fd50fbc764308b1ebad8a43fa0556e77b9937 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Mon, 7 Jul 2025 23:21:06 +0200 Subject: refactor: centralize track colors and timeline constants --- apps/web/src/lib/timeline-constants.ts | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 apps/web/src/lib/timeline-constants.ts (limited to 'apps/web/src/lib') diff --git a/apps/web/src/lib/timeline-constants.ts b/apps/web/src/lib/timeline-constants.ts new file mode 100644 index 00000000..fbbfe081 --- /dev/null +++ b/apps/web/src/lib/timeline-constants.ts @@ -0,0 +1,48 @@ +import type { TrackType } from "@/types/timeline"; + +// Track color definitions +export const TRACK_COLORS = { + media: { + solid: "bg-blue-500", + background: "bg-blue-500/20", + border: "border-blue-500/30", + }, + text: { + solid: "bg-purple-500", + background: "bg-purple-500/20", + border: "border-purple-500/30", + }, + audio: { + solid: "bg-green-500", + background: "bg-green-500/20", + border: "border-green-500/30", + }, + default: { + solid: "bg-gray-500", + background: "bg-gray-500/20", + border: "border-gray-500/30", + }, +} as const; + +// Utility functions +export function getTrackColors(type: TrackType) { + return TRACK_COLORS[type] || TRACK_COLORS.default; +} + +export function getTrackElementClasses(type: TrackType) { + const colors = getTrackColors(type); + return `${colors.background} ${colors.border}`; +} + +export function getTrackLabelColor(type: TrackType) { + return getTrackColors(type).solid; +} + +// Other timeline constants +export const TIMELINE_CONSTANTS = { + ELEMENT_MIN_WIDTH: 80, + PIXELS_PER_SECOND: 50, + TRACK_HEIGHT: 60, + DEFAULT_TEXT_DURATION: 5, + ZOOM_LEVELS: [0.25, 0.5, 1, 1.5, 2, 3, 4], +} as const; -- cgit v1.3.1