style: replace track color circle with icon in timeline
This commit is contained in:
@ -10,10 +10,11 @@ import {
|
|||||||
Snowflake,
|
Snowflake,
|
||||||
Copy,
|
Copy,
|
||||||
SplitSquareHorizontal,
|
SplitSquareHorizontal,
|
||||||
Volume2,
|
|
||||||
VolumeX,
|
|
||||||
Pause,
|
Pause,
|
||||||
Play,
|
Play,
|
||||||
|
Video,
|
||||||
|
Music,
|
||||||
|
TypeIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@ -25,7 +26,6 @@ import {
|
|||||||
ContextMenu,
|
ContextMenu,
|
||||||
ContextMenuContent,
|
ContextMenuContent,
|
||||||
ContextMenuItem,
|
ContextMenuItem,
|
||||||
ContextMenuSeparator,
|
|
||||||
ContextMenuTrigger,
|
ContextMenuTrigger,
|
||||||
} from "../ui/context-menu";
|
} from "../ui/context-menu";
|
||||||
import { useTimelineStore } from "@/stores/timeline-store";
|
import { useTimelineStore } from "@/stores/timeline-store";
|
||||||
@ -44,9 +44,8 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from "../ui/select";
|
} from "../ui/select";
|
||||||
import { TimelineTrackContent } from "./timeline-track";
|
import { TimelineTrackContent } from "./timeline-track";
|
||||||
import type { DragData } from "@/types/timeline";
|
import type { DragData, TimelineTrack } from "@/types/timeline";
|
||||||
import {
|
import {
|
||||||
getTrackLabelColor,
|
|
||||||
getTrackHeight,
|
getTrackHeight,
|
||||||
getCumulativeHeightBefore,
|
getCumulativeHeightBefore,
|
||||||
getTotalTracksHeight,
|
getTotalTracksHeight,
|
||||||
@ -1008,12 +1007,7 @@ export function Timeline() {
|
|||||||
style={{ height: `${getTrackHeight(track.type)}px` }}
|
style={{ height: `${getTrackHeight(track.type)}px` }}
|
||||||
>
|
>
|
||||||
<div className="flex items-center flex-1 min-w-0">
|
<div className="flex items-center flex-1 min-w-0">
|
||||||
<div
|
<TrackIcon track={track} />
|
||||||
className={`w-3 h-3 rounded-full flex-shrink-0 ${getTrackLabelColor(track.type)}`}
|
|
||||||
/>
|
|
||||||
<span className="ml-2 text-sm font-medium truncate">
|
|
||||||
{track.name}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
{track.muted && (
|
{track.muted && (
|
||||||
<span className="ml-2 text-xs text-red-500 font-semibold flex-shrink-0">
|
<span className="ml-2 text-xs text-red-500 font-semibold flex-shrink-0">
|
||||||
@ -1100,3 +1094,19 @@ export function Timeline() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TrackIcon({ track }: { track: TimelineTrack }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{track.type === "media" && (
|
||||||
|
<Video className="w-4 h-4 flex-shrink-0 text-muted-foreground" />
|
||||||
|
)}
|
||||||
|
{track.type === "text" && (
|
||||||
|
<TypeIcon className="w-4 h-4 flex-shrink-0 text-muted-foreground" />
|
||||||
|
)}
|
||||||
|
{track.type === "audio" && (
|
||||||
|
<Music className="w-4 h-4 flex-shrink-0 text-muted-foreground" />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -32,10 +32,6 @@ export function getTrackElementClasses(type: TrackType) {
|
|||||||
return `${colors.background} ${colors.border}`;
|
return `${colors.background} ${colors.border}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTrackLabelColor(type: TrackType) {
|
|
||||||
return getTrackColors(type).solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Track height definitions
|
// Track height definitions
|
||||||
export const TRACK_HEIGHTS: Record<TrackType, number> = {
|
export const TRACK_HEIGHTS: Record<TrackType, number> = {
|
||||||
media: 65,
|
media: 65,
|
||||||
|
Reference in New Issue
Block a user