Skip to content

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

fix: confirm before discarding a music video publish draft or composition candidate

Adam Eivy58edef087523
diff --git a/client/src/components/musicVideo/DocumentCompositionPanel.jsx b/client/src/components/musicVideo/DocumentCompositionPanel.jsx
index 76317cf272..47729e76e2 100644
--- a/client/src/components/musicVideo/DocumentCompositionPanel.jsx
+++ b/client/src/components/musicVideo/DocumentCompositionPanel.jsx
@@ -2,6 +2,7 @@ import { supportsToolFreeOneShot, toolFreeOneShotSelectionPolicy } from '../../u
import MediaModePicker from './MediaModePicker.jsx';
import { musicVideoMediaMode, musicVideoDocumentRenderer } from '../../../../server/lib/musicVideoMediaPolicy.js';
import { useEffect, useState, useRef } from 'react';
+import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';
import { useTimeTick } from '../../hooks/useTimeTick.js';
import FilePickerButton from '../ui/FilePickerButton.jsx';
import { Download, FileArchive, FolderInput, LayoutTemplate, Unlink, Film, RotateCcw } from 'lucide-react';
@@ -137,6 +138,7 @@ function ElapsedSeconds() {
* edited.
*/
export default function DocumentCompositionPanel({ project, audioUrl, onProject, onSave }) {
+ const [confirmDiscard, setConfirmDiscard] = useState(false);
const doc = project.composition?.document || null;
const [busy, setBusy] = useState(null);
// Replacing or detaching drops the current version folder once nothing
@@ -316,7 +318,20 @@ export default function DocumentCompositionPanel({ project, audioUrl, onProject,
</div>
<div className="flex gap-2">
<button type="button" className={buttonCls} disabled={!!busy || eventPending || candidate.stale} onClick={accept}>Accept reviewed version</button>
- <button type="button" className={buttonCls} disabled={!!busy} onClick={discard}>Discard candidate</button>
+ {confirmDiscard ? (
+ <ConfirmButtonPair
+ prompt="Discard candidate?"
+ confirmText="Discard"
+ ariaLabel="Confirm discard candidate"
+ confirmAriaLabel="Confirm discard candidate"
+ largeTouchTargets
+ busy={!!busy}
+ onConfirm={() => { setConfirmDiscard(false); discard(); }}
+ onCancel={() => setConfirmDiscard(false)}
+ />
+ ) : (
+ <button type="button" className={buttonCls} disabled={!!busy} onClick={() => setConfirmDiscard(true)}>Discard candidate</button>
+ )}
</div>
</StageSection>}
diff --git a/client/src/components/musicVideo/PublishPostingPanel.jsx b/client/src/components/musicVideo/PublishPostingPanel.jsx
index ea7319f9d9..5828ff92e8 100644
--- a/client/src/components/musicVideo/PublishPostingPanel.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.jsx
@@ -1,4 +1,5 @@
import { useState } from 'react';
+import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';
import { ExternalLink, X as XIcon, LogIn, Link as LinkIcon } from 'lucide-react';
// Where the release goes, in posting order: the full video first so every
@@ -135,6 +136,7 @@ function TargetRow({ project, kit, entry, publishing }) {
return {};
});
const setOption = (key, value) => setOptions((prev) => ({ ...prev, [key]: value }));
+ const [confirmDiscard, setConfirmDiscard] = useState(false);
const draft = publishing.drafts[target];
const busy = publishing.busy[target];
const error = publishing.errors[target];
@@ -179,10 +181,23 @@ function TargetRow({ project, kit, entry, publishing }) {
<div key={k} className="contents"><dt className="text-port-text-muted">{k}</dt><dd className="min-w-0 break-words whitespace-pre-wrap">{v}</dd></div>
))}
</dl>}
- <button type="button" onClick={() => publishing.discard(target)} disabled={!!busy}
- className="flex items-center gap-1 border border-port-border disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0">
- <XIcon size={13} /> Discard
- </button>
+ {confirmDiscard ? (
+ <ConfirmButtonPair
+ prompt="Discard this draft?"
+ confirmText="Discard"
+ ariaLabel={`Confirm discard ${label} draft`}
+ confirmAriaLabel={`Confirm discard ${label} draft`}
+ largeTouchTargets
+ busy={!!busy}
+ onConfirm={() => { setConfirmDiscard(false); publishing.discard(target); }}
+ onCancel={() => setConfirmDiscard(false)}
+ />
+ ) : (
+ <button type="button" onClick={() => setConfirmDiscard(true)} disabled={!!busy}
+ className="flex items-center gap-1 border border-port-border disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0">
+ <XIcon size={13} /> Discard
+ </button>
+ )}
</div>
)}
</li>
diff --git a/client/src/components/musicVideo/PublishPostingPanel.test.jsx b/client/src/components/musicVideo/PublishPostingPanel.test.jsx
index 11a65aee6b..f39899c301 100644
--- a/client/src/components/musicVideo/PublishPostingPanel.test.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.test.jsx
@@ -45,6 +45,8 @@ describe('PublishPostingPanel (#9282)', () => {
expect(within(sn).queryByRole('button', { name: /Post to Stacker News/ })).toBeNull();
expect(within(sn).getByRole('button', { name: /Discard/ })).toBeInTheDocument();
fireEvent.click(within(sn).getByRole('button', { name: /Discard/ }));
+ expect(publishing.discard).not.toHaveBeenCalled();
+ fireEvent.click(within(sn).getByRole('button', { name: /Confirm discard Stacker News draft/ }));
expect(publishing.discard).toHaveBeenCalledWith('stackerNews');
});