summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/media-panel/views/text.tsx
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-16 13:38:26 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-16 13:38:26 +0200
commit49d467cd83522983da0a59892838d65f605fa78f (patch)
treee405fca919948bd18966fbee108c649ebdfcc40d /apps/web/src/components/editor/media-panel/views/text.tsx
parent13db27c173a844239a3847369ee55216f7439c9e (diff)
parent96f7516c94cc922519e5369ef132b62d9a52e85c (diff)
downloadopencut-49d467cd83522983da0a59892838d65f605fa78f.tar.gz
Merge branch 'staging' into pr/vishesh711/284
Diffstat (limited to 'apps/web/src/components/editor/media-panel/views/text.tsx')
-rw-r--r--apps/web/src/components/editor/media-panel/views/text.tsx37
1 files changed, 33 insertions, 4 deletions
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..6d0d310b 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 { useTimelineStore } from "@/stores/timeline-store";
+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,15 @@ 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) =>
+ useTimelineStore.getState().addTextAtTime(textData, currentTime)
+ }
showLabel={false}
/>
</div>