{gig.title}
{gig.role}
"use client"; import { useMemo, useRef, useState, type FormEvent } from "react"; import Link from "next/link"; import { ArrowUpRight, BookOpen, BriefcaseBusiness, Check, Globe2, HeartHandshake, Send, Sparkles, } from "lucide-react"; import SiteShell from "./SiteShell"; import { BookmarkButton, DemoBadge, EmptyState, PageIntro, SearchField, SocialDialog, } from "./SocialUI"; import { TEAM_KIND_LABEL } from "@social/lib/seed"; import { socialApi } from "@social/lib/api"; import { useLocalState } from "@social/lib/useLocalState"; import { resolveSocialCatalog } from "@social/lib/resolveCatalog"; import { useSocialConfig } from "./SocialExperience"; import { socialPath } from "@social/lib/socialPath"; import type { SocialGig, SocialTeamKind } from "@social/lib/types"; const NOTE_PROMPTS = [ "做过类似项目…", "每周可投入…", "作品在这里…", "想一起做成…", ] as const; function ApplicationForm({ gig }: { gig: SocialGig }) { const [draft, setDraft] = useLocalState(`gig-draft:${gig.id}`, { name: "", contact: "", note: "", }); const [delivery, setDelivery] = useLocalState( `gig-delivery:${gig.id}`, "draft", ); const [status, setStatus] = useState(""); const [busy, setBusy] = useState(false); const lock = useRef(false); const filled = Number(Boolean(draft.name.trim())) + Number(Boolean(draft.contact.trim())) + Number(Boolean(draft.note.trim())); const update = (key: keyof typeof draft, value: string) => { setDraft((current) => ({ ...current, [key]: value })); setDelivery("draft"); setStatus(""); }; const submit = async (event: FormEvent) => { event.preventDefault(); if ( lock.current || delivery === "sent" || !draft.name.trim() || !draft.contact.trim() ) return; lock.current = true; setBusy(true); try { await socialApi.applyGig(gig.id, { name: draft.name.trim(), contact: draft.contact.trim(), note: draft.note.trim(), }); setDelivery("sent"); setStatus("申请已提交。对方看到后会再联系你——先不急。"); } catch { setDelivery("local"); setStatus("申请已先留在本机。有网后再点一次即可重试。"); } finally { lock.current = false; setBusy(false); } }; if (delivery === "sent") { return (
{status || "对方看到后会再联系你。"}
{gig.role}
远程也能一起推进:认领角色、写申请,草稿会先留在本机。
{gig.role}