Choose a title for your space:
setConfig({ ...config, title: e.target.value }) } className="!bg-white !border-neutral-300 !text-neutral-800 !placeholder:text-neutral-400 selection:!bg-blue-100" />Then, let's deploy it!
/* eslint-disable @typescript-eslint/no-explicit-any */ import { useState } from "react"; import { toast } from "sonner"; import Image from "next/image"; import { useRouter } from "next/navigation"; import { MdSave } from "react-icons/md"; import { Rocket } from "lucide-react"; import SpaceIcon from "@/assets/space.svg"; import Loading from "@/components/loading"; import { Button } from "@/components/ui/button"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Input } from "@/components/ui/input"; import { api } from "@/lib/api"; import { LoginModal } from "@/components/login-modal"; import { useUser } from "@/hooks/useUser"; export function DeployButton({ html, prompts, }: { html: string; prompts: string[]; }) { const router = useRouter(); const { user } = useUser(); const [loading, setLoading] = useState(false); const [open, setOpen] = useState(false); const [config, setConfig] = useState({ title: "", }); const createSpace = async () => { if (!config.title) { toast.error("Please enter a title for your space."); return; } setLoading(true); try { const res = await api.post("/me/projects", { title: config.title, html, prompts, }); if (res.data.ok) { router.push(`/projects/${res.data.path}?deploy=true`); } else { toast.error(res?.data?.error || "Failed to create space"); } } catch (err: any) { toast.error(err.response?.data?.error || err.message); } finally { setLoading(false); } }; // TODO add a way to do not allow people to deploy if the html is broken. return (
Deploy as Space!
Save and Deploy your project to a Space on the Hub. Spaces are a way to share your project with the world.
Choose a title for your space:
setConfig({ ...config, title: e.target.value }) } className="!bg-white !border-neutral-300 !text-neutral-800 !placeholder:text-neutral-400 selection:!bg-blue-100" />Then, let's deploy it!