Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

Standardize generation card copy actions

WhiteRaven11771570cf5ec1
diff --git a/packages/studio/src/components/AiInfluencerStudio.jsx b/packages/studio/src/components/AiInfluencerStudio.jsx
index 37e7c40a..8010e053 100644
--- a/packages/studio/src/components/AiInfluencerStudio.jsx
+++ b/packages/studio/src/components/AiInfluencerStudio.jsx
@@ -4,7 +4,9 @@ import { useState, useCallback } from "react";
import toast, { Toaster } from "react-hot-toast";
import { generateImage } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
const CDN = "https://cdn.muapi.ai/influencer";
@@ -416,7 +418,7 @@ export default function AiInfluencerStudio({
}
if (res?.url) {
setCurrentResult(res.url);
- setHistory((prev) => [{ url: res.url, ts: Date.now() }, ...prev]);
+ setHistory((prev) => [{ url: res.url, prompt, ts: Date.now() }, ...prev]);
setSelectedHistoryIdx(0);
onGenerationComplete?.({
url: res.url,
@@ -742,6 +744,13 @@ export default function AiInfluencerStudio({
<img src={item.url} alt={`Character ${idx + 1}`} className="w-full h-full object-cover" />
{/* Download on hover */}
<div className="absolute inset-0 hidden md:flex bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity items-end justify-center pb-2">
+ <div className="absolute right-2 top-2 flex flex-col gap-2">
+ <GenerationCopyButtons
+ prompt={item.prompt}
+ imageUrl={item.url}
+ onCopyError={onGenerationError}
+ />
+ </div>
<div
role="button"
tabIndex={0}
@@ -753,6 +762,9 @@ export default function AiInfluencerStudio({
</div>
</div>
<MobileGenerationActions
+ prompt={item.prompt}
+ imageUrl={item.url}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
diff --git a/packages/studio/src/components/CinemaStudio.jsx b/packages/studio/src/components/CinemaStudio.jsx
index 074aa074..c5e8aa6e 100644
--- a/packages/studio/src/components/CinemaStudio.jsx
+++ b/packages/studio/src/components/CinemaStudio.jsx
@@ -3,7 +3,9 @@
import { useState, useEffect, useRef, useCallback } from "react";
import { generateImage, uploadFile } from "../muapi.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ CopyContentIcon,
+} from "./MobileGenerationActions.jsx";
import {
PromptAspectRatioIcon,
PromptAction,
@@ -45,6 +47,48 @@ const LENS_MAP = {
"Clinical Sharp Prime": "ultra-sharp clinical prime lens",
};
+async function fetchImageAsPngBlob(url) {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`Image request failed with status ${response.status}.`);
+ }
+
+ const sourceBlob = await response.blob();
+ if (sourceBlob.type === "image/png") return sourceBlob;
+
+ const objectUrl = URL.createObjectURL(sourceBlob);
+ try {
+ const image = await new Promise((resolve, reject) => {
+ const element = new Image();
+ element.onload = () => resolve(element);
+ element.onerror = () => reject(new Error("Could not decode the image."));
+ element.src = objectUrl;
+ });
+
+ const canvas = document.createElement("canvas");
+ canvas.width = image.naturalWidth;
+ canvas.height = image.naturalHeight;
+
+ const context = canvas.getContext("2d");
+ if (!context) {
+ throw new Error("Could not create an image clipboard canvas.");
+ }
+
+ context.drawImage(image, 0, 0);
+ return await new Promise((resolve, reject) => {
+ canvas.toBlob(
+ (blob) =>
+ blob
+ ? resolve(blob)
+ : reject(new Error("Could not convert the image to PNG.")),
+ "image/png",
+ );
+ });
+ } finally {
+ URL.revokeObjectURL(objectUrl);
+ }
+}
+
const FOCAL_PERSPECTIVE = {
8: "ultra-wide perspective",
14: "wide-angle perspective",
@@ -518,6 +562,7 @@ export default function CinemaStudio({
const imageInputRef = useRef(null);
const [activeHistoryIndex, setactiveHistoryIndex] = useState(null);
const [copiedPromptIndex, setCopiedPromptIndex] = useState(null);
+ const [copiedImageIndex, setCopiedImageIndex] = useState(null);
// ── Internal history state (used when historyItems prop is not provided) ──
const [internalHistory, setInternalHistory] = useState([]);
@@ -725,6 +770,38 @@ export default function CinemaStudio({
[onGenerationError],
);
+ const handleCopyImage = useCallback(
+ async (url, index) => {
+ if (!url) return;
+
+ try {
+ if (
+ !window.isSecureContext ||
+ !navigator.clipboard?.write ||
+ typeof window.ClipboardItem === "undefined"
+ ) {
+ throw new Error("Image clipboard access requires HTTPS or localhost.");
+ }
+
+ await navigator.clipboard.write([
+ new window.ClipboardItem({
+ "image/png": fetchImageAsPngBlob(url),
+ }),
+ ]);
+ setCopiedImageIndex(index);
+ window.setTimeout(() => {
+ setCopiedImageIndex((current) => (current === index ? null : current));
+ }, 1600);
+ } catch (error) {
+ console.error("Failed to copy the image:", error);
+ onGenerationError?.(
+ "Could not copy the image. Image copy requires HTTPS or localhost.",
+ );
+ }
+ },
+ [onGenerationError],
+ );
+
const resetToPrompt = () => {
setCanvasUrl(null);
setSettings((prev) => ({ ...prev, prompt: "" }));
@@ -755,6 +832,46 @@ export default function CinemaStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <button
+ type="button"
+ title={copiedPromptIndex === idx ? "Prompt copied" : "Copy prompt"}
+ aria-label={copiedPromptIndex === idx ? "Prompt copied" : "Copy prompt"}
+ onClick={(event) => {
+ event.stopPropagation();
+ handleCopyPrompt(entry.settings?.prompt, idx);
+ }}
+ className={`flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-black/60 font-black backdrop-blur-md transition-all hover:bg-[#22d3ee] hover:text-black ${
+ copiedPromptIndex === idx ? "text-[#22d3ee]" : "text-white"
+ }`}
+ >
+ {copiedPromptIndex === idx ? (
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
+ <path d="M5 12l4 4L19 6" />
+ </svg>
+ ) : (
+ <CopyContentIcon kind="text" size={17} />
+ )}
+ </button>
+ <button
+ type="button"
+ title={copiedImageIndex === idx ? "Image copied" : "Copy image"}
+ aria-label={copiedImageIndex === idx ? "Image copied" : "Copy image"}
+ onClick={(event) => {
+ event.stopPropagation();
+ handleCopyImage(entry.url, idx);
+ }}
+ className={`flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-black/60 backdrop-blur-md transition-all hover:bg-[#22d3ee] hover:text-black ${
+ copiedImageIndex === idx ? "text-[#22d3ee]" : "text-white"
+ }`}
+ >
+ {copiedImageIndex === idx ? (
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
+ <path d="M5 12l4 4L19 6" />
+ </svg>
+ ) : (
+ <CopyContentIcon kind="image" size={17} />
+ )}
+ </button>
<button
type="button"
title="Download"
@@ -802,6 +919,17 @@ export default function CinemaStudio({
</div>
<MobileGenerationActions
actions={[
+ {
+ kind: "text",
+ label: "Copy prompt",
+ onSelect: () =>
+ handleCopyPrompt(entry.settings?.prompt, idx),
+ },
+ {
+ kind: "image",
+ label: "Copy image",
+ onSelect: () => handleCopyImage(entry.url, idx),
+ },
{
kind: "download",
label: "Download",
@@ -837,32 +965,18 @@ export default function CinemaStudio({
{/* Details */}
<div className="p-3 bg-black/80 backdrop-blur-sm border-t border-white/5 flex-1 flex flex-col justify-between gap-2">
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- handleCopyPrompt(entry.settings?.prompt, idx);
- }}
- className={`w-full text-left text-xs line-clamp-3 leading-relaxed transition-colors cursor-copy ${
- copiedPromptIndex === idx
- ? "text-[#22d3ee]"
- : "text-white/70 hover:text-white"
- }`}
- title={
- copiedPromptIndex === idx
- ? "Prompt copied"
- : "Copy full prompt"
- }
- aria-label={
- copiedPromptIndex === idx
- ? "Prompt copied"
- : "Copy full prompt"
- }
+ <p
+ className="w-full text-left text-xs line-clamp-3 leading-relaxed text-white/70"
+ title={entry.settings?.prompt || "No prompt"}
>
{entry.settings?.prompt || "No prompt"}
- </button>
+ </p>
<span className="sr-only" aria-live="polite">
- {copiedPromptIndex === idx ? "Prompt copied" : ""}
+ {copiedPromptIndex === idx
+ ? "Prompt copied"
+ : copiedImageIndex === idx
+ ? "Image copied"
+ : ""}
</span>
<div className="flex items-center mt-1 flex-wrap gap-1">
<div className="flex items-center gap-2">
diff --git a/packages/studio/src/components/ClippingStudio.jsx b/packages/studio/src/components/ClippingStudio.jsx
index 507a67c0..79ead61f 100644
--- a/packages/studio/src/components/ClippingStudio.jsx
+++ b/packages/studio/src/components/ClippingStudio.jsx
@@ -5,7 +5,9 @@ import toast, { Toaster } from "react-hot-toast";
import { runClipping, uploadFile } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
PROMPT_CONTROL_LABEL_CLASS,
PROMPT_MEDIA_PREVIEW_CLASS,
@@ -806,6 +808,10 @@ export default function ClippingStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 z-10 hidden md:flex flex-col gap-2 opacity-0 group-hover/vid:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={result.prompt}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Copy Link"
@@ -830,6 +836,8 @@ export default function ClippingStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={result.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "copy",
@@ -863,20 +871,6 @@ export default function ClippingStudio({
</span>
<span className="text-[10px] text-white/40">{result.aspectRatio || `Clip #${i + 1}`}</span>
</div>
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(result.prompt || clipUrl);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
</div>
</div>
</div>
diff --git a/packages/studio/src/components/ImageStudio.jsx b/packages/studio/src/components/ImageStudio.jsx
index 43c07900..ccda0652 100644
--- a/packages/studio/src/components/ImageStudio.jsx
+++ b/packages/studio/src/components/ImageStudio.jsx
@@ -6,7 +6,9 @@ import { generateImage, generateI2I, uploadFile } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
import DrawModal from "./DrawModal.jsx";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
t2iModels,
i2iModels,
@@ -1313,6 +1315,11 @@ export default function ImageStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ imageUrl={entry.url}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Download"
@@ -1346,6 +1353,9 @@ export default function ImageStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ imageUrl={entry.url}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -1378,22 +1388,6 @@ export default function ImageStudio({
</span>
<span className="text-[10px] text-white/40">{entry.aspect_ratio}</span>
</div>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
</div>
diff --git a/packages/studio/src/components/LipSyncStudio.jsx b/packages/studio/src/components/LipSyncStudio.jsx
index 13ad351a..e213a6d1 100644
--- a/packages/studio/src/components/LipSyncStudio.jsx
+++ b/packages/studio/src/components/LipSyncStudio.jsx
@@ -5,7 +5,9 @@ import toast, { Toaster } from "react-hot-toast";
import { processLipSync, uploadFile } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
lipsyncModels,
imageLipSyncModels,
@@ -777,6 +779,10 @@ export default function LipSyncStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Download"
@@ -810,6 +816,8 @@ export default function LipSyncStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -846,22 +854,6 @@ export default function LipSyncStudio({
<span className="text-[10px] text-white/40">{entry.resolution}</span>
)}
</div>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
</div>
diff --git a/packages/studio/src/components/MarketingStudio.jsx b/packages/studio/src/components/MarketingStudio.jsx
index 53e1d870..8143127e 100644
--- a/packages/studio/src/components/MarketingStudio.jsx
+++ b/packages/studio/src/components/MarketingStudio.jsx
@@ -3,7 +3,9 @@
import { useState, useEffect, useRef, useCallback } from "react";
import { uploadFile, generateMarketingStudioAd } from "../muapi.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
PROMPT_CONTROL_LABEL_CLASS,
PromptAspectRatioIcon,
@@ -440,6 +442,10 @@ export default function MarketingStudio({
{/* Actions Overlay */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
+ />
<button
onClick={(e) => { e.stopPropagation(); downloadFile(entry.url, `marketing-ad-${entry.id}.mp4`); }}
className="p-2 bg-black/60 backdrop-blur-md rounded-full text-white hover:bg-primary hover:text-black transition-all border border-white/10"
@@ -471,6 +477,8 @@ export default function MarketingStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -504,21 +512,6 @@ export default function MarketingStudio({
<span className="text-[9px] text-white/40 font-bold">{entry.format}</span>
)}
</div>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy Prompt"; }, 2000);
- }}
- className="px-2 py-1 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
))}
diff --git a/packages/studio/src/components/MobileGenerationActions.jsx b/packages/studio/src/components/MobileGenerationActions.jsx
index 7192899c..136ae6b8 100644
--- a/packages/studio/src/components/MobileGenerationActions.jsx
+++ b/packages/studio/src/components/MobileGenerationActions.jsx
@@ -2,7 +2,216 @@
import { useState } from "react";
+async function getClipboardPngBlob(url) {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`Image request failed with status ${response.status}.`);
+ }
+
+ const sourceBlob = await response.blob();
+ if (sourceBlob.type === "image/png") return sourceBlob;
+
+ const objectUrl = URL.createObjectURL(sourceBlob);
+ try {
+ const image = await new Promise((resolve, reject) => {
+ const element = new Image();
+ element.onload = () => resolve(element);
+ element.onerror = () => reject(new Error("Could not decode the image."));
+ element.src = objectUrl;
+ });
+
+ const canvas = document.createElement("canvas");
+ canvas.width = image.naturalWidth;
+ canvas.height = image.naturalHeight;
+
+ const context = canvas.getContext("2d");
+ if (!context) {
+ throw new Error("Could not create an image clipboard canvas.");
+ }
+
+ context.drawImage(image, 0, 0);
+ return await new Promise((resolve, reject) => {
+ canvas.toBlob(
+ (blob) =>
+ blob
+ ? resolve(blob)
+ : reject(new Error("Could not convert the image to PNG.")),
+ "image/png",
+ );
+ });
+ } finally {
+ URL.revokeObjectURL(objectUrl);
+ }
+}
+
+async function copyPrompt(prompt) {
+ if (!prompt) return;
+ await navigator.clipboard.writeText(prompt);
+}
+
+async function copyImage(url) {
+ if (!url) return;
+ if (
+ !window.isSecureContext ||
+ !navigator.clipboard?.write ||
+ typeof window.ClipboardItem === "undefined"
+ ) {
+ throw new Error("Image clipboard access requires HTTPS or localhost.");
+ }
+
+ await navigator.clipboard.write([
+ new window.ClipboardItem({
+ "image/png": getClipboardPngBlob(url),
+ }),
+ ]);
+}
+
+export function CopyContentIcon({ kind, size = 19 }) {
+ const isText = kind === "text";
+
+ if (!isText) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M6 5V4.5A2.5 2.5 0 018.5 2H19a3 3 0 013 3v10.5a2.5 2.5 0 01-2.5 2.5H19" opacity="0.65" />
+ <rect x="2" y="6" width="17" height="16" rx="2.5" strokeWidth="2.2" />
+ <circle cx="6.5" cy="10.5" r="1.25" />
+ <path d="M3.5 19l4.2-4.4 3.1 3.1 2.4-2.5 4.3 4.2" strokeWidth="2.2" />
+ </svg>
+ );
+ }
+
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M2.5 3.5h13" strokeWidth="2.7" />
+ <path d="M9 3.5v14" strokeWidth="2.7" />
+ <path
+ d="M19 15.25V14.2A1.2 1.2 0 0017.8 13h-3.6a1.2 1.2 0 00-1.2 1.2v3.6a1.2 1.2 0 001.2 1.2h1.05"
+ strokeWidth="1.6"
+ />
+ <rect x="15.25" y="15.25" width="6.25" height="6.25" rx="1.15" strokeWidth="1.6" />
+ </svg>
+ );
+}
+
+function CopiedIcon({ size = 15 }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M5 12l4 4L19 6" />
+ </svg>
+ );
+}
+
+export function GenerationCopyButtons({
+ prompt,
+ imageUrl,
+ onCopyError,
+}) {
+ const [copiedKind, setCopiedKind] = useState(null);
+
+ const runCopy = async (event, kind) => {
+ event.stopPropagation();
+
+ try {
+ if (kind === "text") {
+ await copyPrompt(prompt);
+ } else {
+ await copyImage(imageUrl);
+ }
+
+ setCopiedKind(kind);
+ window.setTimeout(() => {
+ setCopiedKind((current) => (current === kind ? null : current));
+ }, 1600);
+ } catch (error) {
+ const contentLabel = kind === "text" ? "the prompt" : "the image";
+ console.error(`Failed to copy ${contentLabel}:`, error);
+ onCopyError?.(
+ kind === "text"
+ ? "Could not copy the prompt to the clipboard."
+ : "Could not copy the image. Image copy requires HTTPS or localhost.",
+ );
+ }
+ };
+
+ return (
+ <>
+ {prompt && (
+ <button
+ type="button"
+ title={copiedKind === "text" ? "Prompt copied" : "Copy prompt"}
+ aria-label={copiedKind === "text" ? "Prompt copied" : "Copy prompt"}
+ onClick={(event) => runCopy(event, "text")}
+ className={`flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-black/60 backdrop-blur-md transition-all hover:bg-[#22d3ee] hover:text-black ${
+ copiedKind === "text" ? "text-[#22d3ee]" : "text-white"
+ }`}
+ >
+ {copiedKind === "text" ? (
+ <CopiedIcon />
+ ) : (
+ <CopyContentIcon kind="text" size={17} />
+ )}
+ </button>
+ )}
+ {imageUrl && (
+ <button
+ type="button"
+ title={copiedKind === "image" ? "Image copied" : "Copy image"}
+ aria-label={copiedKind === "image" ? "Image copied" : "Copy image"}
+ onClick={(event) => runCopy(event, "image")}
+ className={`flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-black/60 backdrop-blur-md transition-all hover:bg-[#22d3ee] hover:text-black ${
+ copiedKind === "image" ? "text-[#22d3ee]" : "text-white"
+ }`}
+ >
+ {copiedKind === "image" ? (
+ <CopiedIcon />
+ ) : (
+ <CopyContentIcon kind="image" size={17} />
+ )}
+ </button>
+ )}
+ </>
+ );
+}
+
function ActionIcon({ kind }) {
+ if (kind === "text") {
+ return <CopyContentIcon kind="text" />;
+ }
+
+ if (kind === "image") {
+ return <CopyContentIcon kind="image" />;
+ }
+
if (kind === "download") {
return (
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
@@ -56,9 +265,46 @@ function ActionIcon({ kind }) {
);
}
-export default function MobileGenerationActions({ actions = [] }) {
+export default function MobileGenerationActions({
+ actions = [],
+ prompt,
+ imageUrl,
+ onCopyError,
+}) {
const [open, setOpen] = useState(false);
- const availableActions = actions.filter(Boolean);
+ const copyActions = [
+ prompt
+ ? {
+ kind: "text",
+ label: "Copy prompt",
+ onSelect: async () => {
+ try {
+ await copyPrompt(prompt);
+ } catch (error) {
+ console.error("Failed to copy the prompt:", error);
+ onCopyError?.("Could not copy the prompt to the clipboard.");
+ }
+ },
+ }
+ : null,
+ imageUrl
+ ? {
+ kind: "image",
+ label: "Copy image",
+ onSelect: async () => {
+ try {
+ await copyImage(imageUrl);
+ } catch (error) {
+ console.error("Failed to copy the image:", error);
+ onCopyError?.(
+ "Could not copy the image. Image copy requires HTTPS or localhost.",
+ );
+ }
+ },
+ }
+ : null,
+ ];
+ const availableActions = [...copyActions, ...actions].filter(Boolean);
if (availableActions.length === 0) return null;
diff --git a/packages/studio/src/components/RecastStudio.jsx b/packages/studio/src/components/RecastStudio.jsx
index a2770815..1f810372 100644
--- a/packages/studio/src/components/RecastStudio.jsx
+++ b/packages/studio/src/components/RecastStudio.jsx
@@ -5,7 +5,9 @@ import toast, { Toaster } from "react-hot-toast";
import { processRecast, uploadFile } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
recastModels,
getRecastModelById,
@@ -810,6 +812,10 @@ export default function RecastStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Download"
@@ -843,6 +849,8 @@ export default function RecastStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -874,22 +882,6 @@ export default function RecastStudio({
<span className="text-[10px] font-bold text-primary px-2 py-0.5 bg-primary/10 rounded border border-primary/20 whitespace-nowrap">
Body Swap
</span>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
</div>
diff --git a/packages/studio/src/components/VibeMotionStudio.jsx b/packages/studio/src/components/VibeMotionStudio.jsx
index 6cbd5dae..11a6c2f0 100644
--- a/packages/studio/src/components/VibeMotionStudio.jsx
+++ b/packages/studio/src/components/VibeMotionStudio.jsx
@@ -5,7 +5,9 @@ import toast, { Toaster } from "react-hot-toast";
import { runMotionGraphics, runMotionGraphicsEdit } from "../muapi.js";
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
PROMPT_CONTROL_LABEL_CLASS,
PromptAspectRatioIcon,
@@ -334,6 +336,10 @@ export default function VibeMotionStudio({
{/* ── Hover overlay actions ── */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Download"
@@ -395,6 +401,8 @@ export default function VibeMotionStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -445,22 +453,6 @@ export default function VibeMotionStudio({
)}
</div>
</div>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
</div>
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsx
index 0b6580e8..dd477008 100644
--- a/packages/studio/src/components/VideoStudio.jsx
+++ b/packages/studio/src/components/VideoStudio.jsx
@@ -6,7 +6,9 @@ import { generateVideo, generateI2V, processV2V, uploadFile } from "../muapi.js"
import { formatErrorMessage } from "../utils/formatError.js";
import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";
import DrawModal from "./DrawModal.jsx";
-import MobileGenerationActions from "./MobileGenerationActions.jsx";
+import MobileGenerationActions, {
+ GenerationCopyButtons,
+} from "./MobileGenerationActions.jsx";
import {
t2vModels,
i2vModels,
@@ -1388,6 +1390,10 @@ export default function VideoStudio({
{/* Overlay actions */}
<div className="absolute top-2 right-2 hidden md:flex flex-col gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <GenerationCopyButtons
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
+ />
<button
type="button"
title="Download"
@@ -1437,6 +1443,8 @@ export default function VideoStudio({
</button>
</div>
<MobileGenerationActions
+ prompt={entry.prompt}
+ onCopyError={onGenerationError}
actions={[
{
kind: "download",
@@ -1484,22 +1492,6 @@ export default function VideoStudio({
)}
</div>
</div>
- {entry.prompt && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(entry.prompt);
- const btn = e.currentTarget;
- btn.innerText = "Copied!";
- setTimeout(() => { btn.innerText = "Copy"; }, 2000);
- }}
- className="px-2 py-0.5 bg-white/5 hover:bg-primary/20 hover:text-primary rounded text-[10px] font-medium text-white/70 transition-all border border-white/10"
- title="Copy prompt"
- >
- Copy Prompt
- </button>
- )}
</div>
</div>
</div>