diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-06-25 21:40:54 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-06-25 21:40:54 +0200 |
| commit | 777b0f700067d7ffde37fbe14ed320f2ef630330 (patch) | |
| tree | 6603d8de2481314155599bb15dab4a076b0478fd /apps/web/src/components/editor/timeline.tsx | |
| parent | 926aebe00423b5b0b2fd0d8cf0ee97c6e85ec1fd (diff) | |
| download | opencut-777b0f700067d7ffde37fbe14ed320f2ef630330.tar.gz | |
refactor: improved type-safety, removal of any from all instances
Diffstat (limited to 'apps/web/src/components/editor/timeline.tsx')
| -rw-r--r-- | apps/web/src/components/editor/timeline.tsx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 210a943d..de2740a6 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -22,7 +22,11 @@ import { TooltipTrigger,
TooltipProvider,
} from "../ui/tooltip";
-import { useTimelineStore, type TimelineTrack } from "@/stores/timeline-store";
+import {
+ useTimelineStore,
+ type TimelineTrack,
+ type TimelineClip,
+} from "@/stores/timeline-store";
import { useMediaStore } from "@/stores/media-store";
import { usePlaybackStore } from "@/stores/playback-store";
import { useDragClip } from "@/hooks/use-drag-clip";
@@ -1253,7 +1257,7 @@ function TimelineTrackContent({ const [justFinishedDrag, setJustFinishedDrag] = useState(false);
- const handleClipMouseDown = (e: React.MouseEvent, clip: any) => {
+ const handleClipMouseDown = (e: React.MouseEvent, clip: TimelineClip) => {
// Handle selection first
if (!justFinishedDrag) {
const isSelected = selectedClips.some(
@@ -1374,7 +1378,7 @@ function TimelineTrackContent({ (t: TimelineTrack) => t.id === fromTrackId
);
const movingClip = sourceTrack?.clips.find(
- (c: any) => c.id === clipId
+ (c: TimelineClip) => c.id === clipId
);
if (movingClip) {
@@ -1499,7 +1503,9 @@ function TimelineTrackContent({ const sourceTrack = tracks.find(
(t: TimelineTrack) => t.id === fromTrackId
);
- const movingClip = sourceTrack?.clips.find((c: any) => c.id === clipId);
+ const movingClip = sourceTrack?.clips.find(
+ (c: TimelineClip) => c.id === clipId
+ );
if (!movingClip) {
toast.error("Clip not found");
@@ -1629,7 +1635,7 @@ function TimelineTrackContent({ }
};
- const renderClipContent = (clip: any) => {
+ const renderClipContent = (clip: TimelineClip) => {
const mediaItem = mediaItems.find((item) => item.id === clip.mediaId);
if (!mediaItem) {
@@ -1689,7 +1695,7 @@ function TimelineTrackContent({ );
};
- const handleSplitClip = (clip: any) => {
+ const handleSplitClip = (clip: TimelineClip) => {
// Use current playback time as split point
const splitTime = currentTime;
// Only split if splitTime is within the clip's effective range
|
