From 0cdd0b91b8a0b0640d10fb81193f8ca24e295345 Mon Sep 17 00:00:00 2001 From: pedro-bento Date: Mon, 5 Oct 2026 16:38:42 +0100 Subject: [PATCH] feat(bridge): shorts-to-long-form bridge + dashboard UI --- clipwright/integrations/youtube_data.py | 154 +++++++++++ clipwright/pipeline/bridge.py | 207 ++++++++++++++ dashboard/src/App.jsx | 3 + dashboard/src/components/BridgeModal.jsx | 331 +++++++++++++++++++++++ dashboard/src/components/MediaInput.jsx | 53 ++++ dashboard/src/components/ResultCard.jsx | 18 ++ tests/test_bridge.py | 101 +++++++ tests/test_bridge_endpoint.py | 132 +++++++++ tests/test_youtube_data.py | 130 +++++++++ 9 files changed, 1129 insertions(+) create mode 100644 clipwright/integrations/youtube_data.py create mode 100644 clipwright/pipeline/bridge.py create mode 100644 dashboard/src/components/BridgeModal.jsx create mode 100644 tests/test_bridge.py create mode 100644 tests/test_bridge_endpoint.py create mode 100644 tests/test_youtube_data.py diff --git a/clipwright/integrations/youtube_data.py b/clipwright/integrations/youtube_data.py new file mode 100644 index 0000000..8c08f75 --- /dev/null +++ b/clipwright/integrations/youtube_data.py @@ -0,0 +1,154 @@ +"""Minimal YouTube Data API v3 client -- first comment only (PLAN #6). + +The Shorts "Related video" link and comment pinning are Studio-UI only and are +**not** exposed by any API, so this module deliberately does one thing: post a +top-level comment on a video via ``commentThreads.insert``. Pinning that comment +stays manual. + +Auth is a real-channel OAuth refresh token (service accounts do not work for +this scope). Credentials come from the environment and the integration is +**opt-in**: with any of them missing, :func:`is_configured` is false and no +network call is ever made. Callers must check :func:`is_configured` (or handle +:class:`YoutubeDataError`) before asking for a comment. + +Quota: ``commentThreads.insert`` costs 50 units of the default 10,000/day +project quota (~200 comments/day). That is the whole reason posting is a +deliberate, caller-triggered action and never automatic. + +Blocking, like ``postiz.py``: call through ``asyncio.to_thread`` from async +handlers. Every function accepts an optional pre-built ``httpx.Client`` so tests +can inject a ``httpx.MockTransport`` and no live OAuth is ever needed. +""" + +from __future__ import annotations + +import os +from typing import Any, Dict, Optional + +import httpx + +TOKEN_URI = "https://oauth2.googleapis.com/token" +COMMENT_THREADS_URL = "https://www.googleapis.com/youtube/v3/commentThreads" +# Required by insert (the comment posting endpoint). Read-only analytics use a +# different scope; this module never reads. +SCOPE = "https://www.googleapis.com/auth/youtube.force-ssl" + +# Environment variable names, kept as constants so the API layer can name them +# in its "not configured" message without duplicating strings. +CLIENT_ID_ENV = "YOUTUBE_OAUTH_CLIENT_ID" +CLIENT_SECRET_ENV = "YOUTUBE_OAUTH_CLIENT_SECRET" +REFRESH_TOKEN_ENV = "YOUTUBE_OAUTH_REFRESH_TOKEN" +TOKEN_URI_ENV = "YOUTUBE_OAUTH_TOKEN_URI" + + +class YoutubeDataError(Exception): + """A missing config or non-2xx response from the YouTube Data API. + + Carries the status and body so the FastAPI layer can translate it into the + same status/detail it would have surfaced otherwise. + """ + + def __init__(self, status_code: int, detail: str): + super().__init__(detail) + self.status_code = status_code + self.detail = detail + + +def _env(name: str, default: Optional[str] = None) -> Optional[str]: + value = os.environ.get(name) + if value is None: + return default + value = value.strip() + return value or default + + +def credentials() -> Dict[str, Optional[str]]: + """The OAuth credentials read from the environment (values may be None).""" + return { + "client_id": _env(CLIENT_ID_ENV), + "client_secret": _env(CLIENT_SECRET_ENV), + "refresh_token": _env(REFRESH_TOKEN_ENV), + "token_uri": _env(TOKEN_URI_ENV, TOKEN_URI), + } + + +def is_configured() -> bool: + """True when a refresh-token flow can run. False = no-op, never called.""" + creds = credentials() + return all(creds[key] for key in ("client_id", "client_secret", "refresh_token")) + + +def _access_token(client: httpx.Client, creds: Dict[str, Optional[str]]) -> str: + resp = client.post(str(creds["token_uri"]), data={ + "client_id": creds["client_id"], + "client_secret": creds["client_secret"], + "refresh_token": creds["refresh_token"], + "grant_type": "refresh_token", + }) + if resp.status_code != 200: + raise YoutubeDataError( + 502, + f"YouTube OAuth token refresh failed: {(resp.text or '')[:300]}", + ) + try: + token = (resp.json() or {}).get("access_token") + except ValueError: + token = None + if not token: + raise YoutubeDataError(502, "YouTube OAuth token refresh returned no access_token") + return token + + +def post_first_comment(video_id: str, text: str, timeout: float = 60.0, + client: Optional[httpx.Client] = None) -> Dict[str, Any]: + """Post ``text`` as a top-level comment on ``video_id``. + + Returns the API's ``commentThreads.insert`` response (id + snippet). + + Raises :class:`YoutubeDataError` when unconfigured, given bad input, or when + YouTube rejects the insert. ``client`` is the test seam; pass an + ``httpx.Client`` built with a ``MockTransport`` to exercise this offline. + """ + if not video_id or not str(video_id).strip(): + raise YoutubeDataError(400, "video_id is required") + if not text or not str(text).strip(): + raise YoutubeDataError(400, "comment text is required") + if not is_configured(): + raise YoutubeDataError( + 400, + "YouTube Data API is not configured; set " + f"{CLIENT_ID_ENV}, {CLIENT_SECRET_ENV} and {REFRESH_TOKEN_ENV}", + ) + + owns_client = client is None + client = client or httpx.Client(timeout=timeout) + try: + token = _access_token(client, credentials()) + resp = client.post( + COMMENT_THREADS_URL, + params={"part": "snippet"}, + headers={"Authorization": f"Bearer {token}"}, + json={"snippet": { + "videoId": str(video_id).strip(), + "topLevelComment": { + "snippet": {"textOriginal": str(text)}, + }, + }}, + ) + finally: + if owns_client: + client.close() + + if resp.status_code not in (200, 201): + # 4xx are the caller's (invalid video / scope); 5xx become 502 so the + # API layer does not claim the upstream is down with a gateway code + # that came from YouTube, not this server. + status = resp.status_code if resp.status_code < 500 else 502 + raise YoutubeDataError( + status, + f"YouTube commentThreads.insert failed: {(resp.text or '')[:300]}", + ) + try: + return resp.json() or {} + except ValueError: + return {} diff --git a/clipwright/pipeline/bridge.py b/clipwright/pipeline/bridge.py new file mode 100644 index 0000000..ceaf713 --- /dev/null +++ b/clipwright/pipeline/bridge.py @@ -0,0 +1,207 @@ +"""Shorts -> long-form bridge copy (PLAN #6). + +Pure, network-free helpers that turn the active channel profile (+ its +``published_video_history``) into the copy a Short needs to funnel viewers to a +long-form video: + +* ``description_bridge`` -- a block appended to the Short's YouTube description; +* ``first_comment`` -- the top-level comment to post (and pin). + +Two "related video" features are Studio-UI only and are **not** exposed by any +API: the Shorts "Related video" link and comment pinning. Those therefore stay +manual, and ``checklist`` spells out the exact Studio steps including the +target long-form URL. + +The explicit target wins over the profile history. Callers pass it from the CLI +(``--longform-url``) or the API (``related_video_url``); nothing here performs +I/O. +""" + +from __future__ import annotations + +from typing import Any, Mapping, Optional + +from clipwright.pipeline import profile_prompts +from clipwright.pipeline.profiles import Profile + +# Fallback label when the target URL is provided but the profile says nothing. +DEFAULT_TARGET_LABEL = "Full video" + +# Keys a published_video_history entry may carry to identify the video. The +# first match wins; ``id``/``video_id`` build a watch URL. +_URL_KEYS = ("url", "video_url", "watch_url", "link") +_ID_KEYS = ("id", "video_id", "youtube_id") +_DATE_KEYS = ("published_at", "published", "date", "uploaded_at") + + +def _entry_url(entry: Mapping) -> Optional[str]: + """The watch URL for one ``published_video_history`` entry, or None.""" + if not isinstance(entry, Mapping): + return None + for key in _URL_KEYS: + value = entry.get(key) + if isinstance(value, str) and value.strip(): + return value.strip() + for key in _ID_KEYS: + value = entry.get(key) + if isinstance(value, str) and value.strip(): + return f"https://www.youtube.com/watch?v={value.strip()}" + return None + + +def _entry_sort_key(entry: Mapping) -> str: + for key in _DATE_KEYS: + value = entry.get(key) + if isinstance(value, str) and value.strip(): + return value.strip() + return "" + + +def target_video(profile: Optional[Profile], + related_video_url: Optional[str] = None) -> Optional[str]: + """The long-form target: the explicit URL, else the newest history entry. + + An explicit ``related_video_url`` always wins. Otherwise the profile's + ``published_video_history`` is searched for an entry that names a video + (``url``/``video_url``/... or an ``id``); the newest by a best-effort date + field is chosen, falling back to the last entry listed. + """ + if isinstance(related_video_url, str) and related_video_url.strip(): + return related_video_url.strip() + history = list(getattr(profile, "published_video_history", None) or []) + candidates = [(k, e) for e in history if (k := _entry_url(e))] + if not candidates: + return None + candidates.sort(key=lambda pair: _entry_sort_key(pair[1])) + return candidates[-1][0] + + +def _target_label(profile: Optional[Profile]) -> str: + """A human label for the target, derived from the profile's description.""" + template = getattr(profile, "description_template", "") if profile else "" + # Templates look like "{hook}\n\nFull video: {link}\n\n#tags" -- lift the + # words before "{link}" when they name the long-form video. + if "{link}" in template: + prefix = template.split("{link}")[0].strip().splitlines()[-1].strip() + prefix = prefix.rstrip(":").strip() + if prefix and "{hook}" not in prefix: + return prefix + return DEFAULT_TARGET_LABEL + + +def _clip_hook(clip: Optional[Mapping]) -> str: + """The clip's hook text if the pipeline produced one, else its title.""" + if not isinstance(clip, Mapping): + return "" + for key in ("viral_hook_text", "hook_text", "video_title_for_youtube_short"): + value = clip.get(key) + if isinstance(value, str) and value.strip(): + return value.strip() + return "" + + +def _render_description_template(template: str, target: Optional[str], + clip: Optional[Mapping]) -> str: + """Fill the profile's ``{hook}``/``{link}`` slots without str.format. + + ``str.format`` would explode on any other brace in the template (or + hashtags that are fine today); a literal replace can only touch the two + documented placeholders. + """ + rendered = template.replace("{hook}", _clip_hook(clip)) + rendered = rendered.replace("{link}", target or "") + return "\n".join(line.rstrip() for line in rendered.splitlines()).strip() + + +def description_bridge(profile: Optional[Profile], + related_video_url: Optional[str] = None, + clip: Optional[Mapping] = None) -> str: + """The description block: a target CTA plus the profile's description copy. + + The target URL appears first (and in the rendered template when the profile + has one). Without a target the channel links/description still render, so a + bridge is produced even before a long-form URL is chosen. + """ + target = target_video(profile, related_video_url) + parts: list[str] = [] + if target: + parts.append(f"▶ {_target_label(profile)}: {target}") + + template = (getattr(profile, "description_template", "") if profile else "") or "" + rendered = _render_description_template(template, target, clip) if template else "" + if rendered: + parts.append(rendered) + else: + # No template: fall back to the profile's plain description block. + block = profile_prompts.description_block(profile) if profile else "" + if block: + parts.append(block.rstrip()) + + # The profile's links belong in the bridge even when the template's {link} + # slot was empty (no target yet) or the template does not mention them. + links = [link for link in (getattr(profile, "links", None) or []) + if isinstance(link, str) and link.strip()] + if links and not any(link in "\n".join(parts) for link in links): + parts.append("More from this channel: " + " | ".join(links)) + + return "\n\n".join(p for p in parts if p).strip() + + +def first_comment(profile: Optional[Profile], + related_video_url: Optional[str] = None, + clip: Optional[Mapping] = None) -> str: + """The top-level comment text. Always carries the long-form reference. + + With no target it points at the channel's links (or the description) rather + than inventing a URL; it is never empty. + """ + target = target_video(profile, related_video_url) + hook = _clip_hook(clip) + if target: + text = f"▶ {_target_label(profile)}: {target}" + if hook: + text += f"\n\n{_target_label(profile)} covers this: {hook}" + return text + links = list(getattr(profile, "links", None) or []) + if links: + return f"Watch the long-form videos here: {links[0]}" + return "The full long-form video is linked in the description." + + +def checklist(profile: Optional[Profile], + related_video_url: Optional[str] = None) -> list[str]: + """The manual Studio steps for this Short (both are Studio-UI only). + + The Shorts "Related video" link and comment pinning have no public API, so + they are copy-paste steps, not something the server can do. + """ + target = target_video(profile, related_video_url) + target_text = target or "" + return [ + "Open YouTube Studio -> Content -> this Short -> Edit.", + f"Details -> Related video: set it to {target_text} " + "(the Shorts related-video link is Studio-UI only; no API can set it).", + "Post the generated first comment " + "(or call this clip's bridge/comment endpoint if the YouTube Data API " + "is configured).", + "Pin the first comment: hover it -> the three-dot menu -> Pin. " + "Pinning stays manual (no API).", + ] + + +def build_bridge(profile: Optional[Profile], + clip: Optional[Mapping] = None, + related_video_url: Optional[str] = None) -> dict[str, Any]: + """All bridge fields for one clip, ready to merge into clip metadata. + + ``related_video_url`` is the explicit target (CLI ``--longform-url`` / API + ``related_video_url``); when omitted the profile history is used. + """ + target = target_video(profile, related_video_url) + return { + "related_video_url": target, + "description_bridge": description_bridge(profile, target, clip), + "first_comment": first_comment(profile, target, clip), + "checklist": checklist(profile, target), + "manual_pin_required": True, + } diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index e2b79b6..81005bd 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -673,6 +673,9 @@ function App() { auto_hook_style: data.autoHook ? (data.autoHookStyle || 'pill') : null, // 'auto' is the server default, so only a deliberate choice travels. layouts: data.layout && data.layout !== 'auto' ? data.layout : null, + // Channel profile slug (channels/.json). Absent = no profile, so + // the default request stays byte-identical to the pre-feature one. + channel: data.channel || null, }; if (data.type === 'url') { diff --git a/dashboard/src/components/BridgeModal.jsx b/dashboard/src/components/BridgeModal.jsx new file mode 100644 index 0000000..85ea0ac --- /dev/null +++ b/dashboard/src/components/BridgeModal.jsx @@ -0,0 +1,331 @@ +import React, { useState, useEffect } from 'react'; +import { Copy, Check, CheckCircle2, AlertCircle, Loader2, Link2, Youtube, MessageSquare } from 'lucide-react'; +import Modal from './ui/Modal'; +import { apiFetch } from '../lib/api'; + +// Shorts -> long-form bridge (PLAN #6). The related-video link and comment +// pinning are Studio-UI only, so this panel always carries the manual steps: +// it never pretends the server can set them. +// +// Copy it? Use the copy buttons. Post the first comment automatically? Only +// when you click it, and only on a server with the YouTube Data API wired up. + +// Accept a full YouTube URL or a bare id and return just the id. The published +// Short's id is what the comment endpoint needs; people usually have the URL. +function videoIdFrom(raw) { + const value = String(raw || '').trim(); + if (!value) return ''; + const urlMatch = value.match(/(?:v=|\/shorts\/|youtu\.be\/|\/embed\/)([A-Za-z0-9_-]{6,})/); + if (urlMatch) return urlMatch[1]; + const bare = value.match(/^([A-Za-z0-9_-]{6,})$/); + return bare ? bare[1] : value; +} + +export default function BridgeModal({ isOpen, onClose, jobId, clipIndex }) { + const [data, setData] = useState(null); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + const [copied, setCopied] = useState(null); + + // Checked-off Studio steps, remembered per clip so closing the sheet while + // working through the manual steps doesn't lose your place. + const storageKey = `cw_bridge_check_${jobId}_${clipIndex}`; + const [checkedSteps, setCheckedSteps] = useState({}); + + const [videoId, setVideoId] = useState(''); + const [posting, setPosting] = useState(false); + const [postStatus, setPostStatus] = useState(null); + + useEffect(() => { + if (!isOpen) return undefined; + let cancelled = false; + + setLoading(true); + setError(null); + setData(null); + setPostStatus(null); + setVideoId(''); + try { + setCheckedSteps(JSON.parse(localStorage.getItem(storageKey)) || {}); + } catch { + setCheckedSteps({}); + } + + apiFetch(`/api/clip/${jobId}/${clipIndex}/bridge`) + .then(async (res) => { + if (!res.ok) { + let detail = ''; + const text = await res.text().catch(() => ''); + try { + const j = JSON.parse(text); + if (typeof j.detail === 'string') detail = j.detail; + } catch { /* keep the raw body */ } + throw new Error(detail || `Could not load the bridge (${res.status}).`); + } + return res.json(); + }) + .then((payload) => { if (!cancelled) setData(payload); }) + .catch((e) => { if (!cancelled) setError(e.message || 'Could not load the bridge.'); }) + .finally(() => { if (!cancelled) setLoading(false); }); + + return () => { cancelled = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isOpen, jobId, clipIndex]); + + const handleCopy = async (field, text) => { + try { + await navigator.clipboard.writeText(text || ''); + setCopied(field); + setTimeout(() => setCopied(null), 2000); + } catch { + // clipboard unavailable — silent + } + }; + + const toggleStep = (i) => { + setCheckedSteps((prev) => { + const next = { ...prev, [i]: !prev[i] }; + try { localStorage.setItem(storageKey, JSON.stringify(next)); } catch { /* storage unavailable */ } + return next; + }); + }; + + const handlePostComment = async () => { + const vid = videoIdFrom(videoId); + if (!vid) return; + setPosting(true); + setPostStatus(null); + try { + const res = await apiFetch(`/api/clip/${jobId}/${clipIndex}/bridge/comment`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ video_id: vid, text: data?.first_comment || undefined }), + }); + if (!res.ok) { + let detail = ''; + const text = await res.text().catch(() => ''); + try { + const j = JSON.parse(text); + if (typeof j.detail === 'string') detail = j.detail; + } catch { /* keep the raw body */ } + // A 400 here almost always means the YouTube integration is not + // configured; say that plainly and point at the manual route. + const fallback = res.status === 400 + ? "This server can't post comments yet — the YouTube Data API isn't set up. Copy the comment above and post it in Studio instead." + : `Could not post the comment (${res.status}).`; + setPostStatus({ ok: false, msg: detail || fallback }); + return; + } + await res.json().catch(() => ({})); + setPostStatus({ ok: true, msg: 'Comment posted. Open YouTube Studio and pin it — pinning stays manual.' }); + } catch (e) { + setPostStatus({ ok: false, msg: e.message || 'Could not post the comment.' }); + } finally { + setPosting(false); + } + }; + + // The endpoint reports whether comment posting is available on this server. + // An older/absent field is treated as "try it" — a 400 is handled above. + const configured = data ? data.comment_api_configured !== false : true; + const canPostComment = configured && !!videoId.trim() && !!data?.first_comment; + + return ( + + {loading && ( +
+ loading bridge… +
+ )} + + {!loading && error && ( +
+ + {error} +
+ )} + + {!loading && !error && data && ( +
+

+ Funnel viewers of this Short to a long-form video. The related-video link and the comment pin live only in YouTube Studio, so those steps stay manual. +

+ + {/* Related-video target */} +
+ + {data.related_video_url ? ( +
+ + + {data.related_video_url} + + +
+ ) : ( +
+ + + No related video set for this clip yet. Paste the long-form URL into YouTube Studio's + {' '}Related video field when you set it up — the checklist below has the steps. + +
+ )} +
+ + {/* Manual Studio checklist */} +
+
+ + manual · no api +
+ {Array.isArray(data.checklist) && data.checklist.length > 0 ? ( +
    + {data.checklist.map((step, i) => { + const done = !!checkedSteps[i]; + return ( +
  1. + +
  2. + ); + })} +
+ ) : ( +

no checklist saved for this clip.

+ )} +
+ + {/* Copy-paste copy */} +
+
+ + +
+ {data.description_bridge ? ( +

+ {data.description_bridge} +

+ ) : ( +

+ no description copy generated for this clip. +

+ )} +
+ +
+
+ + +
+ {data.first_comment ? ( +

+ {data.first_comment} +

+ ) : ( +

+ no first comment generated for this clip. +

+ )} +
+ + {/* Optional opt-in comment posting */} +
+
+ + opt-in +
+

+ Optional. clipwright never posts on its own — this runs only when you click the button. Pinning the comment still has to be done by hand in Studio. +

+ + {!configured ? ( +
+ + + This server has no YouTube Data API credentials, so it can't post for you. Copy the comment above and post it in Studio instead. + +
+ ) : ( +
+
+ setVideoId(e.target.value)} + className="input-field sm:flex-1" + placeholder="published Short video id or URL" + aria-label="published Short video id or URL" + /> + +
+ {postStatus && ( +
+ {postStatus.ok + ? + : } + {postStatus.msg} +
+ )} +
+ )} + +

+ related-video link + pin: Studio only +

+
+
+ )} +
+ ); +} diff --git a/dashboard/src/components/MediaInput.jsx b/dashboard/src/components/MediaInput.jsx index 38c1891..4da9c6b 100644 --- a/dashboard/src/components/MediaInput.jsx +++ b/dashboard/src/components/MediaInput.jsx @@ -61,6 +61,13 @@ export default function MediaInput({ onProcess, isProcessing }) { const [layout, setLayout] = useState(() => { try { return localStorage.getItem('cw_layout') || 'auto'; } catch { return 'auto'; } }); + // Channel profile (channels/.json on the server): tunes how the AI + // writes titles, hooks and the description, and how it art-directs the + // thumbnail. Per job and off by default, so nothing changes for anyone who + // does not use profiles. Fetched from GET /api/channels; when that list is + // empty or unreachable the selector simply does not render. + const [channels, setChannels] = useState([]); + const [channel, setChannel] = useState('none'); const infoRef = useRef(null); // Close the compatibility popover on any outside click. @@ -99,6 +106,22 @@ export default function MediaInput({ onProcess, isProcessing }) { .catch(() => {}); }, []); + // Channel profiles available on this install. A missing route, an empty + // directory or a network error all leave the list empty, which keeps the + // selector hidden — profiles are opt-in and never block a job. + useEffect(() => { + let cancelled = false; + fetch(getApiUrl('/api/channels')) + .then((r) => (r.ok ? r.json() : null)) + .then((data) => { + if (cancelled || !data) return; + const list = Array.isArray(data.channels) ? data.channels : []; + setChannels(list.filter((c) => c && c.slug)); + }) + .catch(() => {}); + return () => { cancelled = true; }; + }, []); + // A link pasted in the landing hero: preload it here so the user picks up // where they left off. Not auto-submitted — the rights attestation below // has to be ticked by the user. @@ -124,6 +147,9 @@ export default function MediaInput({ onProcess, isProcessing }) { autoHook, autoHookStyle, layout, + // 'none' = no profile; only a real slug travels, so the default + // request stays byte-identical to the pre-feature one. + channel: channel === 'none' ? null : channel, }; try { localStorage.setItem('cw_auto_hook', autoHook ? '1' : '0'); @@ -291,6 +317,32 @@ export default function MediaInput({ onProcess, isProcessing }) { + {/* Channel profile — only rendered when the install has profiles, + so an empty list or a failed fetch leaves no trace. Tunes the + packaging the AI writes for a job: title, hook, description + and thumbnail. Defaults to no profile. */} + {channels.length > 0 && ( +
+
+

channel profile

+ +
+

+ Tailors titles, hooks, description and thumbnail for that channel. +

+
+ )} + {/* Advanced generation controls — collapsed by default; blank = AI decides */}
diff --git a/dashboard/src/components/ResultCard.jsx b/dashboard/src/components/ResultCard.jsx index bfcb038..dd5eddb 100644 --- a/dashboard/src/components/ResultCard.jsx +++ b/dashboard/src/components/ResultCard.jsx @@ -4,6 +4,7 @@ import { getApiUrl } from '../config'; import { apiFetch } from '../lib/api'; import SubtitleModal from './SubtitleModal'; import HookModal from './HookModal'; +import BridgeModal from './BridgeModal'; import Modal from './ui/Modal'; import { renderInBrowser } from '../lib/renderInBrowser'; @@ -214,6 +215,7 @@ export default function ResultCard({ clip, index, jobId, postizKey, postizUrl, g const [isSubtitling, setIsSubtitling] = useState(false); const [isHooking, setIsHooking] = useState(false); const [showHookModal, setShowHookModal] = useState(false); + const [showBridgeModal, setShowBridgeModal] = useState(false); const [editError, setEditError] = useState(null); const [clipDuration, setClipDuration] = useState(() => { @@ -924,6 +926,15 @@ export default function ResultCard({ clip, index, jobId, postizKey, postizUrl, g {isHooking ? 'saving…' : 'edit hook'} + +