blob: 05ad539689c609d44ca25b2973084d488ec9aceb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
"use client";
import { ScrollArea } from "@/components/ui/scroll-area";
import { AudioProperties } from "./audio-properties";
import { VideoProperties } from "./video-properties";
import { TextProperties } from "./text-properties";
import { EmptyView } from "./empty-view";
import { useEditor } from "@/hooks/use-editor";
import { useElementSelection } from "@/hooks/timeline/element/use-element-selection";
export function PropertiesPanel() {
const editor = useEditor();
const { selectedElements } = useElementSelection();
const elementsWithTracks = editor.timeline.getElementsWithTracks({
elements: selectedElements,
});
return (
<div className="panel bg-background h-full rounded-sm border overflow-hidden">
{selectedElements.length > 0 ? (
<ScrollArea className="h-full">
{elementsWithTracks.map(({ track, element }) => {
if (element.type === "text") {
return (
<div key={element.id}>
<TextProperties element={element} trackId={track.id} />
</div>
);
}
if (element.type === "audio") {
return <AudioProperties key={element.id} _element={element} />;
}
if (element.type === "video" || element.type === "image") {
return (
<div key={element.id}>
<VideoProperties _element={element} />
</div>
);
}
return null;
})}
</ScrollArea>
) : (
<EmptyView />
)}
</div>
);
}
|