"use client"; import { useEffect, useRef, useState, type FormEvent } from "react"; import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; import { ArrowUpRight, Camera, Check, Globe2, Heart, LockKeyhole, MapPin, MessageCircle, Radio, Send, Users, } from "lucide-react"; import { WechatOaModal } from "~/components/social-follow"; import SiteShell from "./SiteShell"; import JoinPayModal from "./JoinPayModal"; import AvatarSelfieModal, { type SelfieCapturePayload, } from "./AvatarSelfieModal"; import { PageIntro } from "./SocialUI"; import { useSocialConfig } from "./SocialExperience"; import { socialApi } from "@social/lib/api"; import { useCaptureCapability } from "@social/lib/useCaptureCapability"; import { getLivenessState, isLivenessVerified, markFaceOk, markLivenessVerified, } from "@social/lib/livenessGate"; import { JOIN_AVAILABILITY_OPTIONS, JOIN_EDUCATION_OPTIONS, JOIN_GENDER_OPTIONS, JOIN_INTENT_OPTIONS, JOIN_PROFILE_RETURN, JOIN_RELATIONSHIP_OPTIONS, JOIN_STATUS_OPTIONS, isJoinPaid, isJoinProfileDone, markJoinPaid, markJoinProfileDone, type JoinOption, type JoinProfileDraft, } from "@social/lib/joinFlow"; import { setRosterPublished } from "@social/lib/discoveryRoster"; import { loadJson, saveJson } from "@social/lib/storage"; import { useLocalState } from "@social/lib/useLocalState"; import { socialPath } from "@social/lib/socialPath"; import { resolveSocialLandingCopy } from "@social/lib/landing"; import { useSocialI18n } from "@social/lib/useSocialI18n"; import { socialTx } from "@social/lib/socialTx"; import type { SocialRosterProfile } from "@social/lib/types"; export function CommunityFeedback() { const [draft, setDraft] = useLocalState<{ kind: "反馈" | "建议"; text: string; contact: string; }>("feedback-draft", { kind: "建议", text: "", contact: "" }); const [delivery, setDelivery] = useLocalState("feedback-delivery", "draft"); const [status, setStatus] = useState(""); const [busy, setBusy] = useState(false); const lock = useRef(false); const update = (key: keyof typeof draft, value: string) => { setDraft((current) => ({ ...current, [key]: value })); setDelivery("draft"); setStatus(""); }; const reset = () => { setDraft({ kind: "建议", text: "", contact: "" }); setDelivery("draft"); setStatus(""); }; const submit = async (event: FormEvent) => { event.preventDefault(); if (!draft.text.trim() || lock.current || delivery === "sent") return; lock.current = true; setBusy(true); try { await socialApi.postFeedback({ ...draft, text: draft.text.trim(), contact: draft.contact.trim(), }); setDelivery("sent"); setStatus("已提交,感谢反馈。"); } catch { setDelivery("local"); setStatus("先留在你这边了,有网后再试一次"); } finally { lock.current = false; setBusy(false); } }; return (
{socialTx("说说你的想法")}

{socialTx("哪里用得不顺手?告诉我们")}

{socialTx("发不出去也没关系,会先留在你这边,有网后再试。我们会看,但不保证马上回复。")}

{delivery === "sent" ? (

{status || "已提交"}

{socialTx("回社区首页")}
) : (
void submit(event)}>
{(["建议", "反馈"] as const).map((kind) => ( ))}