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.
74 lines
3.0 KiB
TypeScript
74 lines
3.0 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import Link from "next/link";
|
|
import { Share2 } from "lucide-react";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import { friendlyErrorMessage } from "@/src/shared/errors/friendly";
|
|
import { startSocialConnect } from "../_lib/api";
|
|
import type { SectionProps } from "./AdAccountsSection";
|
|
|
|
/** Social accounts: one per platform, shared by the workspace (reuses Autopost connections). */
|
|
export function SocialSection({ data, scope, getToken }: SectionProps) {
|
|
const [busy, setBusy] = React.useState("");
|
|
const [error, setError] = React.useState("");
|
|
|
|
const connect = async (provider: string) => {
|
|
setBusy(provider);
|
|
setError("");
|
|
try {
|
|
const { authorize_url } = await startSocialConnect(provider, scope, { token: (await getToken()) ?? "" });
|
|
window.location.assign(authorize_url);
|
|
} catch (err) {
|
|
setError(friendlyErrorMessage(err, "Could not start connecting."));
|
|
setBusy("");
|
|
}
|
|
};
|
|
|
|
return (
|
|
<section aria-labelledby="social-accounts" className="space-y-4">
|
|
<div>
|
|
<h2 id="social-accounts" className="flex items-center gap-2 text-xl font-semibold">
|
|
<Share2 className="size-5 text-primary" aria-hidden />
|
|
Social accounts
|
|
</h2>
|
|
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
|
Publish finished videos straight from a project. One account per platform, shared by the workspace.
|
|
</p>
|
|
</div>
|
|
<div className="grid gap-4 sm:grid-cols-3">
|
|
{data.social.platforms.map((platform) => (
|
|
<Card key={platform.provider}>
|
|
<CardContent className="flex h-full flex-col gap-3 p-5">
|
|
<div className="flex items-center justify-between gap-2">
|
|
<h3 className="font-semibold">{platform.label}</h3>
|
|
<Badge variant={platform.account ? "success" : "secondary"}>
|
|
{platform.account ? "Connected" : "Not connected"}
|
|
</Badge>
|
|
</div>
|
|
<p className="text-sm text-muted-foreground">
|
|
{platform.account ? `@${platform.account.handle}` : platform.ready ? "No account yet" : "Not available yet"}
|
|
</p>
|
|
<div className="mt-auto">
|
|
{platform.account ? (
|
|
<Button asChild variant="outline" size="sm">
|
|
<Link href="/autopost/accounts">Manage</Link>
|
|
</Button>
|
|
) : !platform.ready ? null : (
|
|
<Button size="sm" disabled={!data.social.can_manage || busy !== ""}
|
|
onClick={() => void connect(platform.provider)}>
|
|
Connect
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
))}
|
|
</div>
|
|
{error ? <p role="alert" className="text-sm text-destructive">{error}</p> : null}
|
|
</section>
|
|
);
|
|
}
|