import { useEffect, useState } from "react"; import { get, post } from "../api"; import { useT } from "../i18n"; import { navigate } from "../router"; import { toast } from "../dialogs"; import { Icon } from "./Icon"; import { Spinner } from "./Activity"; interface Draft { spec: string; setup?: string | null; proposal: { name?: string; slug?: string; description?: string } | null; connections: { id: string; name: string; kind: string; owner: string }[]; } export const isDraftChat = (cwd: string) => /\/_drafts\/[^/]+$/.test(cwd); const slugify = (s: string) => s .toLowerCase() .replace(/ä/g, "ae") .replace(/ö/g, "oe") .replace(/ü/g, "ue") .replace(/ß/g, "ss") .replace(/[^a-z0-9]+/g, "-") .replace(/^-+|-+$/g, "") .slice(0, 60); /** Bar above the composer of a spec chat: file the spec as a new repository and start the workflow. */ export function DraftBar({ sessionId }: { sessionId: string }) { const t = useT(); const [open, setOpen] = useState(false); return ( <>
{draft.spec || "–"}