diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-07 23:21:06 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-07 23:21:06 +0200 |
| commit | 9d2fd50fbc764308b1ebad8a43fa0556e77b9937 (patch) | |
| tree | 6444bce96324c6a7e2b25d8afebea78fbc7f093e /apps/web/src/lib/timeline-constants.ts | |
| parent | d36df2fb6273bb16d4874972a0dc832bad6836ab (diff) | |
| download | opencut-9d2fd50fbc764308b1ebad8a43fa0556e77b9937.tar.gz | |
refactor: centralize track colors and timeline constants
Diffstat (limited to 'apps/web/src/lib/timeline-constants.ts')
| -rw-r--r-- | apps/web/src/lib/timeline-constants.ts | 48 |
1 files changed, 48 insertions, 0 deletions
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;
|
