,
- [likesSnapshot],
- );
+ const likes = useRosterLikes();
if (!member) {
return (
@@ -91,8 +61,7 @@ export default function PeopleProfileClient({ id }: { id: string }) {
.slice(0, 4);
const toggleLike = () => {
- saveJson(LIKE_KEY, { ...likes, [member.id]: !liked });
- window.dispatchEvent(new Event(LIKES_CHANGED));
+ setRosterLike(member.id, !liked);
};
const intro = encodeURIComponent(
@@ -149,6 +118,8 @@ export default function PeopleProfileClient({ id }: { id: string }) {
type="button"
className={`social-btn${liked ? " coral" : ""}`}
onClick={toggleLike}
+ aria-pressed={liked}
+ title="关注保存在当前设备"
>
{liked ? "已关注" : "关注一下"}
diff --git a/src/modules/social/components/ProfileStudio.tsx b/src/modules/social/components/ProfileStudio.tsx
index 4cf5af6..477d59b 100644
--- a/src/modules/social/components/ProfileStudio.tsx
+++ b/src/modules/social/components/ProfileStudio.tsx
@@ -212,12 +212,12 @@ export default function ProfileStudio() {
setRosterPublished(next);
setStatus(
next
- ? "好的,别人在「想见的人」里能看到你(仅当前这台设备的示例列表)。"
- : "已先藏起来,别人暂时看不到你。",
+ ? "已加入当前设备的发现列表,方便预览。不会向其他用户公开发布。"
+ : "已从当前设备的发现列表隐藏。",
);
}}
/>
- 出现在「想见的人 / 认识一下」里,让别人看到我
+ 在当前设备的「想见的人」中预览我的介绍
{published && complete < 5 ? (
diff --git a/src/modules/social/components/ResourceLibrary.tsx b/src/modules/social/components/ResourceLibrary.tsx
index 76ae689..ac08c3d 100644
--- a/src/modules/social/components/ResourceLibrary.tsx
+++ b/src/modules/social/components/ResourceLibrary.tsx
@@ -1,7 +1,7 @@
"use client";
import Link from "next/link";
-import { useRef, useState, type FormEvent } from "react";
+import { useRef, useState, useSyncExternalStore, type FormEvent } from "react";
import {
ArrowUpRight,
BookOpen,
@@ -19,6 +19,7 @@ import {
EmptyState,
PageIntro,
SearchField,
+ ResultSummary,
ShareButton,
SocialDialog,
} from "./SocialUI";
@@ -26,6 +27,7 @@ import { useSocialConfig } from "./SocialExperience";
import { SEED_EBOOKS, SEED_VIDEOS } from "@social/lib/seed";
import { useLocalState } from "@social/lib/useLocalState";
import { socialPath } from "@social/lib/socialPath";
+import { socialApi } from "@social/lib/api";
type Kind = "videos" | "date" | "ebook";
const COPY = {
@@ -34,6 +36,23 @@ const COPY = {
ebook: { title: "共创 · 小册", accent: "大家写的" },
};
+function subscribeSelection(callback: () => void) {
+ window.addEventListener("hashchange", callback);
+ window.addEventListener("popstate", callback);
+ return () => {
+ window.removeEventListener("hashchange", callback);
+ window.removeEventListener("popstate", callback);
+ };
+}
+const readSelection = () => location.hash.slice(1);
+const emptySelection = () => "";
+function setSelection(id: string | null) {
+ const url = new URL(location.href);
+ url.hash = id || "";
+ history.replaceState(history.state, "", url);
+ window.dispatchEvent(new Event("hashchange"));
+}
+
function safeSource(value?: string) {
if (!value) return undefined;
try {
@@ -82,23 +101,34 @@ function ContributeForm({
title: "",
note: "",
});
- const [sent, setSent] = useLocalState(`cocreate-sent:${kind}`, false);
+ // v2 only records real API acknowledgements; v1 was a local-only timer.
+ const [sent, setSent] = useLocalState(`cocreate-delivered-v2:${kind}`, false);
const [busy, setBusy] = useState(false);
+ const [status, setStatus] = useState("");
const lock = useRef(false);
const update = (key: keyof typeof draft, value: string) => {
setDraft((c) => ({ ...c, [key]: value }));
setSent(false);
+ setStatus("");
};
- const submit = (event: FormEvent) => {
+ const submit = async (event: FormEvent) => {
event.preventDefault();
if (lock.current || !draft.name.trim() || !draft.contact.trim()) return;
lock.current = true;
setBusy(true);
- window.setTimeout(() => {
+ try {
+ await socialApi.postFeedback({
+ kind: "建议",
+ text: `【共创${books ? "小册" : "视频 / 访谈"}投稿】\n称呼:${draft.name.trim()}\n主题:${draft.title.trim() || "待讨论"}\n${draft.note.trim()}`,
+ contact: draft.contact.trim(),
+ });
setSent(true);
+ } catch {
+ setStatus("暂时未发送,草稿已保留在当前设备。请重试提交。");
+ } finally {
setBusy(false);
lock.current = false;
- }, 420);
+ }
};
if (sent) {
@@ -107,9 +137,9 @@ function ContributeForm({
- 意向已记下
+ 共创意向已提交
- 先留在你这边。有网或运营看到后,会再联系你聊聊怎么一起做。
+ 已发送给社区运营。请保留联系方式,方便后续沟通。
@@ -119,6 +149,7 @@ function ContributeForm({
+