diff --git a/apps/web/src/components/editor/timeline/index.tsx b/apps/web/src/components/editor/timeline/index.tsx index 4a59fd21c..5d3fa1eeb 100644 --- a/apps/web/src/components/editor/timeline/index.tsx +++ b/apps/web/src/components/editor/timeline/index.tsx @@ -22,6 +22,7 @@ import { ZoomOut, Bookmark, Eye, + EyeOff, VolumeOff, Volume2, } from "lucide-react"; @@ -84,6 +85,7 @@ export function Timeline() { snappingEnabled, setSelectedElements, toggleTrackMute, + toggleTrackVisibility, dragState, } = useTimelineStore(); const { mediaFiles, addMediaFile } = useMediaStore(); @@ -777,18 +779,38 @@ export function Timeline() { style={{ height: `${getTrackHeight(track.type)}px` }} >
- {track.muted ? ( - toggleTrackMute(track.id)} - /> - ) : ( - toggleTrackMute(track.id)} - /> - )} - + +
diff --git a/apps/web/src/components/editor/timeline/timeline-track.tsx b/apps/web/src/components/editor/timeline/timeline-track.tsx index 7cfde9313..b68918d8a 100644 --- a/apps/web/src/components/editor/timeline/timeline-track.tsx +++ b/apps/web/src/components/editor/timeline/timeline-track.tsx @@ -1106,7 +1106,7 @@ export function TimelineTrackContent({ return (
{ // If clicking empty area (not on an element), deselect all elements if (!(e.target as HTMLElement).closest(".timeline-element")) { diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts index aeeb65c5d..b1a99bc29 100644 --- a/apps/web/src/stores/timeline-store.ts +++ b/apps/web/src/stores/timeline-store.ts @@ -127,6 +127,7 @@ interface TimelineStore { pushHistory?: boolean ) => void; toggleTrackMute: (trackId: string) => void; + toggleTrackVisibility: (trackId: string) => void; splitAndKeepLeft: ( trackId: string, elementId: string, @@ -871,6 +872,15 @@ export const useTimelineStore = create((set, get) => { ); }, + toggleTrackVisibility: (trackId) => { + get().pushHistory(); + updateTracksAndSave( + get()._tracks.map((track) => + track.id === trackId ? { ...track, hidden: !track.hidden } : track + ) + ); + }, + updateTextElement: (trackId, elementId, updates) => { get().pushHistory(); updateTracksAndSave( diff --git a/apps/web/src/types/timeline.ts b/apps/web/src/types/timeline.ts index 61ba6af0c..edaf84015 100644 --- a/apps/web/src/types/timeline.ts +++ b/apps/web/src/types/timeline.ts @@ -86,6 +86,7 @@ export interface TimelineTrack { type: TrackType; elements: TimelineElement[]; muted?: boolean; + hidden?: boolean; isMain?: boolean; }