Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(music-video): ask for confirmation before deleting a music video project
[._.]/ Adam Eivy6e7e33ae3b80
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 0433fd7e35..776f73093d 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -2,6 +2,8 @@ import { useEffect, useState, useCallback, useMemo, useRef } from 'react';import { useParams, useNavigate, useSearchParams } from 'react-router';import { Plus, Film, Copy, Trash2, Wand2 } from 'lucide-react';import toast from '../components/ui/Toast';+import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';+import { useConfirmDelete } from '../hooks/useConfirmDelete';import PageHeader from '../components/PageHeader';import {listMusicVideoProjects,@@ -305,6 +307,16 @@ export default function MusicVideo() {.finally(() => setCreating(false));};+ const { isConfirming: isConfirmingDelete, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();++ const handleDeleteRequest = (id) => {+ if (youtube.editJob.active && id === selectedId) {+ toast.error('Finish or cancel the in-progress YouTube import before deleting this project');+ return;+ }+ requestDelete(id);+ };+const handleDelete = (id) => {// Same hazard selectProject guards against: deleting the project an// in-flight edit-surface import targets would still finish server-side@@ -943,15 +955,26 @@ export default function MusicVideo() {><Copy size={15} aria-hidden="true" /> <span className="max-sm:sr-only">{cloning ? 'Forking…' : `Fork v${(selected.version || 1) + 1}`}</span></button>- <button- type="button"- onClick={() => handleDelete(selected.id)}- title="Delete project"- aria-label="Delete project"- className="flex min-h-[44px] min-w-[44px] items-center justify-center rounded border border-port-border px-2 py-1.5 text-sm text-port-error sm:min-h-0 sm:min-w-0"- >- <Trash2 size={15} />- </button>+ {isConfirmingDelete(selected.id) ? (+ <ConfirmButtonPair+ prompt="Delete?"+ confirmText="Delete"+ ariaLabel={`Confirm delete project ${selected.name}`}+ confirmAriaLabel={`Confirm delete project ${selected.name}`}+ onConfirm={() => confirmDelete(() => handleDelete(selected.id))}+ onCancel={cancelDelete}+ />+ ) : (+ <button+ type="button"+ onClick={() => handleDeleteRequest(selected.id)}+ title="Delete project"+ aria-label="Delete project"+ className="flex min-h-[44px] min-w-[44px] items-center justify-center rounded border border-port-border px-2 py-1.5 text-sm text-port-error sm:min-h-0 sm:min-w-0"+ >+ <Trash2 size={15} />+ </button>+ )}</span>)}<buttondiff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 0135bc2488..d7ebaaddda 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -1456,6 +1456,25 @@ describe('MusicVideo YouTube audio import (#1945)', () => {expect(deleteMusicVideoProject).not.toHaveBeenCalled();});+ it('asks for confirmation before deleting a project and allows cancelling or confirming', async () => {+ deleteMusicVideoProject.mockResolvedValue({});+ await openProject(PROJECT_NO_CLIP, 'setup');++ fireEvent.click(screen.getByTitle('Delete project'));+ expect(deleteMusicVideoProject).not.toHaveBeenCalled();+ expect(screen.getByText('Delete?')).toBeTruthy();++ // Cancel deletion+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ expect(deleteMusicVideoProject).not.toHaveBeenCalled();+ expect(screen.getByTitle('Delete project')).toBeTruthy();++ // Arm confirmation again and confirm+ fireEvent.click(screen.getByTitle('Delete project'));+ fireEvent.click(screen.getByRole('button', { name: `Confirm delete project ${PROJECT_NO_CLIP.name}` }));+ await waitFor(() => expect(deleteMusicVideoProject).toHaveBeenCalledWith(PROJECT_NO_CLIP.id, { silent: true }));+ });+it('pressing Enter in the create-form URL input starts the import instead of submitting the form', async () => {listMusicVideoProjects.mockResolvedValue([]);renderMV();