diff --git a/lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte b/lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte
index a7670c85c..0ca479523 100644
--- a/lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte
+++ b/lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte
@@ -7,7 +7,6 @@
component: VideoControls,
tags: ['autodocs']
});
-
// The bar owns no state; the Playground wires local state so the scrubber
// and transport buttons actually respond.
let currentTimeS = $state(15);
diff --git a/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte b/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
index c688ada6c..b4608e313 100644
--- a/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
+++ b/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
@@ -26,6 +26,7 @@
import { useCreateAnnotation } from '$lib/hooks/useCreateAnnotation/useCreateAnnotation';
import { useCreateLabel } from '$lib/hooks/useCreateLabel/useCreateLabel';
import { useSelectClassDialog } from '$lib/hooks/useSelectClassDialog/useSelectClassDialog';
+ import { useDeleteAnnotation } from '$lib/hooks/useDeleteAnnotation/useDeleteAnnotation';
import { onMount } from 'svelte';
import { toast } from 'svelte-sonner';
import { routeHelpers } from '$lib/routes';
@@ -55,6 +56,7 @@
const { updateAnnotations } = useUpdateAnnotationsMutation({ collectionId: eventCollectionId });
const { createAnnotation } = useCreateAnnotation({ collectionId: eventCollectionId });
const { createLabel } = useCreateLabel({ collectionId: eventCollectionId });
+ const { deleteAnnotation } = useDeleteAnnotation({ collectionId: eventCollectionId });
const annotationLabels = useAnnotationLabels(() => ({ collectionId: eventCollectionId }));
const {
@@ -118,6 +120,17 @@
}
}
+ async function handleEventDelete(event: VideoEvent) {
+ try {
+ await deleteAnnotation(event.id);
+ onVideoUpdate();
+ toast.success('Event deleted');
+ } catch (error) {
+ toast.error('Failed to delete event. Please try again.');
+ console.error('Error deleting event:', error);
+ }
+ }
+
const {
currentFrame,
frames: videoFrames,
@@ -255,6 +268,7 @@
editableEvents={$isEditingMode}
onEventResize={handleEventResize}
onEventAdd={handleEventAdd}
+ onEventDelete={handleEventDelete}
videoProps={{
muted: true,
class: 'object-contain',
diff --git a/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts b/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
index a19e1683f..0b0186ab2 100644
--- a/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
+++ b/lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
@@ -57,6 +57,9 @@ vi.mock('$lib/hooks/useCreateLabel/useCreateLabel', () => ({
vi.mock('$lib/hooks/useAnnotationLabels/useAnnotationLabels', () => ({
useAnnotationLabels: vi.fn(() => ({ data: [] }))
}));
+vi.mock('$lib/hooks/useDeleteAnnotation/useDeleteAnnotation', () => ({
+ useDeleteAnnotation: vi.fn(() => ({ deleteAnnotation: vi.fn() }))
+}));
import VideoDetails from './VideoDetails.svelte';
diff --git a/lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte b/lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte
index 923a82257..4d34106ea 100644
--- a/lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte
+++ b/lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte
@@ -41,9 +41,6 @@
]);
const singleEvent = makeEvents([['Sprint', 3, 14]]);
-
-
-
@@ -82,7 +79,6 @@
currentTimeS: 5
}}
/>
-