summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/media-panel/views
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-15 16:28:08 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-15 16:28:08 +0200
commitfdeddbe3edf761ad41a5cd6bf9e1fb7f18624453 (patch)
tree24d9e6a21f5811779e8675d6e0e97e89953c613e /apps/web/src/components/editor/media-panel/views
parentb1ccf3695e3c955de0ffe11ff2cf2dfec37a049d (diff)
parent03b3c952c75b7642b537fa2499d081edd1a0a1e4 (diff)
downloadopencut-fdeddbe3edf761ad41a5cd6bf9e1fb7f18624453.tar.gz
Merge branch 'feature/plus-button-timeline' into staging
Diffstat (limited to 'apps/web/src/components/editor/media-panel/views')
-rw-r--r--apps/web/src/components/editor/media-panel/views/media.tsx2
-rw-r--r--apps/web/src/components/editor/media-panel/views/text.tsx35
2 files changed, 33 insertions, 4 deletions
diff --git a/apps/web/src/components/editor/media-panel/views/media.tsx b/apps/web/src/components/editor/media-panel/views/media.tsx
index 5438737f..17893156 100644
--- a/apps/web/src/components/editor/media-panel/views/media.tsx
+++ b/apps/web/src/components/editor/media-panel/views/media.tsx
@@ -24,6 +24,7 @@ import {
} from "@/components/ui/select";
import { DraggableMediaItem } from "@/components/ui/draggable-item";
import { useProjectStore } from "@/stores/project-store";
+import { addMediaToTimeline } from "@/lib/timeline-utils";
export function MediaView() {
const { mediaItems, addMediaItem, removeMediaItem } = useMediaStore();
@@ -288,6 +289,7 @@ export function MediaView() {
name: item.name,
}}
showPlusOnDrag={false}
+ onAddToTimeline={(currentTime) => addMediaToTimeline(item, currentTime)}
rounded={false}
/>
</ContextMenuTrigger>
diff --git a/apps/web/src/components/editor/media-panel/views/text.tsx b/apps/web/src/components/editor/media-panel/views/text.tsx
index bec32c85..fad79343 100644
--- a/apps/web/src/components/editor/media-panel/views/text.tsx
+++ b/apps/web/src/components/editor/media-panel/views/text.tsx
@@ -1,4 +1,30 @@
import { DraggableMediaItem } from "@/components/ui/draggable-item";
+import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants";
+import { addTextToTimeline } from "@/lib/timeline-utils";
+import { type TextElement } from "@/types/timeline";
+
+let textData: TextElement = {
+ id: "default-text",
+ type: "text",
+ name: "Default text",
+ content: "Default text",
+ fontSize: 48,
+ fontFamily: "Arial",
+ color: "#ffffff",
+ backgroundColor: "transparent",
+ textAlign: "center" as const,
+ fontWeight: "normal" as const,
+ fontStyle: "normal" as const,
+ textDecoration: "none" as const,
+ x: 0,
+ y: 0,
+ rotation: 0,
+ opacity: 1,
+ duration: TIMELINE_CONSTANTS.DEFAULT_TEXT_DURATION,
+ startTime: 0,
+ trimStart: 0,
+ trimEnd: 0,
+};
export function TextView() {
return (
@@ -11,12 +37,13 @@ export function TextView() {
</div>
}
dragData={{
- id: "default-text",
- type: "text",
- name: "Default text",
- content: "Default text",
+ id: textData.id,
+ type: textData.type,
+ name: textData.name,
+ content: textData.content,
}}
aspectRatio={1}
+ onAddToTimeline={(currentTime) => addTextToTimeline(textData, currentTime)}
showLabel={false}
/>
</div>