diff --git a/apps/api/services/ebook_svc/routers/social_ugc_admin.py b/apps/api/services/ebook_svc/routers/social_ugc_admin.py
index 94c3755..03ee9eb 100644
--- a/apps/api/services/ebook_svc/routers/social_ugc_admin.py
+++ b/apps/api/services/ebook_svc/routers/social_ugc_admin.py
@@ -386,6 +386,27 @@ class CatalogBody(BaseModel):
videos: list[dict[str, Any]] | None = None
+class ExperienceBody(BaseModel):
+ expectedVersion: int | None = Field(default=None, ge=0)
+ experience: dict[str, Any] = Field(default_factory=dict)
+
+
+@router.get("/experience")
+async def get_experience(_: str = Depends(require_admin)) -> dict[str, Any]:
+ from ebook_svc.services import social_experience as experience
+
+ return experience.read_experience()
+
+
+@router.put("/experience")
+async def put_experience(
+ body: ExperienceBody, _: str = Depends(require_admin)
+) -> dict[str, Any]:
+ from ebook_svc.services import social_experience as experience
+
+ return experience.write_experience(body.expectedVersion, body.experience)
+
+
@router.get("/catalog")
async def get_catalog(_: str = Depends(require_admin)) -> dict[str, Any]:
from ebook_svc.services.social_ops import _read_raw
diff --git a/apps/api/services/ebook_svc/services/social_experience.py b/apps/api/services/ebook_svc/services/social_experience.py
new file mode 100644
index 0000000..de38e1e
--- /dev/null
+++ b/apps/api/services/ebook_svc/services/social_experience.py
@@ -0,0 +1,231 @@
+"""社区体验设计台 — 导航 / 区块 / 文案 / 视觉主题。
+
+只读写 copy.socialExperience,并同步 skin → copy.socialSkin、
+sections → socialHiddenSections、中文 pages → socialPages。
+不碰 orders、PocketBase、platforms.tt、socialCatalogs 内容数组。
+"""
+from __future__ import annotations
+
+import re
+from typing import Any
+
+from fastapi import HTTPException
+
+from ebook_svc.services.social_ops import _read_raw, _write_raw, resolve_config_file
+
+SKIN_IDS = ("1", "2", "3", "4")
+SKIN_DEFAULT = "1"
+SKIN_META = (
+ {"id": "1", "label": "主题1 · 旅居社群", "note": "当前线上默认样式(已保存)"},
+ {"id": "2", "label": "主题2 · 琥珀信号", "note": "theme2.css"},
+ {"id": "3", "label": "主题3 · 预留", "note": "可后续扩展 CSS"},
+ {"id": "4", "label": "主题4 · 预留", "note": "可后续扩展 CSS"},
+)
+
+NAV_KEYS = (
+ "chat",
+ "people",
+ "date",
+ "meetup",
+ "coffeechat",
+ "map",
+ "places",
+ "team",
+ "skills",
+ "ebook",
+ "videos",
+ "work",
+ "feedback",
+)
+
+SECTION_KEYS = (
+ "discover",
+ "people",
+ "cities",
+ "meetup",
+ "collaborate",
+ "faq",
+)
+
+PAGE_KEYS = (
+ "home",
+ "discovery",
+ "chat",
+ "people",
+ "date",
+ "meetup",
+ "coffeechat",
+ "map",
+ "places",
+ "team",
+ "skills",
+ "ebook",
+ "videos",
+ "work",
+ "feedback",
+ "roster",
+)
+
+LOCALE_KEYS = ("zh", "en")
+COPY_FIELDS = ("eyebrow", "title", "accent", "description")
+_SAFE_HREF = re.compile(r"^(/social(/[\w.-]+)*)?/?$")
+
+
+def _clip(value: Any, limit: int) -> str:
+ text = str(value or "").strip()
+ return text[:limit] if text else ""
+
+
+def _norm_bool_map(raw: Any, keys: tuple[str, ...], default: bool = True) -> dict[str, bool]:
+ src = raw if isinstance(raw, dict) else {}
+ out: dict[str, bool] = {}
+ for key in keys:
+ if key in src:
+ out[key] = bool(src[key])
+ else:
+ out[key] = default
+ return out
+
+
+def _norm_skin(raw: Any) -> str:
+ skin = str(raw or "").strip()
+ return skin if skin in SKIN_IDS else SKIN_DEFAULT
+
+
+def _norm_page_copy(raw: Any) -> dict[str, str]:
+ src = raw if isinstance(raw, dict) else {}
+ out: dict[str, str] = {}
+ limits = {"eyebrow": 200, "title": 300, "accent": 300, "description": 2000}
+ for field in COPY_FIELDS:
+ text = _clip(src.get(field), limits[field])
+ if text:
+ out[field] = text
+ return out
+
+
+def _norm_pages(raw: Any) -> dict[str, dict[str, dict[str, str]]]:
+ src = raw if isinstance(raw, dict) else {}
+ out: dict[str, dict[str, dict[str, str]]] = {}
+ for locale, pages in src.items():
+ loc = str(locale or "").strip()
+ if loc not in LOCALE_KEYS:
+ raise HTTPException(422, f"unsupported locale: {loc}")
+ if not isinstance(pages, dict):
+ continue
+ locale_pages: dict[str, dict[str, str]] = {}
+ for page_key, copy in pages.items():
+ key = str(page_key or "").strip()
+ if key not in PAGE_KEYS:
+ continue
+ cleaned = _norm_page_copy(copy)
+ if cleaned:
+ locale_pages[key] = cleaned
+ if locale_pages:
+ out[loc] = locale_pages
+ return out
+
+
+def _norm_announcement(raw: Any) -> dict[str, Any]:
+ src = raw if isinstance(raw, dict) else {}
+ href = _clip(src.get("href"), 500)
+ if href and not _SAFE_HREF.match(href):
+ raise HTTPException(422, "announcement.href must be an in-app /social path")
+ return {
+ "enabled": bool(src.get("enabled")),
+ "zh": _clip(src.get("zh"), 400),
+ "en": _clip(src.get("en"), 400),
+ "href": href,
+ }
+
+
+def _norm_featured(raw: Any) -> list[str]:
+ if not isinstance(raw, list):
+ return []
+ out: list[str] = []
+ for item in raw:
+ cid = str(item or "").strip()
+ if cid and cid not in out:
+ out.append(cid[:64])
+ return out[:40]
+
+
+def normalize_experience(raw: Any) -> dict[str, Any]:
+ src = raw if isinstance(raw, dict) else {}
+ return {
+ "skin": _norm_skin(src.get("skin")),
+ "navigation": _norm_bool_map(src.get("navigation"), NAV_KEYS, True),
+ "sections": _norm_bool_map(src.get("sections"), SECTION_KEYS, True),
+ "pages": _norm_pages(src.get("pages")),
+ "announcement": _norm_announcement(src.get("announcement")),
+ "featuredCityIds": _norm_featured(src.get("featuredCityIds")),
+ }
+
+
+def _sync_portal_fields(copy: dict[str, Any], experience: dict[str, Any]) -> None:
+ copy["socialSkin"] = experience["skin"]
+ copy["socialExperience"] = experience
+ hidden = [key for key, on in experience["sections"].items() if not on]
+ copy["socialHiddenSections"] = hidden
+ zh_pages = experience.get("pages", {}).get("zh")
+ if isinstance(zh_pages, dict) and zh_pages:
+ pages = dict(copy.get("socialPages") or {}) if isinstance(copy.get("socialPages"), dict) else {}
+ for key, value in zh_pages.items():
+ if key == "home":
+ if value.get("eyebrow"):
+ copy["socialEyebrow"] = value["eyebrow"]
+ if value.get("title"):
+ copy["socialHeroLine1"] = value["title"]
+ if value.get("accent"):
+ copy["socialHeroAccent"] = value["accent"]
+ if value.get("description"):
+ copy["socialHeroLead"] = value["description"]
+ continue
+ pages[key] = {**(pages.get(key) if isinstance(pages.get(key), dict) else {}), **value}
+ copy["socialPages"] = pages
+
+
+def read_experience() -> dict[str, Any]:
+ raw = _read_raw()
+ copy = raw.get("copy") if isinstance(raw.get("copy"), dict) else {}
+ stored = copy.get("socialExperience")
+ if not isinstance(stored, dict):
+ stored = {
+ "skin": copy.get("socialSkin") or SKIN_DEFAULT,
+ "navigation": {},
+ "sections": {},
+ "pages": {},
+ "announcement": {},
+ "featuredCityIds": [],
+ }
+ # seed sections from legacy socialHiddenSections
+ hidden = copy.get("socialHiddenSections")
+ if isinstance(hidden, list):
+ sections = {k: True for k in SECTION_KEYS}
+ for item in hidden:
+ key = str(item or "").strip()
+ if key in sections:
+ sections[key] = False
+ stored["sections"] = sections
+ experience = normalize_experience(stored)
+ return {
+ "ok": True,
+ "version": int(raw.get("version") or 1),
+ "updatedAt": raw.get("updatedAt"),
+ "experience": experience,
+ "skins": list(SKIN_META),
+ "configPath": str(resolve_config_file()),
+ }
+
+
+def write_experience(expected_version: int | None, experience_raw: Any) -> dict[str, Any]:
+ raw = _read_raw()
+ current_version = int(raw.get("version") or 1)
+ if expected_version is not None and int(expected_version) != current_version:
+ raise HTTPException(409, "配置已更新,请加载最新配置后重试;当前草稿尚未保存")
+ experience = normalize_experience(experience_raw)
+ out = dict(raw) if raw else {"version": 1, "modules": {}, "flags": {}, "copy": {}}
+ copy = dict(out.get("copy") or {})
+ _sync_portal_fields(copy, experience)
+ out["copy"] = copy
+ _write_raw(out)
+ return read_experience()
diff --git a/apps/api/services/social_svc/pb_data.py b/apps/api/services/social_svc/pb_data.py
index 29e003a..730fa72 100644
--- a/apps/api/services/social_svc/pb_data.py
+++ b/apps/api/services/social_svc/pb_data.py
@@ -1,6 +1,7 @@
"""Social data access via online PocketBase (no SQLite)."""
from __future__ import annotations
+import os
import time
import uuid
import hashlib
@@ -2115,6 +2116,13 @@ def admin_list_feedback(
def _row(r: dict[str, Any]) -> dict[str, Any]:
meta = r.get("meta") if isinstance(r.get("meta"), dict) else {}
+ if isinstance(r.get("meta"), str):
+ try:
+ parsed_meta = json.loads(r.get("meta") or "")
+ if isinstance(parsed_meta, dict):
+ meta = parsed_meta
+ except Exception:
+ meta = {}
guest = r.get("guestId") or r.get("guest_id") or ""
contact = r.get("contact") or ""
user_key = str(r.get("userKey") or r.get("user_key") or "") or feedback_user_key(
@@ -2122,12 +2130,25 @@ def admin_list_feedback(
contact=str(contact),
meta=meta,
)
+ images = r.get("images")
+ if isinstance(images, str):
+ try:
+ images = json.loads(images)
+ except Exception:
+ images = []
+ if not isinstance(images, list):
+ images = []
+ images = [
+ str(u).strip()
+ for u in images
+ if isinstance(u, str) and str(u).strip().startswith(("http://", "https://"))
+ ]
return {
"id": r.get("id"),
"kind": r.get("kind"),
"text": r.get("text"),
"contact": contact,
- "images": r.get("images") if isinstance(r.get("images"), list) else [],
+ "images": images,
"meta": meta,
"userKey": user_key,
"guestId": guest,
@@ -2155,12 +2176,16 @@ def admin_list_feedback(
for r in src:
if isinstance(r, dict):
_append(r)
- # Also portal data/feedback.json
+ # Also portal data/feedback.json (monorepo + production absolute paths)
try:
- portal_fb = Path.cwd() / "data" / "feedback.json"
- root_fb = Path(__file__).resolve().parents[4] / "data" / "feedback.json"
- for p in (portal_fb, root_fb):
- if not p.is_file():
+ candidates = [
+ Path.cwd() / "data" / "feedback.json",
+ Path(__file__).resolve().parents[4] / "data" / "feedback.json",
+ Path("/var/www/nomadro.cn/data/feedback.json"),
+ Path(os.environ.get("PORTAL_FEEDBACK_JSON", "")),
+ ]
+ for p in candidates:
+ if not p or not str(p) or not p.is_file():
continue
raw = json.loads(p.read_text(encoding="utf-8"))
rows = raw.get("items") if isinstance(raw, dict) else raw
diff --git a/apps/api/tests/test_social_experience.py b/apps/api/tests/test_social_experience.py
index 9df47b3..04f64b7 100644
--- a/apps/api/tests/test_social_experience.py
+++ b/apps/api/tests/test_social_experience.py
@@ -57,4 +57,21 @@ class ExperienceTests(unittest.TestCase):
self.assertEqual(json.loads(self.path.read_text()),self.original)
self.assertEqual(self.client.put('/api/admin/social/ugc/experience',json={'expectedVersion':7,'experience':{'announcement':{'href':''}}}).status_code,200)
+ def test_skin_switch_persists_theme_one_default(self):
+ self.login()
+ url='/api/admin/social/ugc/experience'
+ got=self.client.get(url).json()
+ self.assertEqual(got['experience']['skin'],'1')
+ body={'expectedVersion':7,'experience':{'skin':'2'}}
+ response=self.client.put(url,json=body)
+ self.assertEqual(response.status_code,200,response.text)
+ payload=response.json()
+ self.assertEqual(payload['experience']['skin'],'2')
+ raw=json.loads(self.path.read_text(encoding='utf-8'))
+ self.assertEqual(raw['copy']['socialSkin'],'2')
+ self.assertEqual(raw['copy']['socialExperience']['skin'],'2')
+ bad=self.client.put(url,json={'expectedVersion':8,'experience':{'skin':'9'}})
+ self.assertEqual(bad.status_code,200)
+ self.assertEqual(bad.json()['experience']['skin'],'1')
+
if __name__=='__main__': unittest.main()
diff --git a/apps/com/admin/src/App.tsx b/apps/com/admin/src/App.tsx
index dfb740d..0d02de8 100644
--- a/apps/com/admin/src/App.tsx
+++ b/apps/com/admin/src/App.tsx
@@ -8,6 +8,7 @@ import {
Ntfy,
Orders,
SocialDetail,
+ SocialExperience,
SocialLocaleGeo,
Switches,
Users,
@@ -106,6 +107,7 @@ export default function App() {
} />
} />
} />
+ } />
} />
} />
} />
diff --git a/apps/com/admin/src/components/WebLayout.tsx b/apps/com/admin/src/components/WebLayout.tsx
index 02d7307..7f661df 100644
--- a/apps/com/admin/src/components/WebLayout.tsx
+++ b/apps/com/admin/src/components/WebLayout.tsx
@@ -67,6 +67,7 @@ function buildNav(lane: LaneKey): NavGroup[] {
{ to: `${p}/switches`, label: '页面开关', ico: '开' },
{ to: `${p}/audience`, label: '受众设置', ico: '众' },
{ to: `${s}/catalog`, label: '目录配置', ico: '录' },
+ { to: `${s}/experience`, label: '体验主题', ico: '肤' },
{ to: `${s}/locale-geo`, label: '语言国家', ico: '语' },
],
},
diff --git a/apps/com/admin/src/lib/pageModules.ts b/apps/com/admin/src/lib/pageModules.ts
index 212eeae..52e8889 100644
--- a/apps/com/admin/src/lib/pageModules.ts
+++ b/apps/com/admin/src/lib/pageModules.ts
@@ -24,6 +24,7 @@ export const Users = lz(() => import('../pages/Users'))
export const Ntfy = lz(() => import('../pages/Ntfy'))
export const SocialDetail = lz(() => import('../pages/SocialDetail'))
export const SocialLocaleGeo = lz(() => import('../pages/SocialLocaleGeo'))
+export const SocialExperience = lz(() => import('../pages/SocialExperience'))
export const Blog = lz(() => import('../pages/Blog'))
/** Warm likely next chunks after shell mounts / on idle. */
@@ -32,6 +33,7 @@ export function warmSecondaryChunks() {
void Blog.preload()
void Switches.preload()
void Events.preload()
+ void SocialExperience.preload()
}
if (typeof requestIdleCallback === 'function') {
requestIdleCallback(run, { timeout: 2500 })
@@ -42,6 +44,7 @@ export function warmSecondaryChunks() {
/** Preload chunk for a nav target before click. */
export function preloadForPath(to: string) {
+ if (to.includes('/social/experience')) return void SocialExperience.preload()
if (to.includes('/social/locale-geo')) return void SocialLocaleGeo.preload()
if (/\/social\/[^/]+\/[^/]+/.test(to)) return void SocialDetail.preload()
if (to.includes('/blog')) return void Blog.preload()
diff --git a/apps/com/admin/src/pages/Docs.tsx b/apps/com/admin/src/pages/Docs.tsx
index 8ffaaba..b082c97 100644
--- a/apps/com/admin/src/pages/Docs.tsx
+++ b/apps/com/admin/src/pages/Docs.tsx
@@ -23,6 +23,9 @@ export default function Docs() {
…/social — 游民社区 UGC(聊天 / 花名册 / 评价 / 接单 / 反馈)
+
+ …/social/experience — 视觉主题 1/2/3/4 · 首页编排 · 文案(remote-config)
+
…/social/locale-geo — 语言开关 / 国家目录 / 优先城市(remote-config)
diff --git a/apps/com/admin/src/pages/ImageLightbox.tsx b/apps/com/admin/src/pages/ImageLightbox.tsx
new file mode 100644
index 0000000..e01ab8b
--- /dev/null
+++ b/apps/com/admin/src/pages/ImageLightbox.tsx
@@ -0,0 +1,135 @@
+/**
+ * Fullscreen image slideshow for admin feedback / media lists.
+ */
+import { useEffect, useCallback } from 'react'
+import { resolveMediaUrl } from './MediaValue'
+
+type Props = {
+ urls: string[]
+ index: number
+ onClose: () => void
+ onIndex: (i: number) => void
+}
+
+export function ImageLightbox({ urls, index, onClose, onIndex }: Props) {
+ const total = urls.length
+ const safeIndex = total ? ((index % total) + total) % total : 0
+ const src = total ? resolveMediaUrl(urls[safeIndex]) : ''
+
+ const prev = useCallback(() => {
+ if (!total) return
+ onIndex((safeIndex - 1 + total) % total)
+ }, [onIndex, safeIndex, total])
+
+ const next = useCallback(() => {
+ if (!total) return
+ onIndex((safeIndex + 1) % total)
+ }, [onIndex, safeIndex, total])
+
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key === 'Escape') onClose()
+ if (e.key === 'ArrowLeft') prev()
+ if (e.key === 'ArrowRight') next()
+ }
+ window.addEventListener('keydown', onKey)
+ const prevOverflow = document.body.style.overflow
+ document.body.style.overflow = 'hidden'
+ return () => {
+ window.removeEventListener('keydown', onKey)
+ document.body.style.overflow = prevOverflow
+ }
+ }, [onClose, prev, next])
+
+ if (!total) return null
+
+ return (
+
+
+ {total > 1 ? (
+ <>
+
+
+ >
+ ) : null}
+
e.stopPropagation()}
+ >
+
+
+ {safeIndex + 1} / {total}
+
+ 原图
+
+
+
+ {total > 1 ? (
+
e.stopPropagation()}
+ >
+ {urls.map((u, i) => (
+
+ ))}
+
+ ) : null}
+
+ )
+}
+
+export function feedbackImageUrls(row: Record): string[] {
+ const raw = row.images
+ if (!Array.isArray(raw)) return []
+ return raw
+ .filter((u): u is string => typeof u === 'string')
+ .map((u) => u.trim())
+ .filter((u) => /^https?:\/\//i.test(u))
+}
diff --git a/apps/com/admin/src/pages/LaneHub.tsx b/apps/com/admin/src/pages/LaneHub.tsx
index 3f22c5a..35a6c6d 100644
--- a/apps/com/admin/src/pages/LaneHub.tsx
+++ b/apps/com/admin/src/pages/LaneHub.tsx
@@ -156,6 +156,7 @@ export default function LaneHub({ lane }: { lane: LaneKey }) {
{ to: `/${lane}/social/overview`, ico: '◈', title: '指挥台', desc: '加入 / 自拍 / 举报优先' },
{ to: `/${lane}/pricing`, ico: '¥', title: '动态价格', desc: '免费 / 付费一键切换 · 体验次数' },
{ to: `/${lane}/switches`, ico: '开', title: '页面开关', desc: '模块显隐 · VIP 入口 · 文案' },
+ { to: `/${lane}/social/experience`, ico: '肤', title: '体验主题', desc: '主题1/2/3/4 · 首页编排 · 文案' },
{ to: `/${lane}/social/locale-geo`, ico: '语', title: '语言国家', desc: '多语言开关 · 国家目录 · 优先城市' },
{ to: `/${lane}/blog`, ico: '✎', title: 'Nomad Blog', desc: '文章显隐 / 置顶' },
{ to: `/${lane}/orders`, ico: '订', title: '订单', desc: '支付与发货' },
diff --git a/apps/com/admin/src/pages/Social.tsx b/apps/com/admin/src/pages/Social.tsx
index 9735f6e..7ddb579 100644
--- a/apps/com/admin/src/pages/Social.tsx
+++ b/apps/com/admin/src/pages/Social.tsx
@@ -2,7 +2,13 @@
* 游民社区 · 列表页(无页内 Tab;侧栏二级菜单切入)
* 整行可进详情;分页;软删除进存档。
*/
-import { useCallback, useEffect, useMemo, useState } from 'react'
+import {
+ useCallback,
+ useEffect,
+ useMemo,
+ useState,
+ type MouseEvent as ReactMouseEvent,
+} from 'react'
import {
Link,
Navigate,
@@ -34,6 +40,10 @@ import {
short,
} from './socialMeta'
import { looksLikeUrl, MediaValue } from './MediaValue'
+import {
+ ImageLightbox,
+ feedbackImageUrls,
+} from './ImageLightbox'
function rowLivePeer(
row: Record,
@@ -229,8 +239,56 @@ export default function Social() {
const [msg, setMsg] = useState('')
const [catalogJson, setCatalogJson] = useState('')
const [editRoster, setEditRoster] = useState | null>(null)
+ const [lightbox, setLightbox] = useState<{ urls: string[]; index: number } | null>(
+ null,
+ )
const presence = useSharedSocialPresence()
+ const openFeedbackImages = (
+ row: Record,
+ index = 0,
+ e?: ReactMouseEvent,
+ ) => {
+ e?.stopPropagation()
+ const urls = feedbackImageUrls(row)
+ if (!urls.length) return
+ setLightbox({ urls, index: Math.max(0, Math.min(index, urls.length - 1)) })
+ }
+
+ const renderFeedbackImageCell = (row: Record) => {
+ const urls = feedbackImageUrls(row)
+ if (!urls.length) {
+ return —
+ }
+ return (
+ e.stopPropagation()}
+ >
+ {urls.slice(0, 4).map((url, i) => (
+
+ ))}
+ {urls.length > 4 ? (
+
+ ) : null}
+
+ )
+ }
+
const loadOverview = useCallback(async () => {
const data = await api('/api/admin/social/ugc/overview')
setOverview(data)
@@ -877,7 +935,8 @@ export default function Social() {
| {personKey ? '#' : '类型'} |
{personKey ? '类型' : '内容'} |
- {personKey ? '内容 / 截图' : '联系'} |
+ 图片 |
+ {personKey ? '内容' : '联系'} |
{personKey ? '联系' : '访客'} |
时间 |
操作 |
@@ -1085,6 +1144,7 @@ export default function Social() {
) : null}
{short(row.text, 56)} |
+ {renderFeedbackImageCell(row)} |
{short(row.contact, 24) || '—'} |
{
@@ -1121,38 +1181,8 @@ export default function Social() {
|
{String(row.kind || '—')}
|
-
- {short(row.text, 72)}
- {Array.isArray(row.images) && row.images.length ? (
- e.stopPropagation()}
- >
- {(row.images as unknown[])
- .filter((u): u is string => typeof u === 'string')
- .slice(0, 4)
- .map((url) => (
-
-
-
- ))}
-
- ) : null}
- |
+ {renderFeedbackImageCell(row)} |
+ {short(row.text, 72)} |
{short(row.contact, 24) || '—'} |
{fmtTime(row.created_at || row.createdAt || row.at)} |
>
@@ -1481,6 +1511,15 @@ export default function Social() {
>
) : null}
+ {lightbox ? (
+ setLightbox(null)}
+ onIndex={(i) => setLightbox((cur) => (cur ? { ...cur, index: i } : cur))}
+ />
+ ) : null}
+
{editRoster ? (
setEditRoster(null)}>
e.stopPropagation()}>
diff --git a/apps/com/admin/src/pages/SocialExperience.tsx b/apps/com/admin/src/pages/SocialExperience.tsx
index d887a14..e9bb74d 100644
--- a/apps/com/admin/src/pages/SocialExperience.tsx
+++ b/apps/com/admin/src/pages/SocialExperience.tsx
@@ -6,13 +6,16 @@ import { useConfigLive } from '../lib/useConfigLive'
type PageCopy = { eyebrow?: string; title?: string; accent?: string; description?: string }
type Experience = {
+ skin?: string
navigation?: Record
sections?: Record
pages?: Record>
announcement?: { enabled?: boolean; zh?: string; en?: string; href?: string }
featuredCityIds?: string[]
}
-type Response = { version: number; experience: Experience }
+type SkinMeta = { id: string; label: string; note: string }
+type Response = { version: number; experience: Experience; skins?: SkinMeta[] }
+
const GROUPS = [
{ title: '认识人', items: [['chat', '聊天群'], ['people', '想见的人'], ['date', '约会'], ['meetup', '语音厅']] },
{ title: '见一面', items: [['coffeechat', '线下咖啡聊'], ['map', '地图'], ['places', '城市']] },
@@ -20,6 +23,12 @@ const GROUPS = [
]
const SECTIONS = [['discover', '探索方向'], ['people', '发现朋友'], ['cities', '城市与咖啡'], ['meetup', '聊天与语音厅'], ['collaborate', '一起做事'], ['faq', '常见问题']]
const PAGES = [['home', '首页首屏'], ['discovery', '探索方向标题'], ...GROUPS.flatMap(group => group.items), ['roster', '我的介绍']]
+const DEFAULT_SKINS: SkinMeta[] = [
+ { id: '1', label: '主题1 · 旅居社群', note: '当前线上默认样式(已保存)' },
+ { id: '2', label: '主题2 · 琥珀信号', note: 'theme2.css' },
+ { id: '3', label: '主题3 · 预留', note: '可后续扩展 CSS' },
+ { id: '4', label: '主题4 · 预留', note: '可后续扩展 CSS' },
+]
const DEFAULT_HOME: Record = {
zh: { eyebrow: '自由生活,同频相遇', title: '世界很大,', accent: '同频的人不远。', description: '换一座城市,不必重新孤独。从一句你好、一杯咖啡开始,找到一起探索、一起创造的人。' },
en: { eyebrow: 'FREE LIVING. SAME WAVELENGTH.', title: 'A big world.', accent: 'Your kind of people.', description: 'A new city doesn’t have to mean starting over alone. Find your people through a hello, a coffee, or something you build together.' },
@@ -30,6 +39,7 @@ export default function SocialExperience() {
const [remote, setRemote] = useState(null)
const [draft, setDraft] = useState({})
const [baseline, setBaseline] = useState('{}')
+ const [skins, setSkins] = useState(DEFAULT_SKINS)
const [locale, setLocale] = useState('zh')
const [page, setPage] = useState('home')
const [loading, setLoading] = useState(false)
@@ -42,7 +52,11 @@ export default function SocialExperience() {
setLoading(true); setError('')
try {
const result = await api('/api/admin/social/ugc/experience')
- setRemote(result); setDraft(result.experience || {}); setBaseline(JSON.stringify(result.experience || {}))
+ const experience = { skin: '1', ...(result.experience || {}) }
+ setRemote(result)
+ setDraft(experience)
+ setBaseline(JSON.stringify(experience))
+ if (Array.isArray(result.skins) && result.skins.length) setSkins(result.skins)
} catch (e) { setError(e instanceof Error ? e.message : '加载失败') }
finally { setLoading(false) }
}, [])
@@ -53,19 +67,51 @@ export default function SocialExperience() {
setSaving(true); setMessage(''); setError('')
try {
const result = await api('/api/admin/social/ugc/experience', { method: 'PUT', body: JSON.stringify({ expectedVersion: remote.version, experience: draft }) })
- setRemote(result); setDraft(result.experience); setBaseline(JSON.stringify(result.experience)); setMessage('社区体验配置已发布,门户将自动更新。')
+ const experience = { skin: '1', ...(result.experience || {}) }
+ setRemote(result)
+ setDraft(experience)
+ setBaseline(JSON.stringify(experience))
+ if (Array.isArray(result.skins) && result.skins.length) setSkins(result.skins)
+ setMessage(`社区体验已发布(主题${experience.skin || '1'}),门户将自动更新。`)
} catch (e) { setError(e instanceof Error ? e.message : '发布失败;草稿已保留') }
finally { setSaving(false) }
}
const copy = draft.pages?.[locale]?.[page] || {}
const pageField = (key: keyof PageCopy, value: string) => setDraft(current => ({ ...current, pages: { ...current.pages, [locale]: { ...current.pages?.[locale], [page]: { ...current.pages?.[locale]?.[page], [key]: value } } } }))
+ const activeSkin = draft.skin || '1'
return
-
+
{error &&
{error}
}
{message &&
{message}
}
{stale &&
配置已有新版本。先复制需要保留的文案,再加载最新配置后编辑。
}
{!remote ?
{loading ? '正在加载社区配置…' : }
:
}
}
diff --git a/apps/com/admin/src/styles.css b/apps/com/admin/src/styles.css
index cec6a13..908cb0b 100644
--- a/apps/com/admin/src/styles.css
+++ b/apps/com/admin/src/styles.css
@@ -1802,6 +1802,140 @@ button.com-chip.is-on,
gap: 12px;
margin: 8px 0 4px;
}
+
+/* Feedback list thumbs + fullscreen slideshow */
+.com-feedback-thumbs {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex-wrap: wrap;
+ max-width: 220px;
+}
+.com-feedback-thumb {
+ width: 48px;
+ height: 48px;
+ padding: 0;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+ background: #09090b;
+ cursor: zoom-in;
+}
+.com-feedback-thumb img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+}
+.com-feedback-thumb-more {
+ min-width: 48px;
+ height: 48px;
+ border-radius: 8px;
+ border: 1px dashed var(--line);
+ background: rgba(255, 255, 255, 0.04);
+ color: var(--muted);
+ font-size: 12px;
+ cursor: pointer;
+}
+.com-lightbox {
+ position: fixed;
+ inset: 0;
+ z-index: 1200;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ padding: 24px 16px 20px;
+ background: rgba(0, 0, 0, 0.88);
+ backdrop-filter: blur(6px);
+}
+.com-lightbox-close {
+ position: absolute;
+ top: 14px;
+ right: 16px;
+ width: 44px;
+ height: 44px;
+ border: 0;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.12);
+ color: #fff;
+ font-size: 28px;
+ line-height: 1;
+ cursor: pointer;
+}
+.com-lightbox-nav {
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 48px;
+ height: 48px;
+ border: 0;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.12);
+ color: #fff;
+ font-size: 32px;
+ line-height: 1;
+ cursor: pointer;
+}
+.com-lightbox-prev { left: 16px; }
+.com-lightbox-next { right: 16px; }
+.com-lightbox-stage {
+ margin: 0;
+ max-width: min(960px, 92vw);
+ max-height: calc(100dvh - 140px);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+}
+.com-lightbox-stage img {
+ max-width: 100%;
+ max-height: calc(100dvh - 180px);
+ object-fit: contain;
+ border-radius: 12px;
+ background: #09090b;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
+}
+.com-lightbox-stage figcaption {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ color: #d4d4d8;
+ font-size: 13px;
+}
+.com-lightbox-stage figcaption a {
+ color: #f59e0b;
+}
+.com-lightbox-thumbs {
+ display: flex;
+ gap: 8px;
+ max-width: min(960px, 92vw);
+ overflow-x: auto;
+ padding: 4px 2px;
+}
+.com-lightbox-thumb {
+ flex: 0 0 auto;
+ width: 56px;
+ height: 56px;
+ padding: 0;
+ border: 2px solid transparent;
+ border-radius: 8px;
+ overflow: hidden;
+ background: #111;
+ cursor: pointer;
+ opacity: 0.7;
+}
+.com-lightbox-thumb.is-active {
+ border-color: #f59e0b;
+ opacity: 1;
+}
+.com-lightbox-thumb img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+}
.com-media {
margin: 0;
padding: 10px;
diff --git a/apps/miniprogram/h5/src/pages/social/_components/ConnectionHero.tsx b/apps/miniprogram/h5/src/pages/social/_components/ConnectionHero.tsx
index 0c79f9b..e37099d 100644
--- a/apps/miniprogram/h5/src/pages/social/_components/ConnectionHero.tsx
+++ b/apps/miniprogram/h5/src/pages/social/_components/ConnectionHero.tsx
@@ -135,7 +135,7 @@ export function ConnectionHero({
同频的人,正在这里相遇
- 自由职业 · 远程工作 · 出来见一面
+ 自由职业 · 远程协作 · 出来见一面
diff --git a/src/app/api/portal/feedback/route.ts b/src/app/api/portal/feedback/route.ts
index 0647a23..3dfc5a4 100644
--- a/src/app/api/portal/feedback/route.ts
+++ b/src/app/api/portal/feedback/route.ts
@@ -183,21 +183,66 @@ export async function POST(req: NextRequest) {
store.items = store.items.slice(0, 2000);
await writeStore(store);
- // Best-effort forward to social_svc (PB) — failure does not fail the request
- const payload = JSON.stringify({ kind, text, contact, images, meta });
+ // Forward to social_svc → PocketBase (admin 读 PB,不是 Next 本机 JSON)。
+ // 对齐 join-leads:await 同源 rewrite + SOCIAL_API_URL,禁止只写 local。
+ const payload = JSON.stringify({
+ kind,
+ text,
+ contact,
+ images,
+ meta,
+ guestId,
+ });
const headers = {
"Content-Type": "application/json",
"X-Social-Guest-Id": guestId || "portal",
};
+ const upstreams: string[] = [];
+ const seen = new Set();
+ const pushUp = (base: string) => {
+ const b = (base || "").replace(/\/$/, "");
+ if (!b || seen.has(b)) return;
+ seen.add(b);
+ upstreams.push(b);
+ };
+ try {
+ const proto =
+ req.headers.get("x-forwarded-proto") ||
+ req.nextUrl.protocol.replace(":", "") ||
+ "https";
+ const host =
+ req.headers.get("x-forwarded-host") ||
+ req.headers.get("host") ||
+ req.nextUrl.host;
+ if (host) pushUp(`${proto}://${host}`);
+ } catch {
+ /* ignore */
+ }
for (const raw of [process.env.SOCIAL_API_URL, process.env.API_URL]) {
- const base = (raw || "").replace(/\/$/, "");
- if (!base || /127\.0\.0\.1|localhost/i.test(base)) continue;
- void fetch(`${base}/api/social/v1/feedback`, {
- method: "POST",
- headers,
- body: payload,
- signal: AbortSignal.timeout(4000),
- }).catch(() => undefined);
+ pushUp(raw || "");
+ }
+ // Production Next often has empty SOCIAL_API_URL; hard-fallback to online .com.
+ pushUp("https://nomadro.com");
+ if (process.env.NODE_ENV !== "production") {
+ pushUp("http://127.0.0.1:8020");
+ }
+
+ let forwarded = false;
+ for (const upstream of upstreams) {
+ try {
+ const res = await fetch(`${upstream}/api/social/v1/feedback`, {
+ method: "POST",
+ headers,
+ body: payload,
+ signal: AbortSignal.timeout(8000),
+ });
+ if (res.ok) {
+ forwarded = true;
+ break;
+ }
+ } catch {
+ /* try next upstream */
+ }
}
return withCors(
@@ -211,7 +256,8 @@ export async function POST(req: NextRequest) {
userKey: item.userKey,
guestId: item.guestId,
at: item.at,
- stored: "local",
+ stored: forwarded ? "pb" : "local",
+ forwarded,
remaining: Math.max(0, FEEDBACK_MAX_PER_USER - used - 1),
max: FEEDBACK_MAX_PER_USER,
}),
diff --git a/src/app/social/layout.tsx b/src/app/social/layout.tsx
index 49b58b0..c118447 100644
--- a/src/app/social/layout.tsx
+++ b/src/app/social/layout.tsx
@@ -1,9 +1,11 @@
import { ModuleBoundary } from "~/components/module-boundary";
-/* 主题1:旅居社群对齐;主题2:琥珀信号(theme2.css,可切换) */
+/* 主题1=旅居社群(默认)· 主题2=琥珀信号 · 主题3/4=预留;后台 remote skin 可切换 */
import "@community/app/globals.css";
import "@social/app/globals.css";
import "@social/app/fx.css";
import "@social/app/theme2.css";
+import "@social/app/theme3.css";
+import "@social/app/theme4.css";
import "@social/app/home.css";
import "@social/app/experience.css";
import "@social/app/interaction.css";
@@ -31,10 +33,10 @@ export default function SocialLayout({
return (
- {/* 首屏防闪:默认主题1;切换器已隐藏,皮肤代码保留可再开 */}
+ {/* 首屏防闪:优先缓存主题,否则主题1;远程配置拉取后由 SiteShell 覆盖 */}
{children}
diff --git a/src/lib/remote-config.ts b/src/lib/remote-config.ts
index 70a7c6a..5e7db16 100644
--- a/src/lib/remote-config.ts
+++ b/src/lib/remote-config.ts
@@ -333,6 +333,36 @@ export type NomadroRemoteConfig = {
enabledCountries?: string[];
featuredCityIds?: string[];
};
+ /**
+ * /social 视觉主题:1=旅居社群(默认)· 2=琥珀信号 · 3/4=预留。
+ * 管理后台「社区体验」可切换;离线默认主题1。
+ */
+ socialSkin?: "1" | "2" | "3" | "4";
+ /** 社区体验设计台完整配置(导航/区块/文案/主题) */
+ socialExperience?: {
+ skin?: "1" | "2" | "3" | "4";
+ navigation?: Record;
+ sections?: Record;
+ pages?: Record<
+ string,
+ Record<
+ string,
+ {
+ eyebrow?: string;
+ title?: string;
+ accent?: string;
+ description?: string;
+ }
+ >
+ >;
+ announcement?: {
+ enabled?: boolean;
+ zh?: string;
+ en?: string;
+ href?: string;
+ };
+ featuredCityIds?: string[];
+ };
/** AdSense 文案位兜底(优先 flags) */
adsenseClientId?: string;
adsensePublisherId?: string;
@@ -631,6 +661,10 @@ export const DEFAULT_REMOTE_CONFIG: NomadroRemoteConfig = {
enabledCountries: [],
featuredCityIds: ["chiangmai", "bali", "dali", "lisbon", "chengdu"],
},
+ socialSkin: "1",
+ socialExperience: {
+ skin: "1",
+ },
socialWayGroup: "聊天群",
socialWayChat: "语音厅",
socialWayDate: "约会",
diff --git a/src/modules/social/app/theme3.css b/src/modules/social/app/theme3.css
new file mode 100644
index 0000000..455ebef
--- /dev/null
+++ b/src/modules/social/app/theme3.css
@@ -0,0 +1,8 @@
+/**
+ * 游民社区 · 主题 3「预留」
+ * html[data-social-skin="3"] 启用。当前继承主题1变量,后续可独立换肤。
+ */
+
+html[data-social-skin="3"] .social-skin {
+ /* 预留钩子:后续覆盖 --sc-* 即可 */
+}
diff --git a/src/modules/social/app/theme4.css b/src/modules/social/app/theme4.css
new file mode 100644
index 0000000..834861c
--- /dev/null
+++ b/src/modules/social/app/theme4.css
@@ -0,0 +1,8 @@
+/**
+ * 游民社区 · 主题 4「预留」
+ * html[data-social-skin="4"] 启用。当前继承主题1变量,后续可独立换肤。
+ */
+
+html[data-social-skin="4"] .social-skin {
+ /* 预留钩子:后续覆盖 --sc-* 即可 */
+}
diff --git a/src/modules/social/components/ConnectionHero.tsx b/src/modules/social/components/ConnectionHero.tsx
index 23a2658..3785427 100644
--- a/src/modules/social/components/ConnectionHero.tsx
+++ b/src/modules/social/components/ConnectionHero.tsx
@@ -409,11 +409,11 @@ export function ConnectionWays({ copy }: { copy: SocialLandingCopy }) {
},
{
id: "05",
- href: "/team",
+ href: "/ebook",
icon: Users,
title: copy.socialWayTeam,
sub: copy.socialTeamTitle,
- cta: "看看机会",
+ cta: "逛共创",
className: "mint",
},
];
diff --git a/src/modules/social/components/HomeActionRail.tsx b/src/modules/social/components/HomeActionRail.tsx
index bd5d145..b5ac112 100644
--- a/src/modules/social/components/HomeActionRail.tsx
+++ b/src/modules/social/components/HomeActionRail.tsx
@@ -28,8 +28,8 @@ export default function HomeActionRail() {
href: "/places", cta: tx("逛逛城市", "Explore cities"), secondary: "/places?tab=cafes", secondaryLabel: tx("找一家咖啡馆", "Find a cafe"), step: tx("选城市 → 看地点 → 安排见面", "Choose a city → Find a place → Make a plan") },
{ id: "create", icon: Heart, label: tx("一起创造", "Build together"),
title: tx("把共同兴趣,变成一起做的事。", "Turn shared interests into something real."),
- description: tx("从招聘机会到远程协作,找到可以一起行动的人和事。", "From hiring posts to remote collaboration, discover people and opportunities to build with."),
- href: "/team", cta: tx("看看招聘", "Browse hiring"), secondary: "/ebook", secondaryLabel: tx("看看共创机会", "Find co-create projects"), step: tx("看机会 → 表达兴趣 → 一起行动", "Browse roles → Express interest → Build together") },
+ description: tx("从小册、视频共创到远程协作,找到可以一起行动的人和事。", "From co-creating guides and videos to remote collaboration, discover people and projects to build with."),
+ href: "/ebook", cta: tx("逛共创", "Browse co-create"), secondary: "/work", secondaryLabel: tx("远程协作", "Remote collaboration"), step: tx("逛共创 → 表达兴趣 → 一起行动", "Browse co-create → Express interest → Build together") },
];
const selected = journeys.find(journey => journey.id === intent) || journeys[0];
const selectedCopy = config.copy.socialPages?.[`discovery-${selected.id}`];
diff --git a/src/modules/social/components/HomeClient.tsx b/src/modules/social/components/HomeClient.tsx
index f68f1f4..93ac40a 100644
--- a/src/modules/social/components/HomeClient.tsx
+++ b/src/modules/social/components/HomeClient.tsx
@@ -480,6 +480,31 @@ export default function HomeClient() {
+ {!loggedIn ? (
+
+
+
+
+
+
+
+
{t.joinCommunity}
+
{landingCopy.socialInviteTitle}
+
{landingCopy.socialInviteLead}
+
+
+
+ ) : null}
+
- {socialTx("招聘")}
{socialTx("共创")}
@@ -502,57 +526,11 @@ export default function HomeClient() {
{socialTx(
- "有人在找帮手;也有人一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。",
+ "一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。",
)}
-
-
- {socialTx("招聘")}
-
-
- {socialTx("共创")}
-
-
-
-
- {gigs.slice(0, 3).map((g, i) => (
-
-
- {ROLE_EMOJI[g.kind || "parttime"] || "📝"}
-
-
-
- {socialTx(TEAM_KIND_LABEL[g.kind || "parttime"])}
-
-
- {g.remote
- ? socialTx("线上也能做")
- : socialTx("可以见面做")}
-
-
-
{socialTx(g.title)}
-
{socialTx(g.pay)}
-
- {(g.tags || []).slice(0, 3).map((t) => (
- {socialTx(t)}
- ))}
-
-
- ))}
-
-
{SEED_EBOOKS.slice(0, 2).map((book) => (
-
- {socialTx("更多机会")}
-
{socialTx("逛共创")}
@@ -610,30 +585,71 @@ export default function HomeClient() {
- {!loggedIn ? (
-
-
-
-
-
+
+
+
+
+
+
+
+ {socialTx("招聘")}
+
+
+
+ 💼
+
+ {socialTx("招聘")}
+
+
+ {socialTx(
+ "有人在找帮手。点卡片看看详情,合适再表达兴趣。",
+ )}
+
-
-
{t.joinCommunity}
-
{landingCopy.socialInviteTitle}
-
{landingCopy.socialInviteLead}
+
+
+ {gigs.slice(0, 3).map((g, i) => (
+
+
+ {ROLE_EMOJI[g.kind || "parttime"] || "📝"}
+
+
+
+ {socialTx(TEAM_KIND_LABEL[g.kind || "parttime"])}
+
+
+ {g.remote
+ ? socialTx("线上也能做")
+ : socialTx("可以见面做")}
+
+
+
{socialTx(g.title)}
+
{socialTx(g.pay)}
+
+ {(g.tags || []).slice(0, 3).map((t) => (
+ {socialTx(t)}
+ ))}
+
+
+ ))}
-
-
- ) : null}
+
+
+
+ {socialTx("更多机会")}
+
+
+
+
{socialTx("更多")}
diff --git a/src/modules/social/components/SiteShell.tsx b/src/modules/social/components/SiteShell.tsx
index cecfcb6..68d8352 100644
--- a/src/modules/social/components/SiteShell.tsx
+++ b/src/modules/social/components/SiteShell.tsx
@@ -13,7 +13,12 @@ import {
} from "react";
import NotifyBell from "@notify/components/NotifyBell";
import { socialPath } from "@social/lib/socialPath";
-import { applySocialSkin, SOCIAL_SKIN_DEFAULT } from "@social/lib/skin";
+import {
+ applySocialSkin,
+ parseSocialSkin,
+ readSocialSkinDebugLock,
+ SOCIAL_SKIN_DEFAULT,
+} from "@social/lib/skin";
import {
getSocialSession,
logoutSocialSession,
@@ -23,6 +28,7 @@ import { useRevealMotion } from "@social/lib/useRevealMotion";
import { useSocialI18n } from "@social/lib/useSocialI18n";
import { socialTx } from "@social/lib/socialTx";
import { LanguageSwitcher } from "~/components/language-switcher";
+import { useRemoteConfig } from "~/lib/use-remote-config";
import { SocialMobileDock } from "./SocialNavigation";
import SocialQuickRail from "./SocialQuickRail";
import SocialBrandLogo from "./SocialBrandLogo";
@@ -57,6 +63,7 @@ export default function SiteShell({
onJoin?: () => void;
}) {
const { t } = useSocialI18n();
+ const { config } = useRemoteConfig();
const [openGroup, setOpenGroup] = useState
(null);
const [menuOpen, setMenuOpen] = useState(false);
const [scrolled, setScrolled] = useState(false);
@@ -75,9 +82,22 @@ export default function SiteShell({
const session = JSON.parse(sessionSnap) as ReturnType<
typeof getSocialSession
>;
+ const remoteSkin = parseSocialSkin(
+ config.copy.socialSkin ||
+ config.copy.socialExperience?.skin ||
+ SOCIAL_SKIN_DEFAULT,
+ );
useEffect(() => {
- applySocialSkin(SOCIAL_SKIN_DEFAULT);
- }, []);
+ const sync = () => {
+ // 本地调试小球锁定后,不让远程配置把主题打回去
+ if (readSocialSkinDebugLock()) return;
+ applySocialSkin(remoteSkin);
+ };
+ sync();
+ window.addEventListener("nomadro-social-skin-change", sync);
+ return () =>
+ window.removeEventListener("nomadro-social-skin-change", sync);
+ }, [remoteSkin]);
const openJoin = () => {
setLoginOpen(true);
diff --git a/src/modules/social/components/SocialExperience.tsx b/src/modules/social/components/SocialExperience.tsx
index d2c6cb8..6f3e665 100644
--- a/src/modules/social/components/SocialExperience.tsx
+++ b/src/modules/social/components/SocialExperience.tsx
@@ -15,6 +15,7 @@ import { localizeSocialConfig } from "@social/lib/localizeConfig";
import { useSocialI18n } from "@social/lib/useSocialI18n";
import { warmTranslationCache } from "@social/lib/translateBus";
import { SOCIAL_PHRASES_EN } from "@social/lib/phrases";
+import SocialSkinDebugBall from "./SocialSkinDebugBall";
const SocialConfigContext = createContext(DEFAULT_REMOTE_CONFIG);
export const useSocialConfig = () => useContext(SocialConfigContext);
@@ -188,6 +189,7 @@ export default function SocialExperience({
{children}
+
);
}
diff --git a/src/modules/social/components/SocialSkinDebugBall.css b/src/modules/social/components/SocialSkinDebugBall.css
new file mode 100644
index 0000000..8d07c1d
--- /dev/null
+++ b/src/modules/social/components/SocialSkinDebugBall.css
@@ -0,0 +1,166 @@
+.ssd-root {
+ position: fixed;
+ left: max(14px, env(safe-area-inset-left, 0px));
+ bottom: max(18px, env(safe-area-inset-bottom, 0px));
+ z-index: 9300;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ pointer-events: none;
+}
+
+.ssd-root > * {
+ pointer-events: auto;
+}
+
+.ssd-orb {
+ position: relative;
+ width: 52px;
+ height: 52px;
+ border-radius: 50%;
+ border: 1px solid color-mix(in srgb, #4ecdc4 45%, rgba(255, 255, 255, 0.12));
+ background:
+ radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.34), transparent 42%),
+ linear-gradient(145deg, #132028 0%, #0b1016 55%, #12181f 100%);
+ box-shadow:
+ 0 12px 28px rgba(0, 0, 0, 0.4),
+ 0 0 0 1px rgba(78, 205, 196, 0.14),
+ inset 0 1px 0 rgba(255, 255, 255, 0.12);
+ color: #e8fffb;
+ cursor: pointer;
+ display: grid;
+ place-items: center;
+ font: inherit;
+ font-size: 12px;
+ font-weight: 800;
+ letter-spacing: 0.04em;
+ animation: ssd-bob 3.2s ease-in-out infinite;
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
+}
+
+.ssd-orb i {
+ position: absolute;
+ inset: 7px;
+ border-radius: 50%;
+ border: 1px dashed color-mix(in srgb, #4ecdc4 40%, transparent);
+ opacity: 0.7;
+ pointer-events: none;
+}
+
+.ssd-orb:hover,
+.ssd-orb:focus-visible {
+ transform: translateY(-2px) scale(1.05);
+ outline: none;
+ box-shadow:
+ 0 16px 34px rgba(0, 0, 0, 0.46),
+ 0 0 0 1px rgba(78, 205, 196, 0.32),
+ 0 0 22px rgba(78, 205, 196, 0.22);
+}
+
+.ssd-panel {
+ width: min(280px, calc(100vw - 28px));
+ padding: 12px;
+ border-radius: 16px;
+ border: 1px solid color-mix(in srgb, #4ecdc4 28%, rgba(255, 255, 255, 0.1));
+ background: color-mix(in srgb, #0b1016 88%, #4ecdc4 6%);
+ backdrop-filter: blur(16px) saturate(1.15);
+ box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
+ color: #e8eef5;
+}
+
+.ssd-head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 10px;
+ margin-bottom: 10px;
+}
+
+.ssd-head strong {
+ font-size: 13px;
+ letter-spacing: 0.04em;
+}
+
+.ssd-head span {
+ font-size: 11px;
+ color: #8fa3b5;
+}
+
+.ssd-skins {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 8px;
+}
+
+.ssd-skin {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 2px;
+ min-height: 52px;
+ padding: 10px 12px;
+ border-radius: 12px;
+ border: 1px solid color-mix(in srgb, #fff 12%, transparent);
+ background: color-mix(in srgb, #101820 80%, transparent);
+ color: inherit;
+ font: inherit;
+ cursor: pointer;
+ text-align: left;
+ transition: border-color 0.18s ease, background 0.18s ease;
+}
+
+.ssd-skin b {
+ font-size: 13px;
+}
+
+.ssd-skin small {
+ font-size: 11px;
+ color: #8fa3b5;
+}
+
+.ssd-skin[aria-pressed="true"] {
+ border-color: color-mix(in srgb, #4ecdc4 55%, transparent);
+ background: color-mix(in srgb, #4ecdc4 16%, #101820);
+}
+
+.ssd-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 10px;
+}
+
+.ssd-btn {
+ flex: 1;
+ min-height: 40px;
+ border-radius: 10px;
+ border: 1px solid color-mix(in srgb, #4ecdc4 35%, transparent);
+ background: color-mix(in srgb, #4ecdc4 18%, transparent);
+ color: #d7fff8;
+ font: inherit;
+ font-size: 12px;
+ font-weight: 650;
+ cursor: pointer;
+}
+
+.ssd-btn.ghost {
+ border-color: color-mix(in srgb, #fff 14%, transparent);
+ background: transparent;
+ color: #9eb0c0;
+}
+
+@keyframes ssd-bob {
+ 0%,
+ 100% {
+ transform: translateY(0);
+ }
+ 50% {
+ transform: translateY(-3px);
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .ssd-orb {
+ animation: none;
+ }
+}
diff --git a/src/modules/social/components/SocialSkinDebugBall.tsx b/src/modules/social/components/SocialSkinDebugBall.tsx
new file mode 100644
index 0000000..6cd7bb9
--- /dev/null
+++ b/src/modules/social/components/SocialSkinDebugBall.tsx
@@ -0,0 +1,121 @@
+"use client";
+
+import { useEffect, useId, useState } from "react";
+import {
+ applySocialSkinDebug,
+ clearSocialSkinDebug,
+ isSocialSkinDevHost,
+ parseSocialSkin,
+ readSocialSkin,
+ readSocialSkinDebugLock,
+ SOCIAL_SKIN_OPTIONS,
+ type SocialSkin,
+} from "@social/lib/skin";
+import "./SocialSkinDebugBall.css";
+
+const SKIN_EVENT = "nomadro-social-skin-change";
+
+function emitSkinChange(skin: SocialSkin) {
+ if (typeof window === "undefined") return;
+ window.dispatchEvent(
+ new CustomEvent(SKIN_EVENT, { detail: { skin } }),
+ );
+}
+
+export default function SocialSkinDebugBall() {
+ const panelId = useId();
+ const [visible, setVisible] = useState(false);
+ const [open, setOpen] = useState(false);
+ const [skin, setSkin] = useState("1");
+ const [locked, setLocked] = useState(false);
+
+ useEffect(() => {
+ if (!isSocialSkinDevHost()) return;
+ setVisible(true);
+ setSkin(readSocialSkin());
+ setLocked(readSocialSkinDebugLock());
+ const onChange = (event: Event) => {
+ const detail = (event as CustomEvent<{ skin?: string }>).detail;
+ if (detail?.skin) setSkin(parseSocialSkin(detail.skin));
+ else setSkin(readSocialSkin());
+ setLocked(readSocialSkinDebugLock());
+ };
+ window.addEventListener(SKIN_EVENT, onChange);
+ window.addEventListener("storage", onChange);
+ return () => {
+ window.removeEventListener(SKIN_EVENT, onChange);
+ window.removeEventListener("storage", onChange);
+ };
+ }, []);
+
+ if (!visible) return null;
+
+ const pick = (next: SocialSkin) => {
+ applySocialSkinDebug(next);
+ setSkin(next);
+ setLocked(true);
+ emitSkinChange(next);
+ };
+
+ const followRemote = () => {
+ clearSocialSkinDebug();
+ setLocked(false);
+ // SiteShell 收到事件后会按远程 socialSkin 重新应用
+ emitSkinChange(skin);
+ };
+
+ return (
+
+ {open ? (
+
+
+ 本地调试
+ {locked ? "已锁定本地主题" : "跟随远程配置"}
+
+
+ {SOCIAL_SKIN_OPTIONS.map((option) => (
+
+ ))}
+
+
+
+
+
+
+ ) : null}
+
+
+ );
+}
diff --git a/src/modules/social/lib/api.ts b/src/modules/social/lib/api.ts
index 827a1ac..d180e34 100644
--- a/src/modules/social/lib/api.ts
+++ b/src/modules/social/lib/api.ts
@@ -553,12 +553,23 @@ export const socialApi = {
};
const email = socialEmail();
if (email) headers["X-Social-Email"] = email;
+ // Prefer portal (local seed + server forward to PB). If portal only stored
+ // locally (forward failed), fall through to social so admin can see it.
const urls = [
"/api/portal/feedback",
"https://nomadro.com/api/portal/feedback",
`${BASE}/feedback`,
+ "https://nomadro.com/api/social/v1/feedback",
];
let lastErr = "";
+ let localOnly: {
+ ok?: boolean;
+ id?: string;
+ stored?: string;
+ forwarded?: boolean;
+ remaining?: number;
+ max?: number;
+ } | null = null;
for (const url of urls) {
try {
const res = await fetch(url, {
@@ -566,7 +577,7 @@ export const socialApi = {
headers,
body: JSON.stringify(body),
cache: "no-store",
- signal: AbortSignal.timeout(url.startsWith("http") ? 12000 : 4000),
+ signal: AbortSignal.timeout(url.startsWith("http") ? 12000 : 8000),
});
if (!res.ok) {
const raw = await res.text().catch(() => `HTTP ${res.status}`);
@@ -586,13 +597,22 @@ export const socialApi = {
lastErr = detail.slice(0, 200);
continue;
}
- return (await res.json()) as {
+ const data = (await res.json()) as {
ok?: boolean;
id?: string;
stored?: string;
+ forwarded?: boolean;
remaining?: number;
max?: number;
};
+ const synced =
+ data.forwarded === true ||
+ data.stored === "pb" ||
+ data.stored === "pocketbase" ||
+ url.includes("/api/social/");
+ if (synced) return data;
+ // Portal wrote local JSON only — keep trying upstreams for admin visibility.
+ localOnly = data;
} catch (e) {
if (e instanceof Error && /最多提交/.test(e.message)) throw e;
const raw = e instanceof Error ? e.message : String(e);
@@ -601,6 +621,7 @@ export const socialApi = {
: raw;
}
}
+ if (localOnly) return localOnly;
throw new Error(lastErr || "反馈提交失败");
},
diff --git a/src/modules/social/lib/catalog.ts b/src/modules/social/lib/catalog.ts
index 8f15d38..0c718f7 100644
--- a/src/modules/social/lib/catalog.ts
+++ b/src/modules/social/lib/catalog.ts
@@ -98,7 +98,7 @@ export const SOCIAL_SECTIONS: SocialSection[] = [
{
id: "grow",
title: "一起做事",
- subtitle: "找搭子 · 招聘 · 共创 · 远程工作",
+ subtitle: "找搭子 · 共创 · 远程协作",
features: [
{
id: "people",
@@ -108,14 +108,6 @@ export const SOCIAL_SECTIONS: SocialSection[] = [
href: "/people",
status: "live",
},
- {
- id: "team",
- emoji: "🧑💻",
- title: "招聘",
- desc: "帮忙、兼职、一起做点事",
- href: "/team",
- status: "live",
- },
{
id: "cocreate",
emoji: "✨",
@@ -127,7 +119,7 @@ export const SOCIAL_SECTIONS: SocialSection[] = [
{
id: "work",
emoji: "🗂️",
- title: "远程工作",
+ title: "远程协作",
desc: "看板协作 · 实时文档 · 团队二次开发底座",
href: "/work",
status: "live",
diff --git a/src/modules/social/lib/i18n.ts b/src/modules/social/lib/i18n.ts
index b3d9f0d..6100793 100644
--- a/src/modules/social/lib/i18n.ts
+++ b/src/modules/social/lib/i18n.ts
@@ -72,7 +72,7 @@ const zh: SocialDictionary = {
footerTagline: "游民社区 · 认识同频的人",
watchStory: "看看社区故事",
proofTitle: "同频的人,正在这里相遇",
- proofLead: "自由职业 · 远程工作 · 出来见一面",
+ proofLead: "自由职业 · 远程协作 · 出来见一面",
navGroups: [
{
id: "online",
@@ -97,9 +97,8 @@ const zh: SocialDictionary = {
label: "一起做事",
items: [
{ href: "/people", label: "找搭子" },
- { href: "/team", label: "招聘" },
{ href: "/ebook", label: "共创" },
- { href: "/work", label: "远程工作" },
+ { href: "/work", label: "远程协作" },
],
},
],
@@ -117,9 +116,9 @@ const zh: SocialDictionary = {
{ href: "/date", label: "约会", emoji: "💕" },
{ href: "/meetup", label: "语音厅", emoji: "📡" },
{ href: "/chat", label: "聊天群", emoji: "💬" },
- { href: "/team", label: "招聘", emoji: "🚀" },
- { href: "/work", label: "远程工作", emoji: "🗂️" },
+ { href: "/work", label: "远程协作", emoji: "🗂️" },
{ href: "/ebook", label: "共创", emoji: "🎨" },
+ { href: "/team", label: "招聘", emoji: "💼" },
{ href: "/wrapped", label: "年度回顾", emoji: "✨" },
{ href: "/join", label: "加入社区", emoji: "✨" },
],
@@ -129,8 +128,8 @@ const zh: SocialDictionary = {
{ href: "/coffeechat", label: "线下咖啡", emoji: "☕", external: true },
{ href: "#cities", label: "城市", emoji: "📍" },
{ href: "/map", label: "地图", emoji: "🗺️", external: true },
- { href: "/team", label: "招聘", emoji: "🚀", external: true },
{ href: "#team", label: "一起做事", emoji: "🚀" },
+ { href: "#hire", label: "招聘", emoji: "💼" },
{ href: "/wrapped", label: "年度回顾", emoji: "✨", external: true },
],
landing: {
@@ -150,7 +149,7 @@ const zh: SocialDictionary = {
socialWayChat: "语音厅",
socialWayDate: "约会",
socialWayCafe: "找个地方见面",
- socialWayTeam: "招聘 · 共创",
+ socialWayTeam: "共创",
socialPayJoinLabel: "加入社区",
socialOaJoinLabel: "先看看公众号",
},
@@ -173,7 +172,7 @@ const en: SocialDictionary = {
footerTagline: "Nomad Social · Meet people on your wavelength",
watchStory: "Watch community story",
proofTitle: "People on your wavelength are meeting here",
- proofLead: "Freelance · remote work · meet in person",
+ proofLead: "Freelance · remote collaboration · meet in person",
navGroups: [
{
id: "online",
@@ -198,9 +197,8 @@ const en: SocialDictionary = {
label: "Build together",
items: [
{ href: "/people", label: "Find buddies" },
- { href: "/team", label: "Hiring" },
{ href: "/ebook", label: "Co-create" },
- { href: "/work", label: "Remote work" },
+ { href: "/work", label: "Remote collaboration" },
],
},
],
@@ -218,9 +216,9 @@ const en: SocialDictionary = {
{ href: "/date", label: "Dating", emoji: "💕" },
{ href: "/meetup", label: "Voice lounge", emoji: "📡" },
{ href: "/chat", label: "Chat rooms", emoji: "💬" },
- { href: "/team", label: "Hiring", emoji: "🚀" },
- { href: "/work", label: "Remote work", emoji: "🗂️" },
+ { href: "/work", label: "Remote collaboration", emoji: "🗂️" },
{ href: "/ebook", label: "Co-create", emoji: "🎨" },
+ { href: "/team", label: "Hiring", emoji: "💼" },
{ href: "/wrapped", label: "Year wrapped", emoji: "✨" },
{ href: "/join", label: "Join", emoji: "✨" },
],
@@ -230,8 +228,8 @@ const en: SocialDictionary = {
{ href: "/coffeechat", label: "Coffee chat", emoji: "☕", external: true },
{ href: "#cities", label: "Cities", emoji: "📍" },
{ href: "/map", label: "Map", emoji: "🗺️", external: true },
- { href: "/team", label: "Hiring", emoji: "🚀", external: true },
{ href: "#team", label: "Collaborate", emoji: "🚀" },
+ { href: "#hire", label: "Hiring", emoji: "💼" },
{ href: "/wrapped", label: "Year wrapped", emoji: "✨", external: true },
],
landing: {
@@ -251,7 +249,7 @@ const en: SocialDictionary = {
socialWayChat: "Voice lounge",
socialWayDate: "Dating",
socialWayCafe: "Find a place to meet",
- socialWayTeam: "Hiring · co-create",
+ socialWayTeam: "Co-create",
socialPayJoinLabel: "Join community",
socialOaJoinLabel: "Follow our WeChat OA",
},
diff --git a/src/modules/social/lib/joinFlow.ts b/src/modules/social/lib/joinFlow.ts
index 82370ef..d32fe8f 100644
--- a/src/modules/social/lib/joinFlow.ts
+++ b/src/modules/social/lib/joinFlow.ts
@@ -229,12 +229,12 @@ const JOIN_GATE_COPY: Record<
avatarHint: "补全头像等资料后即可继续约会",
},
work: {
- guestTitle: "登录后使用远程工作",
+ guestTitle: "登录后使用远程协作",
guestHint: "看板与实时文档需先登录 / 注册加入社区",
- profileHint: "你已登录,请先完善资料再使用远程工作",
+ profileHint: "你已登录,请先完善资料再使用远程协作",
liveHint: "完成自拍确认后即可使用看板与文档",
- payHint: "你已登录邮箱,请继续完成加入后再使用远程工作",
- avatarHint: "补全头像等资料后即可使用远程工作",
+ payHint: "你已登录邮箱,请继续完成加入后再使用远程协作",
+ avatarHint: "补全头像等资料后即可使用远程协作",
},
};
diff --git a/src/modules/social/lib/livenessGate.ts b/src/modules/social/lib/livenessGate.ts
index 182615e..59aba17 100644
--- a/src/modules/social/lib/livenessGate.ts
+++ b/src/modules/social/lib/livenessGate.ts
@@ -147,7 +147,7 @@ export function clearLivenessState(): void {
/**
* Locked until live selfie passes:
* 群聊 / 语音视频 / 约会 / 咖啡聊 / 地图 / 「一起做事」下拉相关。
- * 含远程工作:未注册无权限,提示登录 / 注册 / 补充资料。
+ * 含远程协作:未注册无权限,提示登录 / 注册 / 补充资料。
*/
export const LIVENESS_GATED_PATHS = [
"/social/chat",
diff --git a/src/modules/social/lib/phrases.ts b/src/modules/social/lib/phrases.ts
index 18d55dc..2760230 100644
--- a/src/modules/social/lib/phrases.ts
+++ b/src/modules/social/lib/phrases.ts
@@ -395,6 +395,8 @@ export const SOCIAL_PHRASES_EN: Record = {
"先进聊天群组热热身,再开语音或视频见面。「想参加」会先记在你这边。": "Warm up in chat, then hop on voice or video. “Interested” is saved on this device first.",
"认识了、聊过之后,出来见一面会更自然。先挑一座城市,再找适合见面的咖啡馆。": "After chatting, meeting in person feels more natural. Pick a city, then a café that works for meeting.",
"有人在找帮手;也有人一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。": "Some look for helpers; others co-create guides and videos. Open a card for details, then express interest if it fits.",
+ "一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。": "Co-create guides and videos together. Open a card for details, then express interest if it fits.",
+ "有人在找帮手。点卡片看看详情,合适再表达兴趣。": "Someone is looking for help. Open a card for details, then express interest if it fits.",
"群里打个招呼 → 开麦 / 开视频 → 认识新朋友": "Say hi in chat → unmute / video → meet people",
"每场标注活动时区,并换算你的本地时间 · 「想参加」先记在你这边,还不等于已经约好": "Each event shows its timezone and yours · “Interested” is local only — not a booking",
"「想参加」还不等于已经约好 · 随时可以离开回去看别的场": "“Interested” is not a booking · leave anytime and try another room",
@@ -484,18 +486,20 @@ export const SOCIAL_PHRASES_EN: Record = {
"想接着逛?先加入社区": "Want to keep exploring? Join first",
"想用更多功能,先加入社区": "Join to unlock more",
"登录": "Log in",
- "登录后使用远程工作": "Sign in to use remote work",
+ "登录后使用远程协作": "Sign in to use remote collaboration",
"看板与实时文档需先登录 / 注册加入社区":
"Boards and live pads require sign-in / joining the community",
- "你已登录,请先完善资料再使用远程工作":
- "You're signed in — complete your profile to use remote work",
+ "你已登录,请先完善资料再使用远程协作":
+ "You're signed in — complete your profile to use remote collaboration",
"完成自拍确认后即可使用看板与文档":
"Finish selfie verification to use boards and pads",
- "你已登录邮箱,请继续完成加入后再使用远程工作":
- "You're signed in — finish joining to use remote work",
- "补全头像等资料后即可使用远程工作":
- "Add your photo and profile to use remote work",
- "加入后使用远程工作": "Join to use remote work",
+ "你已登录邮箱,请继续完成加入后再使用远程协作":
+ "You're signed in — finish joining to use remote collaboration",
+ "补全头像等资料后即可使用远程协作":
+ "Add your photo and profile to use remote collaboration",
+ "加入后使用远程协作": "Join to use remote collaboration",
+ "远程协作": "Remote collaboration",
+ "远程工作": "Remote collaboration",
"看板与实时文档需登录并完成资料后使用":
"Boards and pads require sign-in and a completed profile",
"登录 / 注册": "Log in / Sign up",
diff --git a/src/modules/social/lib/skin.ts b/src/modules/social/lib/skin.ts
index 52732b0..b8980ed 100644
--- a/src/modules/social/lib/skin.ts
+++ b/src/modules/social/lib/skin.ts
@@ -1,15 +1,59 @@
-/** 游民社区视觉主题:1=现网社区对齐,2=独立自定义 */
+/** 游民社区视觉主题:1=旅居社群(当前默认)· 2=琥珀信号 · 3/4=预留 */
-export type SocialSkin = "1" | "2";
+export type SocialSkin = "1" | "2" | "3" | "4";
export const SOCIAL_SKIN_KEY = "nomadro-social-skin";
+/** 本地调试锁定:有值时门户不跟远程 socialSkin 覆盖 */
+export const SOCIAL_SKIN_DEBUG_LOCK_KEY = "nomadro-social-skin-debug-lock";
export const SOCIAL_SKIN_DEFAULT: SocialSkin = "1";
+export const SOCIAL_SKIN_OPTIONS: ReadonlyArray<{
+ id: SocialSkin;
+ label: string;
+ note: string;
+}> = [
+ { id: "1", label: "主题1 · 旅居社群", note: "当前线上默认样式" },
+ { id: "2", label: "主题2 · 琥珀信号", note: "琥珀强调 + 科技线" },
+ { id: "3", label: "主题3 · 预留", note: "可后续扩展 CSS" },
+ { id: "4", label: "主题4 · 预留", note: "可后续扩展 CSS" },
+];
+
+export function parseSocialSkin(value: unknown): SocialSkin {
+ const v = String(value ?? "").trim();
+ if (v === "1" || v === "2" || v === "3" || v === "4") return v;
+ return SOCIAL_SKIN_DEFAULT;
+}
+
+export function isSocialSkinDevHost(): boolean {
+ if (typeof window === "undefined") return false;
+ if (process.env.NODE_ENV === "development") return true;
+ const host = window.location.hostname;
+ return host === "localhost" || host === "127.0.0.1" || host === "[::1]";
+}
+
+export function readSocialSkinDebugLock(): boolean {
+ if (typeof window === "undefined") return false;
+ try {
+ return localStorage.getItem(SOCIAL_SKIN_DEBUG_LOCK_KEY) === "1";
+ } catch {
+ return false;
+ }
+}
+
+export function writeSocialSkinDebugLock(locked: boolean) {
+ if (typeof window === "undefined") return;
+ try {
+ if (locked) localStorage.setItem(SOCIAL_SKIN_DEBUG_LOCK_KEY, "1");
+ else localStorage.removeItem(SOCIAL_SKIN_DEBUG_LOCK_KEY);
+ } catch {
+ /* ignore */
+ }
+}
+
export function readSocialSkin(): SocialSkin {
if (typeof window === "undefined") return SOCIAL_SKIN_DEFAULT;
try {
- const v = localStorage.getItem(SOCIAL_SKIN_KEY);
- if (v === "1" || v === "2") return v;
+ return parseSocialSkin(localStorage.getItem(SOCIAL_SKIN_KEY));
} catch {
/* ignore */
}
@@ -17,16 +61,28 @@ export function readSocialSkin(): SocialSkin {
}
export function writeSocialSkin(skin: SocialSkin) {
+ const next = parseSocialSkin(skin);
try {
- localStorage.setItem(SOCIAL_SKIN_KEY, skin);
+ localStorage.setItem(SOCIAL_SKIN_KEY, next);
} catch {
/* ignore */
}
if (typeof document !== "undefined") {
- document.documentElement.setAttribute("data-social-skin", skin);
+ document.documentElement.setAttribute("data-social-skin", next);
}
}
export function applySocialSkin(skin: SocialSkin) {
- writeSocialSkin(skin);
+ writeSocialSkin(parseSocialSkin(skin));
+}
+
+/** 本地调试:切主题并锁定,避免被远程配置打回 */
+export function applySocialSkinDebug(skin: SocialSkin) {
+ writeSocialSkinDebugLock(true);
+ applySocialSkin(skin);
+}
+
+export function clearSocialSkinDebug(fallback?: SocialSkin) {
+ writeSocialSkinDebugLock(false);
+ if (fallback) applySocialSkin(fallback);
}
diff --git a/src/modules/work/components/WorkAccessGate.tsx b/src/modules/work/components/WorkAccessGate.tsx
index 7e3e4f0..57a9dd4 100644
--- a/src/modules/work/components/WorkAccessGate.tsx
+++ b/src/modules/work/components/WorkAccessGate.tsx
@@ -1,7 +1,7 @@
"use client";
/**
- * 远程工作门禁:未注册 / 未完成加入 → 提示登录、注册或补充资料。
+ * 远程协作门禁:未注册 / 未完成加入 → 提示登录、注册或补充资料。
*/
import Link from "next/link";
import { useEffect, useSyncExternalStore, type ReactNode } from "react";
@@ -64,7 +64,7 @@ export default function WorkAccessGate({ children }: { children: ReactNode }) {
gate.kind === "continue" || gate.kind === "join-modal"
? socialTx(gate.title)
: zh
- ? "加入后使用远程工作"
+ ? "加入后使用远程协作"
: "Join to use remote work";
const hint =
gate.kind === "continue" || gate.kind === "join-modal"
@@ -74,7 +74,7 @@ export default function WorkAccessGate({ children }: { children: ReactNode }) {
: "Boards and pads require sign-in and a completed profile";
return (
-
+
diff --git a/src/modules/work/components/WorkClient.tsx b/src/modules/work/components/WorkClient.tsx
index 13dd1de..3445e2e 100644
--- a/src/modules/work/components/WorkClient.tsx
+++ b/src/modules/work/components/WorkClient.tsx
@@ -34,7 +34,7 @@ export default function WorkClient() {
}, []);
return (
-
+
diff --git a/src/modules/work/micro/MicroAppHost.tsx b/src/modules/work/micro/MicroAppHost.tsx
index 7a204f3..34832f1 100644
--- a/src/modules/work/micro/MicroAppHost.tsx
+++ b/src/modules/work/micro/MicroAppHost.tsx
@@ -105,7 +105,7 @@ export default function MicroAppHost({ appId }: Props) {