fix(autopilot): "clip it" tells you what happened, next to the button
Without the rights confirmation the button only set the page notice, which renders at the top of the tab, far above the video list: the click looked like it did nothing. The confirmation checkbox and the button's feedback (started, not clipped and why, errors) now sit right above the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a8509249da
commit
c26178776f
1 changed files with 23 additions and 6 deletions
|
|
@ -93,6 +93,9 @@ export default function AutopilotTab({ onOpenProject, onUpgrade, justConnected }
|
||||||
const [rightsAck, setRightsAck] = useState(false);
|
const [rightsAck, setRightsAck] = useState(false);
|
||||||
const [running, setRunning] = useState(null); // video id being submitted
|
const [running, setRunning] = useState(null); // video id being submitted
|
||||||
const [notice, setNotice] = useState('');
|
const [notice, setNotice] = useState('');
|
||||||
|
// Feedback for "clip it", shown next to the list: the page-level notice sits
|
||||||
|
// at the top of the tab, off screen from the button, so a click looked dead.
|
||||||
|
const [listNotice, setListNotice] = useState('');
|
||||||
const [opening, setOpening] = useState(null);
|
const [opening, setOpening] = useState(null);
|
||||||
const pollRef = useRef(null);
|
const pollRef = useRef(null);
|
||||||
|
|
||||||
|
|
@ -180,11 +183,11 @@ export default function AutopilotTab({ onOpenProject, onUpgrade, justConnected }
|
||||||
|
|
||||||
const runNow = useCallback(async (video) => {
|
const runNow = useCallback(async (video) => {
|
||||||
if (!data?.settings?.rights_ack && !rightsAck) {
|
if (!data?.settings?.rights_ack && !rightsAck) {
|
||||||
setNotice('Confirm you own the content of this channel first.');
|
setListNotice('Tick “I own the content…” just above the list first, then clip it again.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setRunning(video.id);
|
setRunning(video.id);
|
||||||
setNotice('');
|
setListNotice('');
|
||||||
try {
|
try {
|
||||||
if (!data?.settings?.rights_ack) await save({ rights_ack: true });
|
if (!data?.settings?.rights_ack) await save({ rights_ack: true });
|
||||||
const r = await apiJson('/api/autopilot/run', {
|
const r = await apiJson('/api/autopilot/run', {
|
||||||
|
|
@ -193,11 +196,11 @@ export default function AutopilotTab({ onOpenProject, onUpgrade, justConnected }
|
||||||
body: JSON.stringify({ video_id: video.id }),
|
body: JSON.stringify({ video_id: video.id }),
|
||||||
});
|
});
|
||||||
track('AutopilotManualRun', { props: { status: r.status } });
|
track('AutopilotManualRun', { props: { status: r.status } });
|
||||||
if (r.status === 'processing') setNotice(`Clipping “${video.title || 'your video'}”. We will email you when the clips are ready.`);
|
if (r.status === 'processing') setListNotice(`Clipping “${video.title || 'your video'}”. We will email you when the clips are ready.`);
|
||||||
else setNotice(`Not clipped: ${REASON_TEXT[r.reason] || r.reason || r.status}.`);
|
else setListNotice(`Not clipped: ${REASON_TEXT[r.reason] || r.reason || r.status}.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e?.name === 'QuotaError') setNotice('You are out of minutes for this period.');
|
if (e?.name === 'QuotaError') setListNotice('You are out of minutes for this period.');
|
||||||
else setNotice(errText(e, 'Could not start the job.'));
|
else setListNotice(errText(e, 'Could not start the job.'));
|
||||||
} finally {
|
} finally {
|
||||||
setRunning(null);
|
setRunning(null);
|
||||||
load();
|
load();
|
||||||
|
|
@ -431,6 +434,20 @@ export default function AutopilotTab({ onOpenProject, onUpgrade, justConnected }
|
||||||
<button onClick={load} className="btn-quiet text-xs" aria-label="refresh"><RefreshCw size={13} /> refresh</button>
|
<button onClick={load} className="btn-quiet text-xs" aria-label="refresh"><RefreshCw size={13} /> refresh</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{!s.rights_ack && (
|
||||||
|
<label className="flex items-start gap-3 mb-4 text-sm text-ink2 cursor-pointer">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={rightsAck}
|
||||||
|
onChange={(e) => { setRightsAck(e.target.checked); setListNotice(''); }}
|
||||||
|
className="mt-0.5 accent-[var(--color-accent)]"
|
||||||
|
/>
|
||||||
|
<span>I own the content published on this channel, or have the rights to process it.</span>
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
|
{listNotice && (
|
||||||
|
<div className="mb-4 rounded-card border border-brass/40 bg-brass/5 px-4 py-3 text-sm text-ink2" role="status">{listNotice}</div>
|
||||||
|
)}
|
||||||
{videosError && <p className="text-warn text-sm mb-3">{ERROR_TEXT[videosError] || 'Could not read your channel.'}</p>}
|
{videosError && <p className="text-warn text-sm mb-3">{ERROR_TEXT[videosError] || 'Could not read your channel.'}</p>}
|
||||||
{videos === null && <div className="flex justify-center py-6"><Loader2 className="animate-spin text-brass" size={18} /></div>}
|
{videos === null && <div className="flex justify-center py-6"><Loader2 className="animate-spin text-brass" size={18} /></div>}
|
||||||
{videos && videos.length === 0 && !videosError && (
|
{videos && videos.length === 0 && !videosError && (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue