Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
106 lines
3.3 KiB
TypeScript
106 lines
3.3 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import type { SocialMeta } from "@/lib/types";
|
|
import { Label } from "@/components/ui/label";
|
|
import { CopyButton } from "@/components/social/CopyButton";
|
|
|
|
export interface SocialResultProps {
|
|
meta: SocialMeta;
|
|
}
|
|
|
|
/** Join the whole post into one block for the "copy all" affordance. */
|
|
function composePost(meta: SocialMeta): string {
|
|
return [
|
|
meta.title.trim(),
|
|
meta.caption.trim(),
|
|
meta.hashtags.join(" ").trim(),
|
|
]
|
|
.filter((part) => part.length > 0)
|
|
.join("\n\n");
|
|
}
|
|
|
|
/**
|
|
* Renders the generated post copy: a title, caption, and hashtag chips, each with
|
|
* its own copy-to-clipboard button, plus a single "Copy all" that copies the full
|
|
* post (title + caption + hashtags). Pure presentation — the parent owns loading
|
|
* and error state.
|
|
*/
|
|
export function SocialResult({ meta }: Readonly<SocialResultProps>) {
|
|
const wholePost = React.useMemo(() => composePost(meta), [meta]);
|
|
const hasContent = wholePost.length > 0;
|
|
|
|
return (
|
|
<div className="space-y-4 rounded-lg border border-border p-4">
|
|
<div className="flex items-center justify-between gap-3">
|
|
<p className="text-sm font-medium text-foreground">Generated post</p>
|
|
<CopyButton
|
|
value={wholePost}
|
|
label="Copy the full post (title, caption, and hashtags)"
|
|
variant="default"
|
|
>
|
|
Copy all
|
|
</CopyButton>
|
|
</div>
|
|
|
|
{!hasContent && (
|
|
<p className="text-sm text-muted-foreground">
|
|
The generator returned no copy for this platform. Try regenerating.
|
|
</p>
|
|
)}
|
|
|
|
{meta.title.trim().length > 0 && (
|
|
<div className="space-y-1.5">
|
|
<div className="flex items-center justify-between gap-3">
|
|
<Label>Title</Label>
|
|
<CopyButton value={meta.title} label="Copy title" size="sm" />
|
|
</div>
|
|
<p className="whitespace-pre-wrap break-words text-sm text-foreground">
|
|
{meta.title}
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{meta.caption.trim().length > 0 && (
|
|
<div className="space-y-1.5">
|
|
<div className="flex items-center justify-between gap-3">
|
|
<Label>Caption</Label>
|
|
<CopyButton value={meta.caption} label="Copy caption" size="sm" />
|
|
</div>
|
|
<p className="whitespace-pre-wrap break-words text-sm text-muted-foreground">
|
|
{meta.caption}
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{meta.hashtags.length > 0 && (
|
|
<div className="space-y-1.5">
|
|
<div className="flex items-center justify-between gap-3">
|
|
<Label>Hashtags</Label>
|
|
<CopyButton
|
|
value={meta.hashtags.join(" ")}
|
|
label="Copy all hashtags"
|
|
size="sm"
|
|
/>
|
|
</div>
|
|
<ul className="flex flex-wrap gap-2">
|
|
{meta.hashtags.map((tag, index) => (
|
|
<li key={`${tag}-${index}`}>
|
|
<CopyButton
|
|
value={tag}
|
|
label={`Copy hashtag ${tag}`}
|
|
variant="secondary"
|
|
size="sm"
|
|
className="font-mono text-xs"
|
|
>
|
|
{tag}
|
|
</CopyButton>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|