Spaces:
Runtime error
Runtime error
File size: 1,158 Bytes
bdd1640 fa6e4a3 bdd1640 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { useState } from "react";
import type { Artifact } from "../../api/types";
import { ScheduleModal } from "../ScheduleModal";
/** What can go out on X / LinkedIn: images (a slide deck's slides too), videos and text. Not audio (neither platform
* takes audio files). */
const POSTABLE = new Set(["video", "quote_card", "carousel", "summary", "launch_kit", "mind_map", "slide_deck"]);
export function canPost(a: Artifact): boolean {
if (!POSTABLE.has(a.type)) return false;
if (a.provider === "blog2video") return Boolean((a.content as { video_url?: string } | null)?.video_url);
return a.status === "ready";
}
/** "Post": opens the composer with this item attached and its text filled in. */
export function PostButton({ artifactId, className = "btn btn-small", label = "Post" }: {
artifactId: string;
className?: string;
label?: string;
}) {
const [open, setOpen] = useState(false);
return (
<>
<button type="button" className={className} onClick={() => setOpen(true)}>{label}</button>
{open && <ScheduleModal platform="linkedin" posts={[]} artifactId={artifactId} onClose={() => setOpen(false)} />}
</>
);
}
|