diff --git a/README.md b/README.md index 68d3854..a251124 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ 2026-11 平台升级已部署至 `.com` 门户、API 与 [Web 管理后台](https://admin.nomadro.com)。升级内容、验收范围、构建编号与回滚位置见 [升级记录](docs/platform-upgrade-2026-11.md)。`.cn` 未同步本次发版。 +**归档禁发:** 分支 `test12`(Codex 实验改动)已冻结,**永远不要上线**;见 [docs/archive/test12-NEVER-DEPLOY.md](docs/archive/test12-NEVER-DEPLOY.md) 与 tag `archive/test12-never-deploy`。 + ## 架构 ``` 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 5d55f37..8076c1a 100644 --- a/apps/api/services/ebook_svc/routers/social_ugc_admin.py +++ b/apps/api/services/ebook_svc/routers/social_ugc_admin.py @@ -383,6 +383,64 @@ class CatalogBody(BaseModel): videos: list[dict[str, Any]] | None = None +class ExperiencePageCopy(BaseModel): + eyebrow: str = Field(default="", max_length=200) + title: str = Field(default="", max_length=300) + accent: str = Field(default="", max_length=300) + description: str = Field(default="", max_length=2000) + + +class ExperienceAnnouncement(BaseModel): + enabled: bool = False + zh: str = Field(default="", max_length=400) + en: str = Field(default="", max_length=400) + href: str = Field(default="/social/people", max_length=500, pattern=r"^(?:/(?:social(?:/|\?|$)|$)[^\\]*|)$") + + +class ExperienceSettings(BaseModel): + navigation: dict[str, bool] = Field(default_factory=dict, max_length=50) + sections: dict[str, bool] = Field(default_factory=dict, max_length=50) + pages: dict[str, dict[str, ExperiencePageCopy]] = Field(default_factory=dict, max_length=2) + announcement: ExperienceAnnouncement = Field(default_factory=ExperienceAnnouncement) + featuredCityIds: list[str] = Field(default_factory=list, max_length=12) + + +class ExperienceBody(BaseModel): + expectedVersion: int = Field(ge=0) + experience: ExperienceSettings + + +@router.get("/experience") +async def get_experience(_: str = Depends(require_admin)) -> dict[str, Any]: + from ebook_svc.services.social_ops import _read_raw + + raw = _read_raw() + copy = raw.get("copy") if isinstance(raw.get("copy"), dict) else {} + settings = copy.get("socialExperience") + return {"ok": True, "version": int(raw.get("version") or 1), "experience": settings if isinstance(settings, dict) else {}} + + +@router.put("/experience") +async def put_experience(body: ExperienceBody, _: str = Depends(require_admin)) -> dict[str, Any]: + """Publish only community presentation settings, retaining all business data.""" + from ebook_svc.services.social_ops import _read_raw + from ebook_svc.services.weapp_switches import _write_raw + + if any(locale not in {"zh", "en"} for locale in body.experience.pages): + raise HTTPException(422, "仅支持 zh / en 文案") + if any(len(pages) > 50 for pages in body.experience.pages.values()): + raise HTTPException(422, "页面文案条目过多") + raw = _read_raw() + if int(raw.get("version") or 1) != body.expectedVersion: + raise HTTPException(409, "配置已被其他操作更新,请先加载最新配置;当前草稿可保留") + out = dict(raw) + copy = dict(raw.get("copy") or {}) + copy["socialExperience"] = body.experience.model_dump() + out["copy"] = copy + _write_raw(out) + return {"ok": True, "version": out.get("version"), "experience": copy["socialExperience"]} + + @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/com/admin/src/App.tsx b/apps/com/admin/src/App.tsx index 91aaf3b..503af71 100644 --- a/apps/com/admin/src/App.tsx +++ b/apps/com/admin/src/App.tsx @@ -12,6 +12,7 @@ const Orders = lazy(() => import('./pages/Orders')) const Users = lazy(() => import('./pages/Users')) const Ntfy = lazy(() => import('./pages/Ntfy')) const Social = lazy(() => import('./pages/Social')) +const SocialExperience = lazy(() => import('./pages/SocialExperience')) const SocialDetail = lazy(() => import('./pages/SocialDetail')) const Blog = lazy(() => import('./pages/Blog')) const Operations = lazy(() => import('./pages/Operations')) @@ -83,6 +84,7 @@ export default function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/apps/com/admin/src/components/WebLayout.tsx b/apps/com/admin/src/components/WebLayout.tsx index 9fce530..c39649e 100644 --- a/apps/com/admin/src/components/WebLayout.tsx +++ b/apps/com/admin/src/components/WebLayout.tsx @@ -29,6 +29,7 @@ function buildNav(lane: LaneKey): NavGroup[] { label: '工作台', items: [ { to: `${s}/overview`, end: true, label: '指挥台', ico: '◈', hint: '总览' }, + { to: `${s}/experience`, label: '社区体验', ico: '✦', hint: '首页 / 导航' }, { to: `${p}/operations`, label: '服务健康', ico: '◎', hint: '实时' }, ], }, diff --git a/apps/com/admin/src/upgrade.css b/apps/com/admin/src/upgrade.css index 9d6fd92..d00a411 100644 --- a/apps/com/admin/src/upgrade.css +++ b/apps/com/admin/src/upgrade.css @@ -353,3 +353,35 @@ tr.is-live-row td:first-child { cursor: pointer; } .com-switch input:disabled { cursor: not-allowed; } +/* Community experience studio */ +.com-experience-fields { border: 0; padding: 0; margin: 0; min-width: 0; } +.com-experience .com-panel { margin-bottom: 22px; } +.com-experience-nav-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 20px; } +.com-experience-nav-grid h3 { font-size: 14px; color: var(--text); margin: 0 0 12px; } +.com-experience-toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 54px; padding: 10px 0; border-bottom: 1px solid var(--line, #ffffff14); font-size: 13px; cursor: pointer; } +.com-experience-toggle small { display: block; font-size: 10px; color: var(--muted, #94a3b8); margin-top: 5px; } +.com-experience-toggle input { accent-color: #4ecdc4; width: 19px; height: 19px; flex-shrink: 0; } +.com-experience-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; } +.com-experience .com-field { display: flex; flex-direction: column; gap: 8px; font-size: 12px; margin-top: 18px; } +.com-experience :is(input:not([type=checkbox]), textarea, select) { background: var(--input-bg, #ffffff06); color: var(--text); border: 1px solid var(--line, #ffffff1c); border-radius: 8px; padding: 12px; font: inherit; font-size: 14px; min-width: 0; width: 100%; } +.com-experience select { min-height: 44px; } +.com-experience select option { background: var(--panel, #111827); } +.com-experience-editor-head { display: flex; gap: 20px; align-items: flex-start; } +.com-experience-editor-head > div { flex: 1; } +.com-experience-editor-head > label { display: flex; flex-direction: column; gap: 7px; font-size: 11px; } +.com-experience-copy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; } +.com-experience-copy-grid > label:last-child { grid-column: 1 / -1; } +.com-experience-preview { border: 1px solid #79ded02a; border-radius: 14px; background: linear-gradient(120deg, #79ded009, transparent); padding: 28px; margin-top: 26px; } +.com-experience-preview small { color: #53b4a8; font-size: 10px; letter-spacing: .1em; } +.com-experience-preview h2 { font-size: 28px; margin: 15px 0; line-height: 1.5; } +.com-experience-preview h2 > span { color: #53b4a8; } +.com-experience-preview p { color: var(--muted); line-height: 1.9; font-size: 13px; } +.com-experience-save { position: sticky; bottom: 12px; background: var(--panel, #111827); border: 1px solid var(--line, #ffffff1c); display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-radius: 12px; box-shadow: 0 6px 25px #0003; gap: 16px; z-index: 5; } +.com-experience-save > span { color: var(--muted); font-size: 12px; } +@media (max-width: 760px) { + .com-experience-nav-grid, .com-experience-columns, .com-experience-copy-grid { grid-template-columns: 1fr; } + .com-experience-editor-head { flex-wrap: wrap; } + .com-experience-editor-head > div { flex-basis: 100%; } + .com-experience-copy-grid > label:last-child { grid-column: 1; } + .com-experience-save { flex-direction: column; align-items: stretch; } +} diff --git a/docs/archive/test12-NEVER-DEPLOY.md b/docs/archive/test12-NEVER-DEPLOY.md new file mode 100644 index 0000000..ede764e --- /dev/null +++ b/docs/archive/test12-NEVER-DEPLOY.md @@ -0,0 +1,17 @@ +# test12 — ARCHIVED · NEVER DEPLOY + +**Status:** frozen archive +**Source:** Codex experimental social / admin overhaul +**Date:** 2026-11-05 + +## Hard rule + +- **Do not deploy** `test12` to `nomadro.com`, `nomadro.cn`, admin, API, or any production host. +- **Do not** use this branch as a release / cutover / smoke-deploy source. +- **Do not** merge `test12` into `main` / `pre*` / live release branches without an explicit new product decision that supersedes this archive note. + +This branch exists only for historical reference and selective cherry-pick review. + +## Tag + +`archive/test12-never-deploy` points at the archived tip. diff --git a/next.config.ts b/next.config.ts index 8ac7b4e..5a30903 100644 --- a/next.config.ts +++ b/next.config.ts @@ -43,6 +43,7 @@ const aliases = { }; const nextConfig: NextConfig = { + distDir: process.env.NOMADRO_DIST_DIR || ".next", poweredByHeader: false, compress: true, experimental: { diff --git a/public/social/cities/bali.jpg b/public/social/cities/bali.jpg new file mode 100644 index 0000000..b2da813 Binary files /dev/null and b/public/social/cities/bali.jpg differ diff --git a/public/social/cities/chiangmai.jpg b/public/social/cities/chiangmai.jpg new file mode 100644 index 0000000..2ca1824 Binary files /dev/null and b/public/social/cities/chiangmai.jpg differ diff --git a/public/social/cities/dali.jpg b/public/social/cities/dali.jpg new file mode 100644 index 0000000..4095904 Binary files /dev/null and b/public/social/cities/dali.jpg differ diff --git a/public/social/cities/lisbon.jpg b/public/social/cities/lisbon.jpg new file mode 100644 index 0000000..707cef7 Binary files /dev/null and b/public/social/cities/lisbon.jpg differ diff --git a/scripts/audit-social-experience.py b/scripts/audit-social-experience.py new file mode 100644 index 0000000..fce1730 --- /dev/null +++ b/scripts/audit-social-experience.py @@ -0,0 +1,46 @@ +"""Read-only browser inventory and responsive screenshots of the social surface.""" +import argparse +import asyncio +import json +from pathlib import Path +from playwright.async_api import async_playwright + + +async def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--base-url', default='https://nomadro.com') + parser.add_argument('--output', default='artifacts/social-overhaul/before') + parser.add_argument('--routes', nargs='*', default=['', '/people', '/date', '/chat', '/meetup', '/coffeechat', '/map', '/places', '/team', '/ebook', '/skills', '/work', '/feedback']) + args = parser.parse_args() + output = Path(args.output) + output.mkdir(parents=True, exist_ok=True) + rows = [] + async with async_playwright() as p: + browser = await p.chromium.launch() + context = await browser.new_context(locale='zh-CN', timezone_id='Asia/Shanghai', reduced_motion='reduce') + page = await context.new_page() + errors = [] + page.on('pageerror', lambda error: errors.append(str(error))) + for route in args.routes: + row = {'route': '/social' + route} + try: + await page.set_viewport_size({'width': 1440, 'height': 1000}) + response = await page.goto(args.base_url.rstrip('/') + '/social' + route, wait_until='domcontentloaded', timeout=60000) + await page.wait_for_timeout(1800) + row.update(status=response.status, title=await page.title(), headings=await page.locator('h1,h2').all_text_contents()) + for width in [1440, 390]: + await page.set_viewport_size({'width': width, 'height': 900}) + await page.screenshot(path=str(output / f'{route.strip("/").replace("/", "-") or "home"}-{width}.png'), full_page=True) + row[str(width)] = await page.evaluate('({overflow:document.documentElement.scrollWidth-innerWidth,height:document.documentElement.scrollHeight})') + if not route: + row['nav'] = await page.locator('.nav-links').inner_text() + except Exception as error: + row['error'] = str(error) + rows.append(row) + print(json.dumps(row, ensure_ascii=True), flush=True) + (output / 'report.json').write_text(json.dumps({'rows': rows, 'errors': errors}, ensure_ascii=False, indent=2), encoding='utf-8') + await browser.close() + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/scripts/check-social-discovery.py b/scripts/check-social-discovery.py index 84d993a..5475bc8 100644 --- a/scripts/check-social-discovery.py +++ b/scripts/check-social-discovery.py @@ -5,6 +5,8 @@ Uses mocked discovery data; does not publish profiles or send messages. import asyncio import json import os +import sys +sys.stdout.reconfigure(encoding="utf-8") from pathlib import Path from playwright.async_api import async_playwright, expect @@ -30,8 +32,8 @@ async def main(): async def mock(route): if '/roster/discovery' in route.request.url: await route.fulfill(json={'items': [ - {'guestId': 'test-here', 'name': 'Here Offline', 'city': 'Test City', 'status': 'here', 'online': False, 'tags': ['Testing']}, - {'guestId': 'test-soon', 'name': 'Soon Online', 'city': 'Test City', 'status': 'arriving', 'online': True, 'tags': ['Testing']}, + {'guestId': 'test-here', 'name': 'Here Offline', 'city': 'Test City', 'status': 'here', 'online': False, 'tags': ['Testing'], 'faceOk': True, 'avatar': 'https://i.pravatar.cc/100?u=test', 'languages': ['English']}, + {'guestId': 'test-soon', 'name': 'Soon Online', 'city': 'Test City', 'status': 'arriving', 'online': True, 'tags': ['Testing'], 'faceOk': True, 'avatar': 'https://i.pravatar.cc/100?u=test', 'languages': ['English']}, ]}) elif '/realtime/' in route.request.url: await route.fulfill(json={'enabled': False}) @@ -55,8 +57,9 @@ async def main(): await page.locator('.social-filters button').last.click() await expect(cards).to_have_count(1) await page.reload() - await page.locator('.social-filters button').last.click() - await expect(cards).to_have_count(1) + await page.wait_for_timeout(1500) + print('RELOAD',page.url,await page.evaluate("localStorage.getItem('nomadro-social:social-roster-likes')"),errors,await page.locator('.people-results-bar').inner_text(),flush=True) + await expect(cards).to_have_count(1, timeout=15000) await cards.get_by_role('button', name='Unfollow Here Offline').click() await expect(cards).to_have_count(0) await expect(page.get_by_role('button', name='Explore everyone')).to_be_visible() diff --git a/scripts/check-social-overhaul.py b/scripts/check-social-overhaul.py new file mode 100644 index 0000000..fdcb259 --- /dev/null +++ b/scripts/check-social-overhaul.py @@ -0,0 +1,156 @@ +"""Browser acceptance of community navigation, drafts, recovery and admin publishing. +All mutation requests are intercepted; no community content or configuration is published. +""" +import asyncio,json,os,sys +from pathlib import Path +from playwright.async_api import async_playwright,expect +sys.stdout.reconfigure(encoding='utf-8') +BASE=os.environ.get('SOCIAL_BASE_URL','http://localhost:3010') +ADMIN=os.environ.get('SOCIAL_ADMIN_URL','http://localhost:5174') +OUT=Path('artifacts/social-overhaul/acceptance');OUT.mkdir(parents=True,exist_ok=True) + +async def main(): + results=[];errors=[] + async with async_playwright() as p: + browser=await p.chromium.launch() + ctx=await browser.new_context(locale='en-US',timezone_id='America/New_York',viewport={'width':1440,'height':1000},reduced_motion='reduce') + await ctx.add_init_script('''if(!localStorage.getItem('nomadro-ui-locale'))localStorage.setItem('nomadro-ui-locale','en'); + const measure=CanvasRenderingContext2D.prototype.measureText; + CanvasRenderingContext2D.prototype.measureText=function(t){if(t==='mmmmmmmmmmlli中文测试')return {width:100};return measure.call(this,t)};''') + state={'fail':False,'skills':[],'posts':[],'hostsFail':False} + async def mock(route): + req=route.request;url=req.url + if '/api/config' in url: + return await route.fulfill(json={'version':1,'config':{'version':1,'modules':{'social':{'enabled':True}},'copy':{}},'updatedAt':''}) + if '/api/coffee/v1/hosts' in url: + if state['hostsFail']:return await route.abort() + return await route.fulfill(json={'hosts':[{'id':'h1','username':'test-host','name':'Test Host','bio':'Design and travel','city':'Lisbon','timezone':'Europe/Lisbon','event_count':1}]}) + if '/api/social/v1' in url: + if req.method=='GET': + if '/skills' in url:return await route.fulfill(json={'items':state['skills']}) + if '/realtime/' in url:return await route.fulfill(json={'enabled':False}) + return await route.fulfill(json={'items':[],'peers':[],'online':0,'item':None,'count':0}) + if req.method in ['POST','PUT','PATCH','DELETE']: + state['posts'].append(url) + if state['fail'] and ('/skills' in url or '/apply' in url):return await route.abort() + if url.endswith('/skills'): + body=req.post_data_json;state['skills'].append({'id':'test-skill','guestId':req.headers.get('x-social-guest-id'),'author':'Test Author','createdAt':'2026-11-05T00:00:00Z',**body}) + if url.endswith('/close'):state['skills']=[] + return await route.fulfill(json={'ok':True,'id':'test-ack','peers':[],'online':0}) + return await route.fulfill(json={'ok':True}) + await ctx.route('**/api/**',mock) + page=await ctx.new_page();page.on('pageerror',lambda e:errors.append(str(e))) + async def go(path): + response=await page.goto(BASE+'/social'+path);assert response.status==200 + await expect(page.locator('.social-language-toggle')).to_have_attribute('aria-label','切换中文',timeout=20000) + async def check(name,fn): + try: + await fn();results.append({'name':name,'passed':True});print('PASS',name,flush=True) + except Exception as e: + results.append({'name':name,'passed':False,'error':str(e)[:1800]});print('FAIL',name,str(e)[:350],flush=True) + await page.screenshot(path=str(OUT/f'failure-{len(results)}.png'),full_page=True) + if await page.locator('dialog[open]').count():await page.keyboard.press('Escape') + async def navigation(): + await go('') + for i in range(3): + button=page.locator('.nav-group-btn').nth(i);await button.hover();await expect(button).to_have_attribute('aria-expanded','true') + panel=page.locator('.nav-group').nth(i).locator('.nav-group-panel');assert await panel.locator('a').count() in [3,4,6] + await button.focus();await page.keyboard.press('ArrowDown');await expect(panel.locator('a').first).to_be_focused() + await page.keyboard.press('Escape');await expect(button).to_be_focused() + await page.keyboard.press('Control+k');await expect(page.locator('dialog[open]')).to_be_visible() + await page.get_by_role('searchbox',name='Search pages and features').fill('Skill exchange') + await page.keyboard.press('ArrowDown');await page.keyboard.press('Enter');await expect(page).to_have_url(BASE+'/social/skills') + await page.set_viewport_size({'width':390,'height':844}) + menu=page.locator('.mobile-menu-btn');await menu.click();await expect(page.locator('.nav-links')).to_have_class('nav-links open') + await page.keyboard.press('Escape');await expect(menu).to_be_focused() + assert await page.evaluate('document.body.style.overflow')!='hidden' + await page.set_viewport_size({'width':1440,'height':1000}) + await check('navigation, keyboard command search and mobile focus',navigation) + async def theme_language(): + await go('');before=await page.locator('html').get_attribute('data-audience') + await page.locator('.social-theme-toggle').click();await expect(page.locator('html')).to_have_attribute('data-theme','light') + await page.reload();await expect(page.locator('html')).to_have_attribute('data-theme','light') + await page.locator('.social-language-toggle').click();await expect(page.locator('html')).to_have_attribute('lang','zh-CN') + assert await page.locator('html').get_attribute('data-audience')==before + # Reload with user preference; remove init-script override for this explicit persistence check. + await page.evaluate("localStorage.setItem('nomadro-ui-locale','zh')") + await page.goto(BASE+'/social/people');await expect(page.get_by_role('button',name='更多筛选',exact=True)).to_be_visible() + await page.locator('.social-language-toggle').click();await expect(page.locator('.social-language-toggle')).to_have_attribute('aria-label','切换中文') + await page.locator('.social-theme-toggle').click() + await check('day/night persistence and language independent of audience',theme_language) + async def home_search(): + await go('');await page.get_by_role('searchbox',name='Search cities, interests or people').fill('Lisbon') + await page.locator('.community-hero-search button').click();await expect(page).to_have_url(BASE+'/social/people?q=Lisbon') + await expect(page.get_by_role('searchbox')).to_have_value('Lisbon') + await check('home search opens filtered people directory',home_search) + async def skills(): + await go('/skills');await page.get_by_role('button',name='Post an exchange',exact=True).click() + dialog=page.locator('dialog[open]');await dialog.get_by_label('I can offer',exact=True).fill('Playwright coaching');await dialog.get_by_label('I’d love to learn',exact=True).fill('Photography') + await page.keyboard.press('Escape');await page.get_by_role('button',name='Post an exchange',exact=True).click();await expect(dialog.get_by_label('I can offer',exact=True)).to_have_value('Playwright coaching') + state['fail']=True;await dialog.get_by_role('button',name='Publish exchange',exact=True).click();await expect(dialog.get_by_role('alert')).to_be_visible() + state['fail']=False;await dialog.get_by_role('button',name='Publish exchange',exact=True).click();await expect(dialog).to_have_count(0) + await expect(page.locator('.social-skills-card').filter(has_text='Playwright coaching')).to_have_count(1) + await page.get_by_role('button',name='My exchanges',exact=True).click();await expect(page.locator('.social-skills-card')).to_have_count(1) + await page.get_by_role('button',name='Close exchange',exact=True).click();await page.locator('dialog[open]').get_by_role('button',name='Close exchange',exact=True).click() + await expect(page.locator('.social-skills-card')).to_have_count(0) + await check('skill draft, failed submission, retry, refresh and close',skills) + async def roles(): + await go('/team#vol-welcome');dialog=page.locator('dialog[open]');await expect(dialog).to_be_visible() + await dialog.locator('input').nth(0).fill('Test applicant');await dialog.locator('input').nth(1).fill('test@example.invalid') + await page.keyboard.press('Escape');assert '#' not in page.url + await page.locator('.social-role-card button.social-btn').first.click();await expect(dialog.locator('input').nth(0)).to_have_value('Test applicant') + state['fail']=True;await dialog.locator('button[type=submit]').click();await expect(dialog.locator('.social-status.warn')).to_be_visible() + state['fail']=False;await dialog.locator('button[type=submit]').click();await expect(dialog.locator('.social-success')).to_be_visible() + await page.keyboard.press('Escape') + await check('role deep link, separate persistent draft and retry',roles) + async def coffee(): + await go('/coffeechat');await expect(page.locator('.cf-card')).to_have_count(1) + await page.locator('.cf-host-search input').fill('not-a-topic');await expect(page.locator('.cf-card')).to_have_count(0) + await page.get_by_role('button',name='Reset filters',exact=True).click();await expect(page.locator('.cf-card')).to_have_count(1) + state['hostsFail']=True;await page.reload();await expect(page.locator('.cf-error')).to_contain_text('previously viewed') + await expect(page.locator('.cf-card')).to_have_count(1);state['hostsFail']=False + await check('coffee host search, empty reset and offline cache',coffee) + async def map_test(): + await go('/map');await page.set_viewport_size({'width':390,'height':844}) + await page.get_by_role('searchbox',name='Search cities',exact=True).fill('lisbon');await expect(page.locator('.community-map-directory > button')).to_have_count(1) + await page.locator('.community-map-directory > button').click();await expect(page.locator('.community-map-selection')).to_be_visible() + await expect(page.locator('.community-map-selection a')).to_have_attribute('href','/social/places/lisbon') + await page.get_by_role('button',name='Globe',exact=True).click();await expect(page).to_have_url(BASE+'/social/map?city=lisbon&mode=globe') + await page.get_by_role('button',name='Map',exact=True).click();await expect(page.locator('.community-map-stage .social-map-canvas-wrap')).to_be_visible(timeout=20000) + await page.get_by_role('button',name='Clear city',exact=True).click();await expect(page.locator('.community-map-selection')).to_have_count(0) + assert await page.evaluate('document.documentElement.scrollWidth-innerWidth')<=1 + await page.set_viewport_size({'width':1440,'height':1000}) + await check('mobile map search, city selection and flat/globe switching',map_test) + await ctx.close() + admin=await browser.new_context(viewport={'width':1440,'height':1000},reduced_motion='reduce');await admin.add_init_script("localStorage.setItem('nomadro_admin_com_token','mock-acceptance-token')") + state_admin={'version':7,'experience':{},'conflict':False,'writes':[]} + async def admin_mock(route): + url=route.request.url + if '/src/' in url:return await route.continue_() + if '/experience' in url: + if route.request.method=='PUT': + if state_admin['conflict']:return await route.fulfill(status=409,json={'detail':'配置已被其他操作更新,请先加载最新配置;当前草稿可保留'}) + body=route.request.post_data_json;assert body['expectedVersion']==state_admin['version'];state_admin['writes'].append(body) + state_admin['version']+=1;state_admin['experience']=body['experience'] + return await route.fulfill(json={'ok':True,**{k:state_admin[k] for k in ['version','experience']}}) + if '/config/meta' in url:return await route.fulfill(json={'version':state_admin['version'],'updatedAt':''}) + return await route.fulfill(json={'ok':True,'items':[],'peers':[],'online':0}) + await admin.route('**/api/**',admin_mock);page=await admin.new_page();page.on('pageerror',lambda e:errors.append(str(e))) + async def admin_test(): + await page.goto(ADMIN+'/cn/social/experience');await expect(page.get_by_role('heading',name='社区体验设计台')).to_be_visible() + fields=page.locator('.com-experience-copy-grid input');await fields.nth(1).fill('Acceptance home title') + await page.locator('.com-experience-preview').scroll_into_view_if_needed();await expect(page.locator('.com-experience-preview')).to_contain_text('Acceptance home title') + await page.get_by_role('link',name='打开目录配置 ↗',exact=True).click();await expect(page.locator('.com-unsaved-dialog')).to_be_visible();await page.get_by_role('button',name='继续编辑',exact=True).click() + state_admin['conflict']=True;await page.get_by_role('button',name='发布社区体验',exact=True).click();await expect(page.get_by_role('alert')).to_contain_text('配置已被其他操作更新') + await expect(fields.nth(1)).to_have_value('Acceptance home title') + state_admin['conflict']=False;await page.get_by_role('button',name='发布社区体验',exact=True).click();await expect(page.get_by_role('status').filter(has_text='已发布')).to_be_visible() + assert len(state_admin['writes'])==1 + await page.set_viewport_size({'width':390,'height':844});await page.screenshot(path=str(OUT/'admin-390.png'),full_page=True) + assert await page.evaluate('document.documentElement.scrollWidth-innerWidth')<=1 + await check('admin preview, unsaved protection, version conflict and publish',admin_test) + await browser.close() + report={'checks':results,'pageErrors':errors};(OUT/'report.json').write_text(json.dumps(report,indent=2,ensure_ascii=False),encoding='utf-8') + assert all(r['passed'] for r in results) and not errors, 'Acceptance failed; inspect report.json' + print(json.dumps({'passed':len(results),'pageErrors':len(errors)})) + +asyncio.run(main()) diff --git a/scripts/probe-social-layout.py b/scripts/probe-social-layout.py new file mode 100644 index 0000000..c9f2d04 --- /dev/null +++ b/scripts/probe-social-layout.py @@ -0,0 +1,18 @@ +import asyncio +import json +from playwright.async_api import async_playwright + + +async def main(): + async with async_playwright() as p: + browser = await p.chromium.launch() + page = await browser.new_page(viewport={'width': 390, 'height': 844}, reduced_motion='reduce') + await page.goto('http://localhost:3010/social', wait_until='domcontentloaded') + await page.wait_for_timeout(1000) + print(json.dumps(await page.evaluate('''() => [...document.querySelectorAll('body *')].filter(e=>{ + const r=e.getBoundingClientRect(),s=getComputedStyle(e); + return r.right>innerWidth+2 && r.width>0 && !e.closest('svg') && s.position!=='fixed' && s.visibility!=='hidden' + }).slice(0,25).map(e=>({tag:e.tagName,c:e.className,x:e.getBoundingClientRect().x,w:e.getBoundingClientRect().width}))'''))) + await browser.close() + +asyncio.run(main()) diff --git a/src/app/social/chat/page.tsx b/src/app/social/chat/page.tsx index 8eb32fc..e694ef5 100644 --- a/src/app/social/chat/page.tsx +++ b/src/app/social/chat/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Chat rooms | 聊天群 · nomadro", "description": "Share a little of your day, ask a question and meet the Nomadro community."}; + import ChatListClient from "@social/components/ChatListClient"; export default function Page() { diff --git a/src/app/social/coffeechat/page.tsx b/src/app/social/coffeechat/page.tsx index b7f2a82..e35d100 100644 --- a/src/app/social/coffeechat/page.tsx +++ b/src/app/social/coffeechat/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Coffee chats | 线下咖啡聊 · nomadro", "description": "Choose a host, explore their topics and book a time for a real conversation."}; + import CoffeeLanding from "@coffee/components/CoffeeLanding"; export default function Page() { diff --git a/src/app/social/date/page.tsx b/src/app/social/date/page.tsx index e6d08aa..55f5763 100644 --- a/src/app/social/date/page.tsx +++ b/src/app/social/date/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Dating | 约会 · nomadro", "description": "Meet someone new at your own pace. Explore profiles, interests and shared plans."}; + import DateClient from "@social/components/DateClient"; export default function Page() { diff --git a/src/app/social/ebook/page.tsx b/src/app/social/ebook/page.tsx index 403ccc3..573524c 100644 --- a/src/app/social/ebook/page.tsx +++ b/src/app/social/ebook/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Community guides | 社区共创 · nomadro", "description": "Read experiences from the road and contribute a story of your own."}; + import EbookClient from "@social/components/EbookClient"; export default function Page() { diff --git a/src/app/social/feedback/page.tsx b/src/app/social/feedback/page.tsx index 9e5167d..aeec6d9 100644 --- a/src/app/social/feedback/page.tsx +++ b/src/app/social/feedback/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Feedback | 说说想法 · nomadro", "description": "Help shape the community. Share an idea or tell us what could work better."}; + import FeedbackClient from "@social/components/FeedbackClient"; export default function Page() { diff --git a/src/app/social/layout.tsx b/src/app/social/layout.tsx index 49b58b0..969bced 100644 --- a/src/app/social/layout.tsx +++ b/src/app/social/layout.tsx @@ -15,9 +15,11 @@ import "@social/app/h5.css"; import "@social/app/blog.css"; import "@social/app/discovery.css"; import "@social/app/live.css"; +import "@social/app/community.css"; import SocialExperience from "@social/components/SocialExperience"; export const metadata = { + metadataBase: new URL("https://nomadro.com"), title: "游民社区 · nomadro", description: "认识同频的人:看看谁在这儿、开视频聊聊、出来见一面、一起做点事", diff --git a/src/app/social/map/page.tsx b/src/app/social/map/page.tsx index 2230040..9d04e8d 100644 --- a/src/app/social/map/page.tsx +++ b/src/app/social/map/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Community map | 地图 · nomadro", "description": "Explore cities and discover people nearby with approximate city-level locations."}; + import MapClient from "@social/components/MapClient"; export default function SocialMapPage() { diff --git a/src/app/social/meetup/page.tsx b/src/app/social/meetup/page.tsx index de081ff..ade4655 100644 --- a/src/app/social/meetup/page.tsx +++ b/src/app/social/meetup/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Voice lounges | 语音厅 · nomadro", "description": "Find a conversation, explore community sessions and meet through voice and video."}; + import MeetupClient from "@social/components/MeetupClient"; export default function Page() { diff --git a/src/app/social/people/page.tsx b/src/app/social/people/page.tsx index 8837b1e..9bce748 100644 --- a/src/app/social/people/page.tsx +++ b/src/app/social/people/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "People | 想见的人 · nomadro", "description": "Find people by city, interests and skills. Start a conversation with someone on your wavelength."}; + import { Suspense } from "react"; import PeopleClient from "@social/components/PeopleClient"; diff --git a/src/app/social/places/page.tsx b/src/app/social/places/page.tsx index 0ae24d4..863a990 100644 --- a/src/app/social/places/page.tsx +++ b/src/app/social/places/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "City guide | 城市探索 · nomadro", "description": "Find your next stop, explore local life and discover places to meet."}; + import PlacesClient from "@social/components/PlacesClient"; export default function SocialPlacesPage() { diff --git a/src/app/social/skills/page.tsx b/src/app/social/skills/page.tsx index 94987cc..879cea4 100644 --- a/src/app/social/skills/page.tsx +++ b/src/app/social/skills/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Skill exchange | 技能交换 · nomadro", "description": "Share what you know and find something you would love to learn."}; + import SkillsBoardClient from "@social/components/SkillsBoardClient"; export default function Page() { diff --git a/src/app/social/team/page.tsx b/src/app/social/team/page.tsx index 942402e..11fdb1e 100644 --- a/src/app/social/team/page.tsx +++ b/src/app/social/team/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Collaborators | 找搭子 · nomadro", "description": "Find your role, share your skills and join a community project."}; + import TeamClient from "@social/components/TeamClient"; export default function Page() { diff --git a/src/app/social/videos/page.tsx b/src/app/social/videos/page.tsx index dec2517..5bab797 100644 --- a/src/app/social/videos/page.tsx +++ b/src/app/social/videos/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Community films | 社区影像 · nomadro", "description": "Discover stories, interviews and creative work from the Nomadro community."}; + import VideosClient from "@social/components/VideosClient"; export default function Page() { diff --git a/src/app/social/work/page.tsx b/src/app/social/work/page.tsx index fedeb6f..9fea150 100644 --- a/src/app/social/work/page.tsx +++ b/src/app/social/work/page.tsx @@ -1,3 +1,5 @@ +export const metadata = {"title": "Remote collaboration | 远程协作 · nomadro", "description": "Make progress together with shared boards, tasks and documents."}; + import WorkClient from "@work/components/WorkClient"; export default function Page() { diff --git a/src/components/locale-provider.tsx b/src/components/locale-provider.tsx index 56acab5..fbdbddb 100644 --- a/src/components/locale-provider.tsx +++ b/src/components/locale-provider.tsx @@ -32,12 +32,22 @@ type LocaleContextValue = { }; const LocaleContext = createContext(null); +// UI preference is independent from audience/payment detection. +const UI_LOCALE_KEY = "nomadro-ui-locale"; +function preferredLocale(): Locale | null { + try { + const value = window.localStorage.getItem(UI_LOCALE_KEY); + return value && value in dictionaries ? value as Locale : null; + } catch { return null; } +} function bootLocale(): Locale { if (typeof window === "undefined") { return isComHostname() ? "en" : "zh"; } try { + const preferred = preferredLocale(); + if (preferred) return preferred; const profile = detectAudience(); return resolveUiLocale({ isChinaUser: profile.isChina, @@ -68,7 +78,7 @@ export function LocaleProvider({ children }: { children: ReactNode }) { } const profile = detectAudience(); - const ui = resolveUiLocale({ + const ui = preferredLocale() || resolveUiLocale({ isChinaUser: profile.isChina, localeHint: profile.localeHint, }); @@ -104,14 +114,15 @@ export function LocaleProvider({ children }: { children: ReactNode }) { } }, [locale, ready, audienceProfile]); - /** 无 UI 开关;保留 API 供测试 / 脚本,不再写 unlock */ + /** Changing display language never changes the audience lane. */ const setLocale = useCallback((next: Locale) => { setLocaleState(next); + try { window.localStorage.setItem(UI_LOCALE_KEY, next); } catch { /* session preference still works */ } }, []); const value = useMemo(() => { const audience: AudienceLane = - audienceProfile?.audience ?? (locale === "zh" ? "cn" : "intl"); + audienceProfile?.audience ?? (isComHostname() ? "intl" : "cn"); const isChina = audience === "cn"; return { locale, diff --git a/src/components/theme-provider.tsx b/src/components/theme-provider.tsx index 57cbbac..a0565a2 100644 --- a/src/components/theme-provider.tsx +++ b/src/components/theme-provider.tsx @@ -19,41 +19,45 @@ type ThemeContextValue = { const ThemeContext = createContext(null); const STORAGE_KEY = "nomadro-theme"; -/** 产品强制夜间;不再跟随系统 / 用户切换 */ -const FORCED_THEME: "dark" = "dark"; - -function applyDark() { +function applyTheme(mode: ThemeMode) { + const resolved = mode === "system" ? (matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark") : mode; const root = document.documentElement; root.classList.remove("light", "dark"); - root.classList.add("dark"); - root.dataset.theme = "dark"; + root.classList.add(resolved); + root.dataset.theme = resolved; + root.style.colorScheme = resolved; + return resolved; } export function ThemeProvider({ children }: { children: ReactNode }) { - const [theme] = useState(FORCED_THEME); + const [theme, updateTheme] = useState("dark"); const [resolvedTheme, setResolvedTheme] = useState<"light" | "dark">("dark"); - const setTheme = useCallback((_next: ThemeMode) => { - // 日夜切换已隐藏:忽略请求,始终夜间 + const setTheme = useCallback((next: ThemeMode) => { try { - localStorage.setItem(STORAGE_KEY, FORCED_THEME); + localStorage.setItem(STORAGE_KEY, next); } catch { /* ignore */ } - applyDark(); - setResolvedTheme("dark"); + updateTheme(next); + setResolvedTheme(applyTheme(next)); }, []); useEffect(() => { - try { - localStorage.setItem(STORAGE_KEY, FORCED_THEME); - } catch { - /* ignore */ - } - applyDark(); - setResolvedTheme("dark"); + let stored: ThemeMode = "dark"; + try { const value = localStorage.getItem(STORAGE_KEY); if (value === "light" || value === "dark" || value === "system") stored = value; } catch { /* use default */ } + updateTheme(stored); + setResolvedTheme(applyTheme(stored)); }, []); + useEffect(() => { + if (theme !== "system") return; + const media = matchMedia("(prefers-color-scheme: light)"); + const sync = () => setResolvedTheme(applyTheme("system")); + media.addEventListener("change", sync); + return () => media.removeEventListener("change", sync); + }, [theme]); + return ( {children} @@ -67,5 +71,5 @@ export function useTheme() { return ctx; } -/** Inline before paint — always dark (no flash / no light restore) */ -export const themeInitScript = `(function(){try{var r=document.documentElement;r.classList.remove('light','dark');r.classList.add('dark');r.dataset.theme='dark';try{localStorage.setItem('${STORAGE_KEY}','dark')}catch(e){}}catch(e){document.documentElement.classList.add('dark');document.documentElement.dataset.theme='dark'}})();`; +/** Resolve the saved preference before paint to prevent a theme flash. */ +export const themeInitScript = `(function(){try{var t=localStorage.getItem('${STORAGE_KEY}'),m=t==='light'?'light':t==='system'&&matchMedia('(prefers-color-scheme:light)').matches?'light':'dark',r=document.documentElement;r.classList.remove('light','dark');r.classList.add(m);r.dataset.theme=m;r.style.colorScheme=m}catch(e){document.documentElement.dataset.theme='dark'}})();`; diff --git a/src/lib/remote-config.ts b/src/lib/remote-config.ts index b69172a..b515fe2 100644 --- a/src/lib/remote-config.ts +++ b/src/lib/remote-config.ts @@ -280,6 +280,7 @@ export type NomadroRemoteConfig = { description?: string; } >; + socialExperience?: import("~/modules/social/lib/experience").SocialExperienceConfig; socialVideoSources?: Record; socialHiddenSections?: string[]; /** 游民社区目录覆盖;空数组/非法字段回退包内 seed */ diff --git a/src/modules/audience/use-audience-module.ts b/src/modules/audience/use-audience-module.ts index 431292b..34a4a6d 100644 --- a/src/modules/audience/use-audience-module.ts +++ b/src/modules/audience/use-audience-module.ts @@ -1,6 +1,6 @@ "use client"; -import { useMemo } from "react"; +import { useMemo, useSyncExternalStore } from "react"; import { useRemoteConfig } from "~/lib/use-remote-config"; import { detectAudience } from "./detect"; import { @@ -11,6 +11,10 @@ import { } from "./resolve"; import type { AudienceBundle } from "./types"; +const subscribeHydration = () => () => {}; +const clientHydrated = () => true; +const serverHydrated = () => false; + /** * 业务组件唯一入口:识别 + cn|intl 模块 + 远程分轨。 * 用 `bundle.module.pay|login|follow|…`,禁止页面里 if (isChina)。 @@ -23,17 +27,22 @@ export function useAudienceModule(): { payEnabled: boolean; } { const { config, ready } = useRemoteConfig(); + const hydrated = useSyncExternalStore(subscribeHydration, clientHydrated, serverHydrated); const bundle = useMemo( () => resolveAudienceBundle({ - profile: typeof window !== "undefined" ? detectAudience() : undefined, + profile: hydrated ? detectAudience() : { + audience: "intl", isChina: false, inWeChat: false, inWeCom: false, + localeHint: "en", reason: "intl_default", + signals: { lib: false, byLanguage: false, byTimeZone: false, inWeChat: false, inWeCom: false }, + }, config, }), - [config], + [config, hydrated], ); return { - ready, + ready: ready && hydrated, bundle, followChannel: effectiveFollowChannel(bundle), vipCta: effectiveVipCta(bundle), diff --git a/src/modules/coffee/components/CoffeeLanding.tsx b/src/modules/coffee/components/CoffeeLanding.tsx index 9b62e70..489b712 100644 --- a/src/modules/coffee/components/CoffeeLanding.tsx +++ b/src/modules/coffee/components/CoffeeLanding.tsx @@ -10,6 +10,9 @@ import { SOCIAL_CITIES, type SocialCity } from "@social/lib/cities"; import { coffeeApi } from "../lib/api"; import type { CoffeeHost } from "../lib/types"; import "./coffee.css"; +import { useSocialConfig } from "@social/components/SocialExperience"; +import { experiencePage } from "@social/lib/experience"; +import { loadJson, saveJson } from "@social/lib/storage"; const FEATURED_CITY_IDS = [ "chengdu", @@ -37,11 +40,14 @@ function cityMatch(hostCity: string, city: SocialCity) { export default function CoffeeLanding() { const { locale } = useSocialI18n(); const zh = locale === "zh"; + const config = useSocialConfig(); + const copy = experiencePage(config, locale, "coffeechat"); const [hosts, setHosts] = useState([]); const [err, setErr] = useState(null); const [loading, setLoading] = useState(true); const [retry, setRetry] = useState(0); const [cityId, setCityId] = useState("all"); + const [search, setSearch] = useState(""); const cities = useMemo(() => { const hot = SOCIAL_CITIES.filter((c) => FEATURED_CITY_IDS.includes(c.id)); @@ -52,16 +58,18 @@ export default function CoffeeLanding() { const activeCity = cities.find((c) => c.id === cityId) || null; const filtered = useMemo(() => { - if (cityId === "all" || !activeCity) return hosts; - return hosts.filter((h) => cityMatch(h.city, activeCity)); - }, [hosts, cityId, activeCity]); + const query = search.trim().toLowerCase(); + return hosts.filter(h => (cityId === "all" || !activeCity || cityMatch(h.city, activeCity)) && (!query || `${h.name} ${h.username} ${h.bio} ${h.city}`.toLowerCase().includes(query))); + }, [hosts, cityId, activeCity, search]); useEffect(() => { let active = true; + const cached = loadJson("coffee-hosts-cache", []); + if (Array.isArray(cached) && cached.length) setHosts(cached); setLoading(true); setErr(null); void coffeeApi .hosts() - .then((r) => { if (active) setHosts(r.hosts); }) + .then((r) => { if (active) { setHosts(r.hosts); saveJson("coffee-hosts-cache", r.hosts); } }) .catch((e) => { if (active) setErr(e instanceof Error ? e.message : String(e)); }) .finally(() => { if (active) setLoading(false); }); return () => { active = false; }; @@ -75,7 +83,7 @@ export default function CoffeeLanding() {

{zh ? "OFFLINE · CITY" : "OFFLINE · CITY"}

- Nomadro {zh ? "线下 Coffee" : "Offline Coffee"} + {copy.title || "Nomadro"} {copy.accent || (zh ? "线下 Coffee" : "Offline Coffee")}

{zh @@ -83,9 +91,9 @@ export default function CoffeeLanding() { : "Pick a city. Book an offline coffee."}

- {zh + {copy.description || (zh ? "不是线上会议。同城咖啡馆见面,破冰、换签证经验、找搭子——城市就是你的会场。" - : "Not a Zoom. Meet IRL at a café — city is the venue."} + : "Meet at a local café. Swap stories, share experiences, or find someone to explore the city with.")}

- {err &&

{err}

} + + {err &&

{hosts.length ? (zh ? "暂时无法更新,正在显示上次浏览的主理人。请重新加载后确认最新档期。" : "Couldn’t refresh. Showing previously viewed hosts. Retry to confirm current availability.") : (zh ? "暂时无法加载主理人,请稍后重试。" : "Couldn’t load hosts. Please try again.")}

} {err && } {loading &&

{zh ? '正在寻找可约的人…' : 'Loading hosts…'}

} @@ -260,11 +269,11 @@ export default function CoffeeLanding() {
{!filtered.length && !err && !loading ? ( -

+

{zh ? "这城暂时没人开放预约,先逛咖啡馆地图,或换一座城。" : "No hosts here yet — try the café map or another city."} -

+

) : null}
diff --git a/src/modules/social/app/community.css b/src/modules/social/app/community.css new file mode 100644 index 0000000..e014c9c --- /dev/null +++ b/src/modules/social/app/community.css @@ -0,0 +1,469 @@ +/* Social experience: one visual system for discovery, connection and collaboration. */ +.social-skin { + --community-bg: #0b1115; + --community-surface: #111b20; + --community-raised: #172329; + --community-line: rgba(181, 208, 211, .13); + --community-ink: #eef5f3; + --community-muted: #9aaeb3; + --community-mint: #79ded0; + --community-coral: #ff9a82; + --community-amber: #eed599; +} +[data-theme="light"] .social-skin { + --community-bg: #f4f7f6; + --community-surface: #fff; + --community-raised: #eaf0ed; + --community-line: rgba(24, 55, 55, .15); + --community-ink: #172e31; + --community-muted: #53696b; + --community-mint: #197669; + --community-coral: #ad4c31; + --community-amber: #8b681b; +} +.social-skin .community-home { background: var(--community-bg); color: var(--community-ink); } +.social-skin :is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--community-mint); outline-offset: 4px; } +.social-skin :is(input, select, textarea) { scroll-margin-top: 110px; } +.social-skin :is(.community-section, #discover, .community-faq) { scroll-margin-top: 105px; } +.social-skin .container { max-width: 1200px; padding-inline: 28px; } +.social-skin .community-home .navbar, .social-skin .social-workspace .navbar { z-index: 1000; height: 76px; padding: 0; background: color-mix(in srgb, var(--community-bg) 90%, transparent); backdrop-filter: blur(20px); border-bottom: 1px solid var(--community-line); } +.social-skin :is(.community-home, .social-workspace) .nav-container { max-width: 1200px; width: 100%; height: 76px; border: 0; border-radius: 0; padding: 0 28px; background: transparent; box-shadow: none; gap: 24px; } +.social-skin .nav-links { gap: 6px; } +.social-skin .nav-group-btn { min-height: 44px; padding: 10px 14px; color: var(--community-muted); font-size: 13px; gap: 7px; } +.social-skin .nav-group-caret { width: 13px; height: 13px; transition: transform .2s; } +.social-skin .nav-group.open .nav-group-caret { transform: rotate(180deg); } +.social-skin .nav-group.open .nav-group-btn, .social-skin .nav-group.is-active .nav-group-btn { color: var(--community-ink); background: var(--community-raised); } +.social-skin .nav-group-panel { top: calc(100% + 15px); left: 50%; transform: translateX(-50%); width: 440px; padding: 12px; border-radius: 18px; background: var(--community-surface); border: 1px solid var(--community-line); box-shadow: 0 22px 70px #0005; } +.social-skin .nav-group-panel::before { content: ""; position: absolute; height: 20px; inset: -20px 0 auto; } +.social-skin .nav-group:last-child .nav-group-panel { width: 580px; } +.social-skin .nav-panel-heading { padding: 10px 12px 16px; border-bottom: 1px solid var(--community-line); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; } +.social-skin .nav-panel-heading > span { font-size: 13px; font-weight: 600; color: var(--community-ink); } +.social-skin .nav-panel-heading small { font-size: 10px; color: var(--community-muted); } +.social-skin .nav-panel-entries { display: grid; gap: 4px; } +.social-skin .nav-group:last-child .nav-panel-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); } +.social-skin .nav-panel-entries a { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 76px; white-space: normal; border: 1px solid transparent; border-radius: 10px; color: var(--community-ink); font-weight: 400; } +.social-skin .nav-panel-entries a:hover, .social-skin .nav-panel-entries a[aria-current="page"] { background: var(--community-raised); border-color: var(--community-line); color: var(--community-mint); } +.nav-entry-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--community-mint) 9%, transparent); color: var(--community-mint); } +.nav-entry-copy { flex: 1; min-width: 0; } +.nav-entry-copy strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; } +.nav-entry-copy small { display: block; color: var(--community-muted); line-height: 1.55; font-size: 11px; } +.nav-entry-arrow { flex-shrink: 0; opacity: .4; } +.social-skin .nav-actions { gap: 5px; } +.social-skin .nav-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; min-width: 36px; border: 0; color: var(--community-muted); background: transparent; border-radius: 10px; cursor: pointer; } +.social-skin .nav-icon-btn:hover { background: var(--community-raised); color: var(--community-ink); } +.social-skin .nav-icon-btn > span { font-size: 10px; } +.social-skin .social-search-trigger kbd { display: none; } +.social-skin .social-nav-login { background: transparent; border: 0; min-width: 44px; box-shadow: none; color: var(--community-muted); } +.social-skin .social-nav-join { background: var(--community-mint); color: var(--community-bg); border: 0; border-radius: 10px; box-shadow: none; font-size: 12px; } +.social-skin .social-journey-nav { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--community-line); min-width: 0; } +.social-breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--community-muted); white-space: nowrap; } +.social-breadcrumb > a { display: grid; place-items: center; width: 32px; height: 44px; } +.social-journey-links { display: flex; gap: 5px; min-width: 0; overflow-x: auto; scrollbar-width: none; margin-left: auto; } +.social-journey-links > a { display: inline-flex; align-items: center; flex-shrink: 0; gap: 7px; padding: 9px 12px; min-height: 44px; color: var(--community-muted); font-size: 11px; border-radius: 9px; } +.social-journey-links > a[aria-current="page"] { color: var(--community-mint); background: color-mix(in srgb, var(--community-mint) 9%, transparent); } +.social-skin .social-workspace-grid { padding-top: 110px; } +.social-skin .social-workspace .social-page-head { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--community-line); } +.social-skin .social-page-head h1 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; } +.social-skin .social-page-head-mark { display: none; } +.social-skin .social-page-head-accent { color: var(--community-mint); } +.social-skin .social-page-head-eyebrow { font-size: 11px; letter-spacing: .08em; color: var(--community-mint); } +.social-skin .social-page-head-desc { max-width: 680px; font-size: 13px; line-height: 1.9; } +.social-skin .social-demo-badge { font-size: 11px; } +.social-skin .social-workspace-footer { border-top: 1px solid var(--community-line); margin-top: 48px; padding: 30px 0; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; font-size: 11px; color: var(--community-muted); } +.social-skin .social-workspace-footer > div { display: flex; flex-wrap: wrap; gap: 8px 20px; } +.social-skin .social-workspace-footer :is(a, button) { display: inline-flex; align-items: center; min-height: 44px; font-size: 11px; } +.community-home > .social-workspace-footer { max-width: 1144px; margin: 0 auto; } +.community-announcement { position: relative; margin-top: 76px; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 11px 24px; color: var(--community-mint); background: color-mix(in srgb, var(--community-mint) 8%, transparent); font-size: 12px; } +.community-hero { position: relative; padding: 156px 0 0; overflow: clip; } +.community-announcement + .community-hero { padding-top: 65px; } +.community-hero::before { content: ""; pointer-events: none; position: absolute; width: 750px; height: 650px; top: -70px; right: -180px; background: radial-gradient(ellipse, color-mix(in srgb, var(--community-mint) 6%, transparent), transparent 68%); } +.community-hero-layout { display: grid; grid-template-columns: 1.03fr 1fr; align-items: center; gap: 60px; } +.community-kicker { display: flex; align-items: center; gap: 10px; margin: 0 0 24px; font-size: 10px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase; color: var(--community-mint); } +.community-signal { display: inline-block; width: 7px; height: 7px; background: var(--community-mint); border-radius: 50%; box-shadow: 0 0 0 5px color-mix(in srgb, var(--community-mint) 9%, transparent); } +.community-hero h1 { margin: 0; font-size: clamp(38px, 4.6vw, 66px); letter-spacing: -.055em; line-height: 1.25; font-weight: 600; color: var(--community-ink); text-wrap: balance; } +.community-hero h1 > span { color: var(--community-mint); } +.community-hero-lead { margin: 24px 0 26px; max-width: 470px; color: var(--community-muted); line-height: 1.95; font-size: 14px; } +.community-hero-search { display: flex; gap: 12px; align-items: center; border: 1px solid var(--community-line); border-radius: 12px; max-width: 480px; padding: 6px 6px 6px 16px; background: var(--community-surface); color: var(--community-muted); } +.community-hero-search:focus-within { border-color: var(--community-mint); } +.community-hero-search input { flex: 1; width: 100%; min-width: 0; outline: none; background: transparent; border: 0; color: var(--community-ink); padding: 10px 0; font: inherit; font-size: 12px; } +.community-hero-search button { width: 44px; min-height: 44px; display: grid; place-items: center; border: 0; border-radius: 9px; background: var(--community-mint); color: var(--community-bg); cursor: pointer; } +.community-hero-actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 22px; } +.social-skin .community-home .social-btn.primary { background: var(--community-mint); color: var(--community-bg); box-shadow: none; border: 1px solid transparent; border-radius: 10px; padding: 13px 20px; min-height: 48px; font-size: 12px; } +.community-text-link { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; color: var(--community-ink); font-size: 12px; } +.community-text-link:hover { color: var(--community-mint); } +.community-hero-note { display: flex; align-items: center; gap: 12px; margin-top: 32px; color: var(--community-muted); font-size: 10px; line-height: 1.6; } +.community-mini-avatars { display: flex; padding-left: 6px; flex-shrink: 0; } +.community-mini-avatars > * { margin-left: -6px; border: 2px solid var(--community-bg); border-radius: 50%; } +.community-world { position: relative; isolation: isolate; min-height: 440px; border: 1px solid var(--community-line); border-radius: 24px; background: radial-gradient(ellipse at 55% 35%, color-mix(in srgb, var(--community-mint) 5%, transparent), transparent 65%), var(--community-surface); } +.community-world-grid { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background-image: linear-gradient(var(--community-line) 1px, transparent 1px), linear-gradient(90deg, var(--community-line) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse, #0008, transparent 75%); } +.community-world-orbit { position: absolute; top: 42%; left: 50%; width: 255px; height: 255px; transform: translate(-50%, -50%); border: 1px solid color-mix(in srgb, var(--community-mint) 13%, transparent); border-radius: 50%; } +.community-world-orbit.orbit-two { width: 340px; height: 340px; border-style: dashed; opacity: .7; } +.community-world-orbit.orbit-three { width: 160px; height: 160px; } +.community-world-orbit.orbit-two::after { content: ""; position: absolute; height: 8px; width: 8px; background: var(--community-coral); border-radius: 50%; top: 22%; right: 5%; box-shadow: 0 0 20px color-mix(in srgb, var(--community-coral) 30%, transparent); } +.community-world-center { position: absolute; top: 43%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; flex-direction: column; gap: 12px; color: var(--community-mint); } +.community-world-center > span { font-size: 12px; white-space: nowrap; letter-spacing: -.03em; } +.community-world-center > small { font-size: 6px; letter-spacing: .22em; color: var(--community-muted); } +.community-world-person { position: absolute; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--community-line); border-radius: 13px; background: var(--community-surface); box-shadow: 0 12px 30px #0002; transition: translate .2s, border-color .2s; } +.community-world-person:hover { translate: 0 -4px; border-color: var(--community-mint); } +.community-world-person strong { display: block; font-size: 12px; margin-bottom: 6px; color: var(--community-ink); } +.community-world-person small { display: flex; gap: 4px; align-items: center; color: var(--community-muted); font-size: 9px; } +.community-world-person > svg { color: var(--community-muted); margin-left: 4px; } +.community-world-person.person-0 { top: 40px; left: -22px; rotate: -5deg; } +.community-world-person.person-1 { top: 110px; right: -18px; rotate: 5deg; } +.community-world-person.person-2 { top: 235px; left: 10px; rotate: -3deg; } +.community-world-coffee { position: absolute; bottom: 52px; right: -12px; display: flex; align-items: center; gap: 12px; background: var(--community-raised); border: 1px solid var(--community-line); border-radius: 12px; padding: 16px; } +.community-world-coffee > span { color: var(--community-coral); } +.community-world-coffee strong { display: block; font-size: 11px; margin-bottom: 6px; } +.community-world-coffee small { font-size: 9px; color: var(--community-muted); } +.community-world-coffee > svg { color: var(--community-muted); } +.community-world-caption { position: absolute; display: flex; justify-content: space-between; gap: 12px; bottom: 0; left: 20px; right: 20px; padding: 15px 0; border-top: 1px solid var(--community-line); color: var(--community-muted); font-size: 8px; letter-spacing: .03em; } +.community-world-caption > span:first-child { display: flex; align-items: center; gap: 6px; } +.community-hero-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 44px; padding-bottom: 28px; margin-top: 35px; border-bottom: 1px solid var(--community-line); font-size: 9px; color: var(--community-muted); letter-spacing: .06em; } +.community-hero-foot > a { display: flex; align-items: center; gap: 9px; min-height: 44px; } +.social-skin .community-home .social-intent-guide { margin-top: 38px; margin-bottom: 20px; } +.social-skin .community-home .intent-heading { display: none; } +.social-skin .community-home .intent-options button { min-height: 56px; border-radius: 10px; font-size: 12px; background: transparent; border-color: var(--community-line); } +.social-skin .community-home .intent-options button[aria-pressed="true"] { color: var(--community-mint); border-color: color-mix(in srgb, var(--community-mint) 50%, transparent); background: color-mix(in srgb, var(--community-mint) 6%, transparent); } +.social-skin .community-home .intent-panel { background: var(--community-surface); border: 1px solid var(--community-line); border-radius: 14px; padding: 24px; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 24px; } +.social-skin .community-home .intent-art { width: 66px; height: 66px; } +.social-skin .community-home .intent-art > svg { width: 27px; } +.social-skin .community-home .intent-panel-copy h3 { font-size: 19px; } +.social-skin .community-home .intent-panel-copy > p:last-child { font-size: 12px; } +.social-skin .community-home .intent-step { font-size: 9px; } +.community-section { padding-top: 78px; padding-bottom: 20px; } +.community-section-head { display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; margin-bottom: 26px; } +.community-section-head .community-kicker { margin-bottom: 15px; } +.community-kicker > span:not(.community-signal) { font-size: 9px; color: var(--community-muted); padding-right: 10px; border-right: 1px solid var(--community-line); } +.community-section-head h2 { margin: 0 0 14px; font-size: clamp(24px, 2.6vw, 34px); font-weight: 500; letter-spacing: -.04em; line-height: 1.4; } +.community-section-head > div > p:last-child { margin: 0; max-width: 620px; color: var(--community-muted); font-size: 12px; line-height: 1.8; } +.community-section-head > a { flex-shrink: 0; } +.community-city-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; } +.community-city-filters button { border: 1px solid var(--community-line); border-radius: 8px; padding: 10px 14px; min-height: 44px; background: transparent; color: var(--community-muted); font-size: 11px; cursor: pointer; } +.community-city-filters button[aria-pressed="true"] { background: var(--community-raised); color: var(--community-mint); } +.community-people-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } +.community-person-card { background: var(--community-surface); border: 1px solid var(--community-line); border-radius: 15px; padding: 22px; transition: border-color .2s, translate .2s; min-width: 0; } +.community-person-card:hover { border-color: color-mix(in srgb, var(--community-mint) 45%, transparent); translate: 0 -3px; } +.community-person-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; } +.community-follow { width: 44px; height: 44px; border: 1px solid var(--community-line); border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--community-muted); cursor: pointer; } +.community-follow[aria-pressed="true"] { color: var(--community-mint); background: color-mix(in srgb, var(--community-mint) 10%, transparent); border-color: var(--community-mint); } +.community-person-card > a { display: block; } +.community-person-card h3 { font-size: 18px; font-weight: 500; margin: 0 0 7px; } +.community-person-title { font-size: 11px; color: var(--community-muted); margin: 0 0 9px; } +.community-person-city { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--community-muted); } +.community-person-want { font-size: 12px; color: var(--community-ink); margin: 20px 0 14px; min-height: 40px; line-height: 1.75; } +.community-person-tags { display: flex; flex-wrap: wrap; gap: 5px; } +.community-person-tags > span { font-size: 9px; padding: 5px 8px; border-radius: 5px; background: var(--community-raised); color: var(--community-muted); } +.community-person-link { border-top: 1px solid var(--community-line); padding-top: 16px; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--community-mint); } +.community-data-note { font-size: 10px; line-height: 1.9; color: var(--community-muted); margin: 16px 0 0; } +.community-data-note > a { color: var(--community-mint); display: inline-flex; align-items: center; gap: 5px; min-height: 44px; margin-left: 4px; } +.community-cities-section { margin-top: 50px; padding-bottom: 32px; border-block: 1px solid var(--community-line); background: color-mix(in srgb, var(--community-surface) 40%, transparent); } +.community-cities-section .community-section { padding-top: 52px; } +.community-city-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } +.community-city-card { border-radius: 14px; overflow: hidden; background: var(--community-surface); border: 1px solid var(--community-line); } +.community-city-image { aspect-ratio: 1.4; background-size: cover; background-position: center; position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding: 16px; color: #fff; background-color: #173636; } +.community-city-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, #06171ac4); } +.community-city-image > * { position: relative; z-index: 1; } +.community-city-image > span { font-size: 10px; } +.community-city-card > div:last-child { padding: 18px; } +.community-city-card h3 { font-size: 19px; font-weight: 500; margin: 0 0 9px; } +.community-city-card p { color: var(--community-muted); font-size: 10px; margin: 0; line-height: 1.8; } +.community-coffee-band { display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--community-line); padding-top: 28px; margin-top: 30px; } +.community-band-icon { color: var(--community-coral); display: grid; place-items: center; width: 50px; height: 55px; flex-shrink: 0; } +.community-coffee-band h3 { font-size: 17px; font-weight: 500; margin: 0 0 8px; } +.community-coffee-band p { font-size: 11px; color: var(--community-muted); line-height: 1.8; margin: 0; } +.community-coffee-band > a { margin-left: auto; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--community-line); background: transparent; color: var(--community-ink); } +.community-conversation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; } +.community-chat-feature { position: relative; border: 1px solid var(--community-line); background: var(--community-surface); border-radius: 18px; padding: 30px; overflow: hidden; } +.community-feature-mark { color: var(--community-mint); position: absolute; right: 28px; top: 26px; } +.community-chat-feature .community-kicker { font-size: 8px; } +.community-chat-feature h3 { font-size: 25px; font-weight: 500; max-width: 320px; line-height: 1.5; letter-spacing: -.035em; margin: 0 0 14px; } +.community-chat-feature > p:not(.community-kicker) { color: var(--community-muted); font-size: 12px; line-height: 1.9; max-width: 350px; } +.community-feature-link { display: flex; gap: 10px; align-items: center; color: var(--community-mint); font-size: 12px; margin-top: 24px; min-height: 44px; } +.community-chat-bubbles { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 24px; } +.community-chat-bubbles > span { padding: 10px 16px; border-radius: 12px 12px 12px 3px; background: var(--community-raised); color: var(--community-muted); font-size: 10px; } +.community-chat-bubbles > span:last-child { align-self: flex-end; border-radius: 12px 12px 3px 12px; background: color-mix(in srgb, var(--community-mint) 9%, transparent); color: var(--community-mint); } +.community-lounge-list { display: flex; flex-direction: column; justify-content: center; } +.community-lounge-list > a { display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--community-line); padding: 23px 0; } +.community-lounge-icon { display: grid; place-items: center; width: 48px; height: 55px; border-radius: 12px; background: var(--community-raised); color: var(--community-mint); flex-shrink: 0; } +.community-lounge-list > a > div { flex: 1; min-width: 0; } +.community-lounge-list small { font-size: 8px; color: var(--community-muted); letter-spacing: .08em; } +.community-lounge-list h3 { font-size: 16px; font-weight: 500; margin: 8px 0; } +.community-lounge-list > a p { color: var(--community-muted); font-size: 10px; margin: 0; } +.community-lounge-list > a > svg { color: var(--community-muted); flex-shrink: 0; } +.community-build-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } +.community-build-card { --build-color: var(--community-mint); display: flex; flex-direction: column; align-items: flex-start; padding: 28px; border: 1px solid var(--community-line); border-radius: 16px; background: var(--community-surface); transition: border-color .2s; } +.community-build-card.coral { --build-color: var(--community-coral); } +.community-build-card.amber { --build-color: var(--community-amber); } +.community-build-card:hover { border-color: var(--build-color); } +.community-build-card > svg:first-child { color: var(--build-color); margin-bottom: 25px; } +.community-build-card > span { font-size: 10px; color: var(--build-color); margin-bottom: 12px; } +.community-build-card h3 { font-size: 22px; font-weight: 500; line-height: 1.5; margin: 0 0 12px; letter-spacing: -.035em; } +.community-build-card p { color: var(--community-muted); font-size: 11px; line-height: 1.9; margin: 0 0 20px; } +.community-build-card > svg:last-child { color: var(--build-color); margin-top: auto; align-self: flex-end; } +.community-faq { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; padding-top: 90px; padding-bottom: 65px; } +.community-faq h2 { font-size: 28px; font-weight: 500; letter-spacing: -.04em; line-height: 1.5; margin: 0 0 24px; } +.community-faq details { border-bottom: 1px solid var(--community-line); } +.community-faq summary { display: flex; justify-content: space-between; gap: 20px; cursor: pointer; font-size: 13px; line-height: 1.75; padding: 20px 0; list-style: none; } +.community-faq summary::-webkit-details-marker { display: none; } +.community-faq summary > span { color: var(--community-mint); font-size: 19px; font-weight: 300; transition: rotate .2s; } +.community-faq details[open] summary > span { rotate: 45deg; } +.community-faq details p { font-size: 12px; line-height: 1.95; margin: 0 30px 20px 0; color: var(--community-muted); } +.community-invite { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 48px; border-radius: 20px; border: 1px solid var(--community-line); background: var(--community-surface); margin-top: 25px; margin-bottom: 65px; width: calc(100% - 56px); max-width: 1144px !important; } +.community-invite h2 { font-size: clamp(27px, 3.3vw, 38px); font-weight: 500; letter-spacing: -.04em; margin: 0 0 14px; } +.community-invite p { color: var(--community-muted); line-height: 1.9; font-size: 12px; max-width: 550px; margin: 0; } +.community-invite .community-kicker { margin-bottom: 18px; font-size: 9px; } +.community-invite > button { flex-shrink: 0; } +.community-invite-compass { position: absolute; right: 70px; top: -28px; z-index: -1; color: var(--community-mint); opacity: .08; rotate: 20deg; } +.social-command-search { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border: 1px solid var(--community-line); border-radius: 10px; color: var(--community-mint); background: var(--community-bg); } +.social-command-search input { width: 100%; min-height: 42px; background: transparent; color: var(--community-ink); border: 0; outline: none; font: inherit; font-size: 16px; min-width: 0; } +.social-command-results { margin-top: 12px; max-height: min(55dvh, 460px); overflow-y: auto; } +.social-command-results > a { display: flex; align-items: center; gap: 14px; min-height: 74px; padding: 12px 10px; border-radius: 10px; } +.social-command-results > a:hover, .social-command-results > a:focus-visible { background: var(--community-raised); } +.social-command-results > a > span:nth-child(2) { flex: 1; min-width: 0; } +.social-command-results strong { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; } +.social-command-results strong small { font-size: 9px; color: var(--community-muted); } +.social-command-results em { display: block; font-size: 11px; color: var(--community-muted); font-style: normal; line-height: 1.7; margin-top: 4px; } +.social-command-hint, .social-command-empty { font-size: 11px; color: var(--community-muted); text-align: center; padding-top: 15px; } +.social-skin .social-dialog-sheet { background: var(--community-surface); color: var(--community-ink); border-color: var(--community-line); } +.social-skin .social-dialog-sheet > header { background: var(--community-surface); color: var(--community-ink); border-bottom: 1px solid var(--community-line); } +.social-skin .social-dialog-sheet > header button { min-width: 44px; min-height: 44px; color: var(--community-muted); } +.social-skin .people-connection-card { background: var(--community-surface); border-color: var(--community-line); } +.social-skin .people-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } +.social-skin .people-toolbar { background: var(--community-surface); border: 1px solid var(--community-line); } +.social-skin .people-refinements { grid-template-columns: repeat(3, minmax(0, 1fr)); } +.people-card-example { font-size: 9px; color: var(--community-muted); font-weight: 400; margin-left: 8px; } +.social-skin .people-card-top { align-items: flex-start; } +.social-skin .people-card-top h2 { display: block; margin-top: 3px; } +.social-skin .people-card-bottom { gap: 10px; } +.people-card-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--community-mint); margin-top: 12px; } +.social-skin .people-connection-card .people-card-tags button { min-height: 36px; } +.social-skin .social-resource-kind-nav { display: flex; flex-wrap: wrap; gap: 8px; } +.social-skin .social-role-card, .social-skin .social-event-card, .social-skin .social-library-card { border-color: var(--community-line); } +.social-skin .social-role-card h2, .social-skin .social-library-card h2 { line-height: 1.5; } +.social-skin .social-inline-notice { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border: 1px solid var(--community-line); background: var(--community-surface); border-radius: 12px; font-size: 12px; line-height: 1.8; color: var(--community-muted); } +.community-person-top > img, .community-world-person > img, .community-mini-avatars img, .people-card-top > a > img { border-radius: 50%; object-fit: cover; } +.cf-host-search { display: flex; flex-direction: column; gap: 9px; font-size: 11px; color: var(--community-muted); margin: 24px 0; max-width: 520px; } +.cf-host-search input { background: var(--community-surface); color: var(--community-ink); border: 1px solid var(--community-line); border-radius: 10px; min-height: 48px; padding: 12px 16px; font-size: 16px; width: 100%; } +.community-skill-swap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin: 24px 0; } +.community-skill-swap small { color: var(--community-muted); font-size: 10px; } +.community-skill-swap :is(h2, h3) { font-size: 17px; font-weight: 500; line-height: 1.6; margin: 8px 0 0; } +.community-skill-swap > svg { color: var(--community-mint); } +.social-skin .social-skills-card { background: var(--community-surface); border: 1px solid var(--community-line); border-radius: 15px; } +.social-skin .social-inline-notice .social-save { margin-left: auto; flex-shrink: 0; } +.social-skin .sm-discover.is-h5 .sm-discover-topbar { display: flex; align-items: center; gap: 8px; padding: 0 14px; pointer-events: auto; } +.social-skin .sm-discover.is-h5 .sm-discover-search { min-width: 0; flex: 1; width: auto; } +.social-skin .sm-discover.is-h5 .sm-discover-search input { min-width: 0; font-size: 16px; } +.social-skin .sm-discover.is-h5 .sm-mode-switch { flex-shrink: 0; } +.social-skin .sm-discover.is-h5 .sm-mode-switch button { min-height: 44px; padding: 10px; } +@media (min-width: 901px) { + .social-skin .nav-group:last-child .nav-group-panel { left: auto; right: -130px; transform: none; } +} +@media (max-width: 1100px) and (min-width: 901px) { + .social-skin .nav-container { gap: 12px !important; } + .social-skin .nav-group-btn { padding-inline: 8px; } + .social-skin .social-nav-login { display: none; } + .community-hero-layout { gap: 40px; } +} +@media (max-width: 900px) { + .social-skin .container { padding-inline: 22px; } + .social-skin :is(.community-home, .social-workspace) .nav-container { height: 68px; padding-inline: 16px; gap: 8px; } + .social-skin .community-home .navbar, .social-skin .social-workspace .navbar { height: 68px; } + .social-skin .social-nav-login { display: none; } + .social-skin .nav-actions { margin-left: auto; } + .social-skin .social-language-toggle > span { display: none; } + .social-skin .nav-links.open { position: fixed; top: 68px; left: 0; right: 0; bottom: 0; width: 100%; max-height: calc(100dvh - 68px); overflow-y: auto; padding: 16px 20px calc(90px + env(safe-area-inset-bottom)); background: var(--community-bg); border: 0; border-radius: 0; display: flex; flex-direction: column; gap: 8px; } + .social-skin .nav-group { width: 100%; border-bottom: 1px solid var(--community-line); } + .social-skin .nav-group-btn { width: 100%; justify-content: space-between; min-height: 50px; font-size: 15px; padding-inline: 12px; } + .social-skin .nav-group-panel, .social-skin .nav-group:last-child .nav-group-panel { position: static; width: 100%; transform: none; background: transparent; border: 0; box-shadow: none; padding: 5px 0 12px; border-radius: 0; } + .social-skin .nav-group-panel::before { display: none; } + .social-skin .nav-panel-heading { display: none; } + .social-skin .nav-group:last-child .nav-panel-entries { grid-template-columns: 1fr; } + .social-skin .nav-panel-entries a { min-height: 76px; padding-inline: 10px; } + .social-skin .nav-entry-copy strong { font-size: 14px; } + .social-skin .nav-entry-copy small { font-size: 12px; } + .social-skin .nav-mobile-extras { display: flex; gap: 12px; margin-top: 15px; } + .social-skin .nav-mobile-extras .social-nav-login { display: inline-flex; } + .social-skin .social-workspace.social-workspace-dense .social-workspace-grid { padding-top: 88px; } + .social-skin .social-journey-nav { flex-direction: column; align-items: stretch; gap: 4px; margin-bottom: 24px; padding-bottom: 12px; } + .social-journey-links { width: 100%; margin-left: 0; } + .community-hero { padding-top: 118px; } + .community-hero-layout { gap: 36px; } + .community-hero h1 { font-size: clamp(35px, 4.8vw, 50px); } + .community-hero-lead { font-size: 12px; } + .community-world { min-height: 375px; } + .community-world-orbit.orbit-two { width: 275px; height: 275px; } + .community-world-person { padding: 9px; gap: 7px; } + .community-world-person.person-1 { right: -10px; } + .community-world-person.person-0 { left: -14px; } + .community-world-coffee { right: -5px; padding: 12px; max-width: 290px; } + .community-world-coffee strong { font-size: 10px; } + .community-people-grid, .community-city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .community-build-card { padding: 22px; } + .community-build-card h3 { font-size: 19px; } + .community-invite { margin-inline: 22px; width: calc(100% - 44px); padding: 30px !important; } + .community-home > .social-workspace-footer { margin-inline: 22px; padding-bottom: 100px; } + .community-faq { gap: 36px; } + .social-skin .people-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } +} +@media (max-width: 600px) { + .social-skin .container { padding-inline: 20px; } + .community-hero { padding-top: 112px; } + .community-hero-layout { grid-template-columns: 1fr; gap: 42px; } + .community-hero .community-kicker { font-size: 9px; margin-bottom: 21px; } + .community-hero h1 { font-size: clamp(37px, 10vw, 56px); line-height: 1.28; letter-spacing: -.06em; } + .community-hero-lead { font-size: 13px; margin-top: 22px; line-height: 1.9; } + .community-hero-search input { font-size: 16px; } + .community-hero-search input::placeholder { font-size: 11px; } + .community-hero-actions { gap: 20px; margin-top: 18px; } + .community-hero-note { font-size: 10px; margin-top: 25px; } + .community-world { min-height: 330px; margin-inline: 8px; } + .community-world-orbit { width: 200px; height: 200px; } + .community-world-orbit.orbit-two { width: 265px; height: 265px; } + .community-world-orbit.orbit-three { width: 125px; height: 125px; } + .community-world-person.person-0 { top: 23px; left: -14px; } + .community-world-person.person-1 { top: 90px; right: -14px; } + .community-world-person.person-2 { top: 170px; left: -8px; } + .community-world-person > .social-avatar { width: 36px !important; height: 36px !important; } + .community-world-center > svg { width: 60px; height: 60px; } + .community-world-coffee { bottom: 47px; right: -8px; padding: 12px; } + .community-world-caption { left: 12px; right: 12px; font-size: 7px; } + .community-hero-foot { margin-top: 26px; padding-top: 12px; padding-bottom: 10px; } + .community-hero-foot > span { display: none; } + .social-skin .community-home .social-intent-guide { margin-top: 24px; } + .social-skin .community-home .intent-options { gap: 8px; } + .social-skin .community-home .intent-options button { font-size: 11px; min-height: 48px; gap: 7px; } + .social-skin .community-home .intent-panel { display: flex; flex-direction: column; align-items: stretch; padding: 21px; gap: 14px; } + .social-skin .community-home .intent-art { display: none; } + .social-skin .community-home .intent-panel-actions { display: flex; flex-direction: column; align-items: stretch; gap: 3px; } + .social-skin .community-home .intent-panel-actions > a { justify-content: center; } + .community-section { padding-top: 50px; } + .community-section-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 20px; } + .community-section-head h2 { font-size: 26px; margin-bottom: 13px; } + .community-section-head > div > p:last-child { font-size: 12px; } + .community-section-head > a { font-size: 11px; } + .community-city-filters { gap: 6px; } + .community-city-filters button { padding-inline: 12px; font-size: 10px; } + .community-people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .community-person-card { padding: 15px; border-radius: 12px; } + .community-person-top > .social-avatar { width: 44px !important; height: 44px !important; } + .community-follow { width: 44px; height: 44px; } + .community-person-card h3 { font-size: 17px; } + .community-person-title { line-height: 1.7; font-size: 10px; min-height: 34px; } + .community-person-want { font-size: 11px; min-height: 57px; } + .community-person-city { font-size: 9px; line-height: 1.6; } + .community-person-tags > span { font-size: 8px; padding-inline: 6px; } + .community-data-note { font-size: 9px; } + .community-cities-section { margin-top: 25px; padding-bottom: 14px; } + .community-cities-section .community-section { padding-top: 38px; } + .community-city-grid { gap: 10px; } + .community-city-image { aspect-ratio: 1.1; padding: 12px; } + .community-city-card > div:last-child { padding: 14px; } + .community-city-card h3 { font-size: 18px; } + .community-city-card p { font-size: 10px; } + .community-coffee-band { flex-wrap: wrap; gap: 15px; padding-top: 22px; } + .community-band-icon { display: none; } + .community-coffee-band h3 { font-size: 18px; line-height: 1.6; } + .community-coffee-band > a { margin-left: 0; width: 100%; } + .community-conversation-grid { grid-template-columns: 1fr; gap: 8px; } + .community-chat-feature { padding: 25px; } + .community-chat-feature h3 { font-size: 24px; } + .community-lounge-list > a { gap: 14px; padding: 20px 0; } + .community-lounge-list h3 { font-size: 15px; } + .community-build-grid { grid-template-columns: 1fr; gap: 12px; } + .community-build-card { position: relative; padding: 23px 25px 23px 76px; } + .community-build-card > svg:first-child { position: absolute; top: 26px; left: 24px; } + .community-build-card h3 { font-size: 20px; } + .community-build-card p { margin-bottom: 12px; } + .community-build-card > span { font-size: 10px; } + .community-build-card > svg:last-child { position: absolute; bottom: 22px; right: 20px; width: 16px; } + .community-faq { grid-template-columns: 1fr; gap: 14px; padding-top: 52px; padding-bottom: 25px; } + .community-faq h2 { font-size: 25px; margin-bottom: 10px; } + .community-faq .community-kicker { font-size: 8px; margin-bottom: 14px; } + .community-faq summary { font-size: 12px; } + .community-invite { flex-direction: column; align-items: flex-start; margin: 26px 20px 40px; width: calc(100% - 40px); padding: 28px 24px !important; } + .community-invite h2 { font-size: 28px; line-height: 1.5; } + .community-invite > button { width: 100%; } + .social-skin .people-card-grid { grid-template-columns: 1fr; } + .social-skin .people-refinements { grid-template-columns: 1fr; } + .social-skin .social-search-trigger, .social-skin .social-theme-toggle, .social-skin .social-language-toggle { min-width: 32px; } + .social-skin .social-brand-logo { gap: 6px; } + .social-skin .social-brand-word { font-size: 15px; } + .social-skin .social-workspace-footer { margin-top: 30px; } + .social-skin .social-workspace-footer > div { gap: 0 16px; } +} +@media (prefers-reduced-motion: no-preference) and (hover: hover) { + .community-world-center > svg { animation: community-breathe 7s ease-in-out infinite; } + @keyframes community-breathe { 50% { opacity: .55; transform: scale(.96); } } +} +@media (prefers-reduced-motion: reduce) { + .social-skin *, .social-skin *::before, .social-skin *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } +} + +/* Profiles use the same information hierarchy at every screen size. */ +.community-map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; } +.community-map-toolbar .social-search { flex: 1; max-width: 520px; } +.community-map-modes { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--community-line); border-radius: 11px; background: var(--community-surface); } +.community-map-modes button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--community-muted); cursor: pointer; font-size: 12px; } +.community-map-modes button[aria-pressed="true"] { color: var(--community-mint); background: var(--community-raised); } +.community-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; border: 1px solid var(--community-line); border-radius: 18px; overflow: hidden; } +.community-map-stage { position: relative; min-width: 0; height: 580px; overflow: hidden; background: var(--community-surface); } +.social-skin .community-map-stage :is(.social-map-canvas-wrap, .social-map-canvas, .sm-globe, .sm-globe--skeleton, .social-map-canvas--skeleton) { height: 100%; min-height: 0; } +.community-map-directory { height: 580px; overflow-y: auto; background: var(--community-surface); border-left: 1px solid var(--community-line); padding: 16px; } +.community-map-directory-head { padding: 10px 4px 18px; border-bottom: 1px solid var(--community-line); margin-bottom: 10px; } +.community-map-directory-head h2 { margin: 0 0 8px; font-size: 17px; } +.community-map-directory-head > span { color: var(--community-muted); font-size: 12px; } +.community-map-directory > button { display: flex; align-items: center; text-align: left; gap: 12px; width: 100%; min-height: 72px; padding: 12px; margin-bottom: 4px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--community-ink); cursor: pointer; } +.community-map-directory > button:hover, .community-map-directory > button[aria-pressed="true"] { background: var(--community-raised); border-color: var(--community-line); } +.community-map-city-emoji { font-size: 24px; } +.community-map-directory > button > span:nth-child(2) { flex: 1; } +.community-map-directory strong { display: block; font-size: 14px; margin-bottom: 5px; } +.community-map-directory small { font-size: 12px; color: var(--community-muted); } +.community-map-directory > button > svg { color: var(--community-mint); } +.community-map-selection { position: absolute; z-index: 40; bottom: 20px; left: 20px; right: 20px; display: flex; align-items: center; gap: 13px; padding: 18px; background: var(--community-surface); color: var(--community-ink); border: 1px solid var(--community-line); border-radius: 14px; box-shadow: 0 12px 36px #0003; } +.community-map-selection > button { position: absolute; right: 6px; top: -48px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--community-line); border-radius: 50%; background: var(--community-surface); color: var(--community-ink); cursor: pointer; } +.community-map-selection > span { font-size: 28px; } +.community-map-selection h2 { font-size: 19px; margin: 0 0 6px; } +.community-map-selection p { font-size: 12px; color: var(--community-muted); margin: 0; } +.community-map-selection > a { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--community-mint); font-size: 13px; min-height: 44px; } +@media (max-width: 800px) { + .community-map-layout { grid-template-columns: 1fr; } + .community-map-stage { height: 430px; } + .community-map-directory { height: 320px; border-left: 0; border-top: 1px solid var(--community-line); } + .community-map-toolbar { flex-wrap: wrap; } + .community-map-toolbar .social-search { flex-basis: 100%; max-width: none; } +} +.social-skin .people-card-top { display: flex; gap: 13px; margin-bottom: 18px; } +.social-skin .people-card-top > a { flex-shrink: 0; } +.social-skin .people-card-top > div { flex: 1; min-width: 0; } +.social-skin .people-card-top h2 { margin: 2px 0 7px; font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; } +.social-skin .people-card-top p { margin: 0 0 8px; font-size: 13px; color: var(--community-muted); } +.social-skin .people-card-top > div > span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--community-muted); } +.social-skin .people-follow-button { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--community-line); border-radius: 50%; background: transparent; color: var(--community-muted); cursor: pointer; } +.social-skin .people-follow-button[aria-pressed="true"] { color: var(--community-mint); background: color-mix(in srgb, var(--community-mint) 12%, transparent); border-color: var(--community-mint); } +.social-skin .people-card-bio { font-size: 14px; line-height: 1.85; color: var(--community-ink); margin: 0 0 14px; overflow-wrap: anywhere; } +.social-skin .people-card-looking { display: flex; align-items: baseline; gap: 7px; color: var(--community-muted); margin: 0 0 18px; font-size: 13px; } +.social-skin .people-card-looking svg { flex-shrink: 0; } +.social-skin .people-card-bottom { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--community-line); margin-top: 20px; padding-top: 14px; font-size: 11px; color: var(--community-muted); } +.social-skin .people-card-bottom > a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--community-mint); font-size: 12px; } +.social-skin .people-sort { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--community-muted); } +.social-skin .people-sort select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--community-line); border-radius: 9px; background: var(--community-surface); color: var(--community-ink); font: inherit; } +.social-skin .people-results-bar > p { font-size: 13px; } +.social-skin .people-card-example { display: inline-block; border: 1px solid var(--community-line); border-radius: 4px; padding: 1px 4px; vertical-align: middle; font-size: 10px; line-height: 1.5; } +.social-skin .social-skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; } +.social-skin .social-skills-card { padding: 24px; } +.social-skin .social-skills-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; } +.social-skin .social-skills-card header > span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--community-muted); } +.social-skin .social-fieldset { display: grid; gap: 18px; padding: 0; margin: 0; border: 0; min-width: 0; } +.social-skin .community-section-head > div > p:last-child, .social-skin .community-person-want { font-size: 14px; } +.social-skin .community-person-title, .social-skin .community-person-city, .social-skin .community-person-link { font-size: 12px; } +.social-skin .community-data-note { font-size: 12px; } +.social-skin .nav-entry-copy small { font-size: 12px; } +.social-skin .community-person-tags > span { font-size: 11px; } +@media (max-width: 600px) { + .social-skin .social-skills-grid { grid-template-columns: 1fr; } + .social-skin .people-card-top { gap: 10px; } + .social-skin .people-card-top h2 { font-size: 17px; } + .social-skin .community-person-want { font-size: 13px; } + .social-skin .community-person-title { font-size: 11px; } + .social-skin .people-card-tags button { min-height: 44px; } +} diff --git a/src/modules/social/components/DateClient.tsx b/src/modules/social/components/DateClient.tsx index b6e717d..55932ac 100644 --- a/src/modules/social/components/DateClient.tsx +++ b/src/modules/social/components/DateClient.tsx @@ -633,7 +633,7 @@ function DateCardFace({ member }: { member: SocialRosterMember }) { /> ) : null} - {member.online ? ( + {member.online && !member.example ? ( {socialTx("现在在线")} ) : null}
@@ -642,7 +642,7 @@ function DateCardFace({ member }: { member: SocialRosterMember }) { {member.gender === "f" ? "👩" : member.gender === "m" ? "👨" : "🙂"} {" "} - {member.name} + {member.name}{member.example && {socialTx("示例", "Example")}}

{member.gender === "f" diff --git a/src/modules/social/components/EventDirectory.tsx b/src/modules/social/components/EventDirectory.tsx index c975b63..f558f33 100644 --- a/src/modules/social/components/EventDirectory.tsx +++ b/src/modules/social/components/EventDirectory.tsx @@ -27,9 +27,11 @@ import { resolveSocialCatalog } from "@social/lib/resolveCatalog"; import { useSocialConfig } from "./SocialExperience"; import { useAudienceRoster } from "@social/lib/useAudienceRoster"; import { socialTx } from "@social/lib/socialTx"; +import { useSocialI18n } from "@social/lib/useSocialI18n"; export default function EventDirectory() { const config = useSocialConfig(); + const { tx } = useSocialI18n(); const roster = useAudienceRoster(); const catalog = useMemo( () => resolveSocialCatalog(config.copy.socialCatalogs), @@ -53,7 +55,7 @@ export default function EventDirectory() {

- {socialTx("点进场次即开麦开摄像头,比只打字更近一点。")} + {tx("先选一个感兴趣的话题,进入后再决定怎样参与。", "Pick a conversation that interests you, then choose how you’d like to join.")}

- {event.mode === "hybrid" ? "可线下" : "语音厅"} + {event.mode === "hybrid" ? tx("可线下", "Hybrid") : event.mode === "offline" ? tx("线下见面", "In person") : tx("语音厅", "Voice lounge")}
@@ -135,13 +137,13 @@ export default function EventDirectory() { /> ))}
-

{event.title}

+

{tx(event.title)}

- {scheduled ? `${event.date} · ${event.time} ${zone === "Asia/Shanghai" ? "北京时间" : zone}` : "时间待确认"} + {scheduled ? `${event.date} · ${event.time} ${zone === "Asia/Shanghai" ? tx("北京时间", "China time") : zone}` : tx("时间待确认", "Schedule to follow")}

- {scheduled ? `你那边大约是:${start.toLocaleString([], { + {scheduled ? `${tx("你那边大约是:", "Your time: ")}${start.toLocaleString([], { month: "short", day: "numeric", hour: "2-digit", diff --git a/src/modules/social/components/HomeActionRail.tsx b/src/modules/social/components/HomeActionRail.tsx index 7a22d52..89fdc36 100644 --- a/src/modules/social/components/HomeActionRail.tsx +++ b/src/modules/social/components/HomeActionRail.tsx @@ -6,6 +6,7 @@ import { ArrowUpRight, Coffee, Compass, Heart, Users } from "lucide-react"; import { socialPath } from "@social/lib/socialPath"; import { useSocialI18n } from "@social/lib/useSocialI18n"; import { useSocialConfig } from "./SocialExperience"; +import { navigationVisible } from "@social/lib/experience"; export default function HomeActionRail() { const { tx } = useSocialI18n(); @@ -31,7 +32,9 @@ export default function HomeActionRail() { description: tx("从技能互助到远程协作,找到可以一起行动的人和机会。", "From skill exchanges to remote collaboration, discover people and opportunities to build with."), href: "/skills", cta: tx("探索技能互助", "Explore skill exchanges"), secondary: "/team", secondaryLabel: tx("看看共创机会", "Find collaborators"), step: tx("发现技能 → 交流想法 → 一起行动", "Discover skills → Exchange ideas → Build together") }, ]; - const selected = journeys.find(journey => journey.id === intent) || journeys[0]; + const available = journeys.filter(journey => navigationVisible(config, journey.href)); + const selected = available.find(journey => journey.id === intent) || available[0]; + if (!selected) return null; const selectedCopy = config.copy.socialPages?.[`discovery-${selected.id}`]; const Icon = selected.icon; return ( @@ -40,7 +43,7 @@ export default function HomeActionRail() {

{copy?.title || tx("今天,想从哪里开始?", "Where would you like to start?")}

- {journeys.map(journey => { const Mark = journey.icon; return ; })} + {available.map(journey => { const Mark = journey.icon; return ; })}
diff --git a/src/modules/social/components/HomeClient.tsx b/src/modules/social/components/HomeClient.tsx index a1b709e..578e18a 100644 --- a/src/modules/social/components/HomeClient.tsx +++ b/src/modules/social/components/HomeClient.tsx @@ -1,707 +1,112 @@ "use client"; -import { - useEffect, - useMemo, - useState, - useSyncExternalStore, - type PointerEvent, -} from "react"; +import { useMemo, useState } from "react"; import Link from "next/link"; +import { useRouter } from "next/navigation"; +import { ArrowDown, ArrowRight, ArrowUpRight, BookOpen, Check, Coffee, Compass, Globe2, HeartHandshake, MapPin, MessageCircle, Radio, Search, Sparkles, Users, Waves } from "lucide-react"; import SiteShell from "./SiteShell"; -import AttractiveRoster from "./AttractiveRoster"; -import ConnectionHero, { ConnectionWays } from "./ConnectionHero"; -import { useHomeLivenessGate } from "./HomeStatusStrip"; -import { openSocialJoinModal } from "@social/lib/joinModal"; -import FxBelt from "./FxBelt"; -import SectionSpark from "./SectionSpark"; -import CityDirectory from "./CityDirectory"; -import HomeCoffeeEntry from "./HomeCoffeeEntry"; -import SocialBrandLogo from "./SocialBrandLogo"; import SocialAvatar from "./SocialAvatar"; -import { - ArrowUpRight, - BookOpen, - Heart, - Radio, - Sparkles, -} from "lucide-react"; -import { TEAM_KIND_LABEL, SEED_EBOOKS, SEED_VIDEOS } from "@social/lib/seed"; -import { resolveSocialCatalog } from "@social/lib/resolveCatalog"; -import { socialPath } from "@social/lib/socialPath"; -import { resolveSocialLandingCopy } from "@social/lib/landing"; +import HomeActionRail from "./HomeActionRail"; +import { SocialFooter } from "./SocialNavigation"; +import { useSocialConfig } from "./SocialExperience"; import { useSocialI18n } from "@social/lib/useSocialI18n"; import { useDiscoveryRoster } from "@social/lib/discoveryRoster"; -import { useSocialConfig } from "./SocialExperience"; -import { socialTx } from "@social/lib/socialTx"; -import { - getSocialSession, - subscribeSocialSession, -} from "@social/lib/socialSession"; -import { - DEFAULT_X_HANDLE, - formatXHandle, - xProfileUrl, -} from "~/components/social-follow"; -import { trackFollow } from "~/lib/analytics/track"; -import { useAudienceModule } from "~/modules/audience"; - -const DEFAULT_PROMO = - "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4"; - -const ROLE_EMOJI: Record = { - volunteer: "🙋", - parttime: "📝", - fulltime: "💼", -}; +import { resolveSocialCatalog } from "@social/lib/resolveCatalog"; +import { resolveSocialLandingCopy } from "@social/lib/landing"; +import { experiencePage, homeSectionVisible, navigationVisible, safeCommunityHref } from "@social/lib/experience"; +import { SOCIAL_CITIES } from "@social/lib/cities"; +import { socialPath } from "@social/lib/socialPath"; +import { openSocialJoinModal } from "@social/lib/joinModal"; +import { setRosterLike, useRosterLikes } from "@social/lib/useRosterLikes"; export default function HomeClient() { const config = useSocialConfig(); - const { locale, t } = useSocialI18n(); - const { followChannel } = useAudienceModule(); - const showXFollow = followChannel === "x"; + const { t, tx, locale } = useSocialI18n(); + const router = useRouter(); const roster = useDiscoveryRoster(); - // Dating strip: same face gate as /date — no face → never preview - const datingRoster = useDiscoveryRoster({ requireFace: true }); - const { liveOk } = useHomeLivenessGate(); - const [activeSection, setActiveSection] = useState("people"); + const likes = useRosterLikes(); + const [query, setQuery] = useState(""); + const [city, setCity] = useState(""); + const landing = resolveSocialLandingCopy(config.copy, locale); + const copy = experiencePage(config, locale, "home"); + const catalog = useMemo(() => resolveSocialCatalog(config.copy.socialCatalogs), [config.copy.socialCatalogs]); + const announcement = config.copy.socialExperience?.announcement; + const announceText = announcement?.[locale]; + const visible = (key: string) => homeSectionVisible(config, key); + const cities = useMemo(() => { + const ids = config.copy.socialExperience?.featuredCityIds; + return (ids?.length ? ids.map(id => SOCIAL_CITIES.find(c => c.id === id)).filter(c => c != null) : SOCIAL_CITIES.filter(c => ["chiangmai", "dali", "bali", "lisbon"].includes(c.id))).slice(0, 4); + }, [config.copy.socialExperience?.featuredCityIds]); + const people = roster.filter(p => !city || p.city.includes(city)).slice(0, 4); const openJoin = () => openSocialJoinModal({ reason: "cta" }); - const sessionSnap = useSyncExternalStore( - subscribeSocialSession, - () => JSON.stringify(getSocialSession()), - () => "null", - ); - const loggedIn = Boolean( - (JSON.parse(sessionSnap) as ReturnType)?.email, - ); - const promoUrl = - config.copy.socialPromoUrl?.trim() || - ( - config.modules?.social as { promoVideoUrl?: string } | undefined - )?.promoVideoUrl?.trim() || - DEFAULT_PROMO; - const landingCopy = resolveSocialLandingCopy(config.copy, locale); - const PATH = t.homePath; - const catalog = useMemo( - () => resolveSocialCatalog(config.copy.socialCatalogs), - [config.copy.socialCatalogs], - ); - const meetups = catalog.meetups; - const gigs = catalog.gigs; - // Face-ok only; soft bias women for cover strip - const datePreview = useMemo(() => { - const pool = datingRoster.filter( - (m) => m.faceOk === true && Boolean((m.avatar || "").trim()), - ); - const women = pool.filter((m) => m.gender === "f"); - const rest = pool.filter((m) => m.gender !== "f"); - return [...women, ...rest].slice(0, 3); - }, [datingRoster]); + const sectionHead = (number: string, eyebrow: string, title: string, description: string, href: string, label: string) =>

{number}{eyebrow}

{title}

{description}

{label}
; - useEffect(() => { - const root = document.querySelector(".social-home"); - if (!root) return; - const reveal = new IntersectionObserver( - (entries) => - entries.forEach((e) => { - if (e.isIntersecting) { - e.target.classList.add("visible"); - reveal.unobserve(e.target); - } - }), - { threshold: 0.06, rootMargin: "0px 0px -24px 0px" }, - ); - const scan = () => { - root - .querySelectorAll(".reveal:not(.visible)") - .forEach((el) => reveal.observe(el)); - }; - scan(); - root.setAttribute("data-home-motion", "ready"); - const t = window.setTimeout(scan, 400); - - const observer = new IntersectionObserver( - (entries) => { - entries.forEach((entry) => { - if (entry.isIntersecting) setActiveSection(entry.target.id); - }); - }, - { rootMargin: "-25% 0px -55% 0px", threshold: 0 }, - ); - root - .querySelectorAll("section[id]:not(#hero)") - .forEach((section) => observer.observe(section)); - return () => { - window.clearTimeout(t); - reveal.disconnect(); - observer.disconnect(); - root.removeAttribute("data-home-motion"); - }; - }, []); - - const onPanelPointerMove = (event: PointerEvent) => { - if (event.pointerType !== "mouse") return; - const panel = (event.target as Element).closest( - ".social-panel", - ); - if (!panel) return; - const rect = panel.getBoundingClientRect(); - panel.style.setProperty("--spot-x", `${event.clientX - rect.left}px`); - panel.style.setProperty("--spot-y", `${event.clientY - rect.top}px`); - }; - - return ( -
; } diff --git a/src/modules/social/components/MapClient.tsx b/src/modules/social/components/MapClient.tsx index 0087ee1..ac4da61 100644 --- a/src/modules/social/components/MapClient.tsx +++ b/src/modules/social/components/MapClient.tsx @@ -1,511 +1,71 @@ -"use client"; +"use client"; -import { - Suspense, - useEffect, - useMemo, - useState, - useSyncExternalStore, -} from "react"; +import { Suspense, useEffect, useMemo, useState } from "react"; import dynamic from "next/dynamic"; import Link from "next/link"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { - ArrowUpRight, - Box, - Map as MapIcon, - MapPin, - Radio, - Search, - Users, - X, -} from "lucide-react"; +import { ArrowUpRight, Box, Map as MapIcon, MapPin, X } from "lucide-react"; import SiteShell from "./SiteShell"; -import SocialAvatar from "./SocialAvatar"; +import { EmptyState, PageIntro, SearchField } from "./SocialUI"; +import { useSocialConfig } from "./SocialExperience"; import { socialApi } from "@social/lib/api"; import { SOCIAL_CITIES } from "@social/lib/cities"; import type { SocialMapCity } from "@social/lib/geoTypes"; -import { buildMapPersonPins, type MapPersonPin } from "@social/lib/mapPins"; +import { buildMapPersonPins } from "@social/lib/mapPins"; import { socialPath } from "@social/lib/socialPath"; -import { socialTx } from "@social/lib/socialTx"; -import { getSocialLive } from "@social/lib/socialLive"; import { useDiscoveryRoster } from "@social/lib/discoveryRoster"; -import { useSocialConfig } from "./SocialExperience"; - -const SocialMapCanvas = dynamic(() => import("./SocialMapCanvas"), { - ssr: false, - loading: () =>
, -}); -const SocialGlobe3D = dynamic(() => import("./SocialGlobe3D"), { - ssr: false, - loading: () =>
, -}); +import { useSocialI18n } from "@social/lib/useSocialI18n"; +import { getSocialLive } from "@social/lib/socialLive"; +const SocialMapCanvas = dynamic(() => import("./SocialMapCanvas"), { ssr: false, loading: () =>
Loading map…
}); +const SocialGlobe3D = dynamic(() => import("./SocialGlobe3D"), { ssr: false, loading: () =>
Loading globe…
}); type Mode = "globe" | "flat"; - -const H5_MQ = "(max-width: 959px)"; - -function useIsH5(): boolean { - return useSyncExternalStore( - (onChange) => { - if (typeof window === "undefined") return () => {}; - const mq = window.matchMedia(H5_MQ); - mq.addEventListener("change", onChange); - return () => mq.removeEventListener("change", onChange); - }, - () => - typeof window !== "undefined" ? window.matchMedia(H5_MQ).matches : false, - () => false, - ); -} - -function seedCities(): SocialMapCity[] { - return SOCIAL_CITIES.map((c) => ({ - id: c.id, - name: c.name, - country: c.country, - emoji: c.emoji, - vibe: c.vibe, - lat: c.lat, - lng: c.lng, - memberCount: c.members, - meetupCount: c.meetupCount || 0, - hot: c.hot, - tags: c.tags, - costHint: c.costHint, - })); -} +const seedCities = (): SocialMapCity[] => SOCIAL_CITIES.map(city => ({ ...city, memberCount: city.members, meetupCount: city.meetupCount || 0 })); function MapClientInner() { const params = useSearchParams(); const router = useRouter(); const pathname = usePathname(); - const isH5 = useIsH5(); + const { tx } = useSocialI18n(); const config = useSocialConfig(); - const cityParam = params.get("city"); - const modeParam = params.get("mode") === "globe" ? "globe" : "flat"; - const [mode, setMode] = useState(modeParam); - // H5:强制沉浸立体,不要平面 / 城市目录 - const effectiveMode: Mode = isH5 ? "globe" : mode; - - const switchMode = (next: Mode) => { - if (isH5) return; - setMode(next); - const sp = new URLSearchParams(params.toString()); - if (next === "globe") sp.set("mode", "globe"); - else sp.delete("mode"); - const q = sp.toString(); - router.replace(q ? `${pathname}?${q}` : pathname, { scroll: false }); - }; - + const mode: Mode = params.get("mode") === "globe" ? "globe" : "flat"; + const selectedId = params.get("city"); const [cities, setCities] = useState(seedCities); - const [selectedId, setSelectedId] = useState(cityParam); - const [selectedPersonId, setSelectedPersonId] = useState(null); - const [offline, setOffline] = useState(false); + const [example, setExample] = useState(true); const [query, setQuery] = useState(""); - const live = getSocialLive(config); - // mapLivePins on → discovery auto-refresh feeds live pins; off → seed only + const [offline, setOffline] = useState(false); const discovery = useDiscoveryRoster(); - const people = useMemo( - () => - buildMapPersonPins( - live.mapLivePins && discovery.length ? discovery : undefined, - ), - [live.mapLivePins, discovery], - ); - - useEffect(() => { - if (cityParam) setSelectedId(cityParam); - }, [cityParam]); - - useEffect(() => { - if (!isH5) return; - // 清掉 URL 里的 mode=flat,避免刷新又切平面 - if (params.get("mode") && params.get("mode") !== "globe") { - const sp = new URLSearchParams(params.toString()); - sp.delete("mode"); - const q = sp.toString(); - router.replace(q ? `${pathname}?${q}` : pathname, { scroll: false }); - } - }, [isH5, params, pathname, router]); - + const live = getSocialLive(config); + const people = useMemo(() => buildMapPersonPins(live.mapLivePins && discovery.length ? discovery : undefined), [live.mapLivePins, discovery]); + const update = (key: string, value: string) => { + const next = new URLSearchParams(params.toString()); + if (value) next.set(key, value); else next.delete(key); + router.replace(`${pathname}${next.size ? `?${next}` : ""}`, { scroll: false }); + }; useEffect(() => { let alive = true; - void socialApi - .mapCities() - .then((res) => { - if (!alive || !res.items?.length) return; - setCities(res.items); - setOffline(false); - }) - .catch(() => { - if (alive) setOffline(true); - }); - return () => { - alive = false; - }; + void socialApi.mapCities().then(response => { + if (!alive) return; + const valid = response.items?.filter(city => typeof city.id === "string" && typeof city.name === "string" && Number.isFinite(city.lng) && Number.isFinite(city.lat)); + if (valid?.length) { setCities(valid); setExample(false); } + }).catch(() => { if (alive) setOffline(true); }); + return () => { alive = false; }; }, []); - - const selected = useMemo( - () => cities.find((c) => c.id === selectedId) || null, - [cities, selectedId], - ); - const selectedPerson = useMemo( - () => people.find((p) => p.id === selectedPersonId) || null, - [people, selectedPersonId], - ); - const cityPeople = useMemo(() => { - if (!selectedId) return people.slice(0, 8); - return people.filter((p) => p.cityId === selectedId); - }, [people, selectedId]); - - const filteredCities = useMemo(() => { + const selected = cities.find(city => city.id === selectedId); + const filtered = useMemo(() => { const q = query.trim().toLowerCase(); - const sorted = [...cities].sort((a, b) => b.memberCount - a.memberCount); - if (!q) return sorted.slice(0, 8); - return sorted - .filter((c) => - `${c.name} ${c.country} ${c.vibe || ""}`.toLowerCase().includes(q), - ) - .slice(0, 8); - }, [cities, query]); + return [...cities].filter(city => !q || `${city.name} ${tx(city.name)} ${city.country} ${tx(city.country)} ${city.id} ${city.vibe}`.toLowerCase().includes(q)).sort((a, b) => b.memberCount - a.memberCount); + }, [cities, query, tx]); + const mapProps = { cities, people, selectedId, onSelectCity: (city: SocialMapCity) => update("city", city.id) }; - const onSelectPerson = (pin: MapPersonPin) => { - setSelectedPersonId(pin.id); - setSelectedId(pin.cityId); - }; - - const showRail = !isH5; - - return ( - -
-
- {effectiveMode === "globe" ? ( - { - setSelectedId(c.id); - setSelectedPersonId(null); - }} - onSelectPerson={onSelectPerson} - /> - ) : ( - { - setSelectedId(c.id); - setSelectedPersonId(null); - }} - onSelectPerson={onSelectPerson} - /> - )} - -
- {effectiveMode === "flat" && !isH5 ? ( -
-

- {offline ? "离线种子 · 模糊位置" : "同频游民 · 全球发现"} -

-

- NomadroMap -

-

深色底图 · 点脉冲飞到城市

-
- ) : null} - -
- {isH5 ? null : effectiveMode === "flat" ? ( - - ) : ( -

- NomadroGlobe -

- )} - {!isH5 ? ( -
- - -
- ) : null} -
-
- - {/* H5:点中城市时浮层卡片,不占目录底栏 */} - {isH5 && (selected || selectedPerson) ? ( -
- {selectedPerson ? ( -
- -
- -
-

{selectedPerson.name}

-

{selectedPerson.title}

-
-
-
- - 看看介绍 - -
-
- ) : selected ? ( -
- -

- {selected.emoji} {selected.name} - {selected.country} -

-
- - 想见的人 - - - 详情 - -
-
- ) : null} -
- ) : null} -
- - {showRail ? ( - - ) : null} -
-
- ); + return + {tx("城市目录", "City guide")} +
+
{mode === "globe" ? update("city", pin.cityId)} /> : router.push(socialPath(`/people/${pin.id}`))} />} + {selected &&
{selected.emoji}

{tx(selected.name)}

{tx(selected.country)}

{tx("探索", "Explore")}
} +
+

{offline ? tx("底图或城市数据暂不可用,目录使用内置内容,仍可继续探索。", "Some map services are unavailable. The built-in city guide remains available.") : example ? tx("当前展示城市与成员示例。", "Showing example cities and member locations.") : tx("成员位置以城市为单位呈现。", "Member locations are shown at city level.")} {tx("不展示精确 GPS,也不以在线状态推断行程。", "Exact GPS is never displayed. Online presence does not imply a travel plan.")}

+
; } -export default function MapClient() { - return ( - 加载地图…
}> - - - ); -} +export default function MapClient() { return Loading map…
}>; } diff --git a/src/modules/social/components/PeopleClient.tsx b/src/modules/social/components/PeopleClient.tsx index e3ed31e..1ee0eb8 100644 --- a/src/modules/social/components/PeopleClient.tsx +++ b/src/modules/social/components/PeopleClient.tsx @@ -1,285 +1,97 @@ "use client"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import Link from "next/link"; import { useSearchParams } from "next/navigation"; -import { Sparkles } from "lucide-react"; +import { ArrowUpRight, Check, MapPin, SlidersHorizontal, Sparkles, Users, X } from "lucide-react"; import SiteShell from "./SiteShell"; import SocialAvatar from "./SocialAvatar"; -import { - DemoBadge, - EmptyState, - PageIntro, - SearchField, - ResultSummary, -} from "./SocialUI"; -import { SELF_MEMBER_ID, useDiscoveryRoster } from "@social/lib/discoveryRoster"; -import { SOCIAL_CITIES } from "@social/lib/cities"; +import { EmptyState, PageIntro, SearchField } from "./SocialUI"; +import { useDiscoveryRoster } from "@social/lib/discoveryRoster"; import { socialPath } from "@social/lib/socialPath"; -import { useRosterLikes } from "@social/lib/useRosterLikes"; -import { socialTx } from "@social/lib/socialTx"; +import { setRosterLike, useRosterLikes } from "@social/lib/useRosterLikes"; +import { useSocialI18n } from "@social/lib/useSocialI18n"; -const PROFESSION_HINTS = ["设计", "开发", "内容", "产品", "摄影", "全栈"]; -const INTEREST_HINTS = ["咖啡局", "冲浪", "瑜伽", "夜跑", "出海", "开源"]; -const LANG_HINTS = ["中文", "English", "日本語", "Português"]; +type Filters = { q: string; city: string; interest: string; language: string; status: string; view: string; sort: string }; +const EMPTY: Filters = { q: "", city: "", interest: "", language: "", status: "", view: "all", sort: "recommended" }; +const isHere = (status?: string) => ["here", "currently_here", "in_city"].includes(status || ""); +const isSoon = (status?: string) => ["arriving", "soon", "arriving_soon"].includes(status || ""); +function readFilters(search: URLSearchParams): Filters { + return { + q: search.get("q") || "", city: search.get("city") || "", interest: search.get("interest") || "", language: search.get("language") || "", + status: search.get("status") || (search.get("here") === "1" ? "here" : search.get("soon") === "1" ? "soon" : ""), + view: search.get("view") === "saved" || search.get("view") === "online" ? search.get("view")! : "all", + sort: ["name", "online"].includes(search.get("sort") || "") ? search.get("sort")! : "recommended", + }; +} export default function PeopleClient() { const params = useSearchParams(); - const initialQuery = params.get("city") || ""; - const initialHere = params.get("here") === "1"; - const initialSoon = params.get("soon") === "1"; - return ( - - ); -} - -function PeopleDirectory({ - initialQuery, - initialHere, - initialSoon, -}: { - initialQuery: string; - initialHere: boolean; - initialSoon: boolean; -}) { + const { tx, locale } = useSocialI18n(); const roster = useDiscoveryRoster(); - const [query, setQuery] = useState(initialQuery); - const [filter, setFilter] = useState("all"); - const [profession, setProfession] = useState(""); - const [interest, setInterest] = useState(""); - const [language, setLanguage] = useState(""); - const [currentlyHere, setCurrentlyHere] = useState(initialHere); - const [arrivingSoon, setArrivingSoon] = useState(initialSoon); const likes = useRosterLikes(); + const [filters, setFilters] = useState(() => readFilters(new URLSearchParams(params.toString()))); + const [expanded, setExpanded] = useState(false); + const update = (key: keyof Filters, value: string) => setFilters(previous => ({ ...previous, [key]: value })); + useEffect(() => { + const sync = () => setFilters(readFilters(new URLSearchParams(location.search))); + window.addEventListener("popstate", sync); + return () => window.removeEventListener("popstate", sync); + }, []); + useEffect(() => { + const url = new URL(location.href); + for (const key of Object.keys(EMPTY) as (keyof Filters)[]) { + if (filters[key] !== EMPTY[key]) url.searchParams.set(key, filters[key]); + else url.searchParams.delete(key); + } + url.searchParams.delete("here"); url.searchParams.delete("soon"); + if (url.href !== location.href) window.history.replaceState(window.history.state, "", url); + }, [filters]); + const cities = useMemo(() => Array.from(new Set(roster.map(p => p.city.split("·")[0].trim()))).sort((a, b) => a.localeCompare(b, locale)), [roster, locale]); + const interests = useMemo(() => Array.from(new Set(roster.flatMap(p => p.tags))).sort((a, b) => a.localeCompare(b, locale)), [roster, locale]); + const languages = useMemo(() => Array.from(new Set(roster.flatMap(p => p.languages || []))).sort(), [roster]); + const list = useMemo(() => { + const q = filters.q.trim().toLowerCase(); + const result = roster.filter(person => { + const haystack = `${person.name} ${person.city} ${tx(person.city)} ${person.title} ${tx(person.title)} ${person.tags.join(" ")} ${person.tags.map(tag => tx(tag)).join(" ")} ${person.lookingFor} ${person.bio} ${(person.languages || []).join(" ")}`.toLowerCase(); + return (!q || haystack.includes(q)) && (!filters.city || person.city.toLowerCase().includes(filters.city.toLowerCase())) + && (filters.view !== "saved" || likes[person.id]) && (filters.view !== "online" || person.online) + && (!filters.interest || person.tags.includes(filters.interest)) && (!filters.language || person.languages?.includes(filters.language)) + && (filters.status !== "here" || isHere(person.status)) && (filters.status !== "soon" || isSoon(person.status)); + }); + if (filters.sort === "name") result.sort((a, b) => a.name.localeCompare(b.name, locale)); + if (filters.sort === "online") result.sort((a, b) => Number(b.online) - Number(a.online)); + return result; + }, [roster, filters, likes, locale, tx]); + const active = (Object.keys(EMPTY) as (keyof Filters)[]).filter(key => key !== "sort" && filters[key] !== EMPTY[key]); + const chipLabels: Partial> = { view: filters.view === "saved" ? tx("我关注的", "Following") : tx("在线", "Online"), status: filters.status === "here" ? tx("正在这里", "Currently here") : tx("即将到达", "Arriving soon") }; - const list = useMemo( - () => - roster.filter((person) => { - const haystack = - `${person.name} ${person.city} ${person.title} ${person.tags.join(" ")} ${person.lookingFor} ${(person.languages || []).join(" ")}`.toLowerCase(); - const q = query.toLowerCase().trim(); - if (q && !haystack.includes(q)) return false; - if (filter === "saved" && !likes[person.id]) return false; - if (filter === "online" && !person.online) return false; - if (profession && !person.title.toLowerCase().includes(profession.toLowerCase())) - return false; - if ( - interest && - !`${person.tags.join(" ")} ${person.lookingFor}`.toLowerCase().includes(interest.toLowerCase()) - ) - return false; - if ( - language && - !(person.languages || []).some((l) => - l.toLowerCase().includes(language.toLowerCase()), - ) - ) - return false; - // Seed roster has no live trip status — treat online as "here" proxy for demo - if (currentlyHere && !person.online) return false; - if (arrivingSoon && person.online) return false; - return true; - }), - [ - query, - filter, - likes, - roster, - profession, - interest, - language, - currentlyHere, - arrivingSoon, - ], - ); - - const reset = () => { - setQuery(""); - setFilter("all"); - setProfession(""); - setInterest(""); - setLanguage(""); - setCurrentlyHere(false); - setArrivingSoon(false); - }; - - const filtered = - Boolean(query) || - filter !== "all" || - Boolean(profession) || - Boolean(interest) || - Boolean(language) || - currentlyHere || - arrivingSoon; - - return ( - - -
- {list.length} 位 - - 地图 - -
-
-
- -
- {[ - { id: "all", title: "全部" }, - { id: "online", title: "示例在线" }, - { id: "saved", title: "我关注的" }, - ].map((f) => ( - - ))} -
-
- - - - - - -
+ return + + {tx("写我的介绍", "Add my introduction")} + +
+
update("q", value)} label={tx("搜索朋友", "Search people")} placeholder={tx("名字、城市、技能或兴趣", "Name, city, skill or interest")} /> + +
- -
- {list.map((person, index) => ( - - - - {person.online ? : null} - - - {person.name} - {person.id === SELF_MEMBER_ID ? " · 我" : ""} - - - {person.title} - {person.vibe ? ` · ${person.vibe.split("·")[0].trim()}` : ""} - - - {person.city.split("·")[0].trim()} - {person.tags[0] ? ` · ${person.tags[0]}` : ""} - - - {person.lookingFor} - - - ))} - {!list.length && ( - - - - )} -
-
- - - 写我的介绍 - -
- - ); +
{[["all", tx("所有朋友", "Everyone")], ["online", tx("在线", "Online")], ["saved", tx("我关注的", "Following")]].map(([id, label]) => )}
+ {expanded &&
+ + + +
} + {active.length > 0 &&
{active.map(key => )}
} +
+

{list.length} {tx("位朋友", list.length === 1 ? "person" : "people")}

+
{list.map(person =>
+

{person.name}{person.example && {tx("示例", "Example")}}

{tx(person.title)}

{tx(person.city)}
+

{tx(person.bio)}

{tx(person.lookingFor)}

+
{person.tags.slice(0, 4).map(tag => )}
+ {(isHere(person.status) || isSoon(person.status)) && {isHere(person.status) ? tx("正在这里", "Currently here") : tx("即将到达", "Arriving soon")}} +
{person.languages?.slice(0, 2).join(" · ") || tx("自在交流", "Find common ground")}{tx("看看介绍", "View profile")}
+
)}
+ {!list.length && {tx("写我的介绍", "Introduce yourself")}} +

{tx("示例资料用于体验浏览;行程状态由成员填写,在线状态与所在城市分别展示。关注仅保存在当前设备。", "Example profiles let you explore the experience. Travel plans are declared by members and are separate from online presence. Follows stay on this device.")}

+
; } diff --git a/src/modules/social/components/PlacesClient.tsx b/src/modules/social/components/PlacesClient.tsx index 665a03f..23549f0 100644 --- a/src/modules/social/components/PlacesClient.tsx +++ b/src/modules/social/components/PlacesClient.tsx @@ -54,6 +54,7 @@ function PlacesHub() { (c) => cityParam && (c.name === cityParam || + c.id === cityParam || c.name.includes(cityParam) || cityParam.includes(c.name)), ) || null; @@ -146,7 +147,10 @@ function PlacesHub() { > {socialTx("看这座城")} - + + {socialTx("想见的人")} + + {socialTx("打开地图")}
diff --git a/src/modules/social/components/ResourceLibrary.tsx b/src/modules/social/components/ResourceLibrary.tsx index 758bb2c..829c99d 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, useSyncExternalStore, type FormEvent } from "react"; +import { useMemo, useRef, useState, useSyncExternalStore, type FormEvent } from "react"; import { ArrowUpRight, BookOpen, @@ -240,15 +240,32 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) { const config = useSocialConfig(); const [saved] = useLocalState(`saved-${kind}`, []); const books = kind === "ebook"; + const catalog = useMemo(() => { + const remote = books ? config.copy.socialCatalogs?.ebooks : config.copy.socialCatalogs?.videos; + const seeds = books ? SEED_EBOOKS : SEED_VIDEOS; + if (!Array.isArray(remote) || !remote.length) return seeds; + const valid = remote.filter(item => item && typeof item.id === "string" && typeof item.title === "string"); + return valid.length ? valid.map((item, index) => { + const fallback = seeds[index % seeds.length]; + const normalized: Record = { ...fallback }; + for (const [key, value] of Object.entries(item)) { + if (typeof value === "string" || (typeof value === "number" && Number.isFinite(value))) normalized[key] = value; + } + for (const [key, value] of Object.entries(fallback)) { + if (typeof normalized[key] !== typeof value) normalized[key] = value; + } + return normalized as typeof fallback; + }) : seeds; + }, [books, config.copy.socialCatalogs]); const items = books - ? SEED_EBOOKS.map((book) => ({ + ? (catalog as typeof SEED_EBOOKS).map((book) => ({ ...book, summary: book.blurb, city: "共创", coverEmoji: "✦", detail: `${book.chapters} 章 · ${book.minutes} 分钟`, })) - : SEED_VIDEOS.map((video) => ({ + : (catalog as typeof SEED_VIDEOS).map((video) => ({ ...video, detail: `${video.city} · ${video.minutes} 分钟`, })); diff --git a/src/modules/social/components/RoleBoard.tsx b/src/modules/social/components/RoleBoard.tsx index 28808cb..e008624 100644 --- a/src/modules/social/components/RoleBoard.tsx +++ b/src/modules/social/components/RoleBoard.tsx @@ -1,6 +1,6 @@ "use client"; -import { useMemo, useRef, useState, type FormEvent } from "react"; +import { useEffect, useMemo, useRef, useState, type FormEvent } from "react"; import Link from "next/link"; import { ArrowUpRight, @@ -22,6 +22,7 @@ import { SearchField, ResultSummary, SocialDialog, + ShareButton, } from "./SocialUI"; import { TEAM_KIND_LABEL } from "@social/lib/seed"; import { socialApi } from "@social/lib/api"; @@ -31,6 +32,7 @@ import { useSocialConfig } from "./SocialExperience"; import { socialPath } from "@social/lib/socialPath"; import type { SocialGig, SocialTeamKind } from "@social/lib/types"; import { socialTx } from "@social/lib/socialTx"; +import { useSocialI18n } from "@social/lib/useSocialI18n"; const NOTE_PROMPTS = [ "做过类似项目…", @@ -252,6 +254,7 @@ export default function RoleBoard({ initialKind?: SocialTeamKind | "all"; }) { const config = useSocialConfig(); + const { tx } = useSocialI18n(); const catalog = useMemo( () => resolveSocialCatalog(config.copy.socialCatalogs), [config.copy.socialCatalogs], @@ -261,6 +264,20 @@ export default function RoleBoard({ const [savedOnly, setSavedOnly] = useState(false); const [saved] = useLocalState("saved-roles", []); const [active, setActive] = useState(null); + useEffect(() => { + const sync = () => { + let id = ""; + try { id = decodeURIComponent(location.hash.slice(1)); } catch { /* invalid fragment */ } + setActive(catalog.gigs.find(gig => gig.id === id) || null); + }; + sync(); window.addEventListener("hashchange", sync); window.addEventListener("popstate", sync); + return () => { window.removeEventListener("hashchange", sync); window.removeEventListener("popstate", sync); }; + }, [catalog.gigs]); + const selectRole = (gig: SocialGig | null) => { + setActive(gig); + const url = new URL(location.href); url.hash = gig?.id || ""; + history.replaceState(history.state, "", url); + }; const roles = catalog.gigs.filter( (gig) => (kind === "all" || gig.kind === kind) && @@ -351,8 +368,8 @@ export default function RoleBoard({ {TEAM_KIND_LABEL[gig.kind || "parttime"]} -

{gig.title}

-

{gig.role}

+

{tx(gig.title)}

+

{tx(gig.role)}

@@ -365,13 +382,13 @@ export default function RoleBoard({ {tag} ))}
- +
-
- - - -
- -
- ); +
{tx("找到你的打开方式", "Find your way in")}{tx("认识人 / 见一面 / 一起做事", "MEET PEOPLE / MEET IN PERSON / BUILD TOGETHER")}
+ + + {visible("discover") &&
} + + {visible("people") && navigationVisible(config, "/people") &&
+ {sectionHead("01", tx("认识人", "FIND YOUR PEOPLE"), tx("下一句你好,从这里开始。", "Your next hello starts here."), tx("先看看介绍,发现共同兴趣。认识一个人,可以慢慢来。", "A shared interest, a familiar city. Good conversations begin with a little curiosity."), "/people", tx("认识更多朋友", "Explore people"))} +
{["", ...Array.from(new Set(roster.map(p => p.city.split("·")[0].trim()))).slice(0, 5)].map(name => )}
+
{people.map(person =>

{person.name}{person.example && {tx("示例", "Example")}}

{tx(person.title)}

{tx(person.city)}

{tx(person.lookingFor)}

{person.tags.slice(0, 2).map(tag => {tx(tag)})}{tx("看看介绍", "Get to know them")}
)}
+

{tx("标注「示例」的资料用于体验浏览;真实成员以公开资料为准。关注保存在当前设备。", "Profiles marked “Example” let you explore the experience. Real members appear with their published details. Follows stay on this device.")} {tx("写下我的介绍", "Add your introduction")}

+
} + + {visible("cities") && navigationVisible(config, "/places") &&
+ {sectionHead("02", tx("见一面", "TAKE IT OFFLINE"), tx("让陌生的城市,变熟悉。", "New city. Familiar feeling."), tx("找一家好咖啡馆,约一段有空的时间,把线上认识变成真实相遇。", "Discover a city, find your coffee spot, and make time to meet someone new."), "/places", tx("探索所有城市", "Explore cities"))} +
{cities.map(item =>
{item.emoji} {tx(item.country)}

{tx(item.name)}

{tx(item.vibe)}

)}
+

{tx("一杯咖啡的时间,刚刚好。", "A coffee’s worth of time. A world of possibility.")}

{tx("看看主理人的话题和可预约时间,找到聊得来的那个人。", "Find a host, pick a topic, and choose a time that works for you.")}

{tx("约杯咖啡", "Find a coffee chat")}
+
} + + {visible("meetup") && navigationVisible(config, "/meetup") &&
+ {sectionHead("03", tx("聊得来", "BETTER CONVERSATIONS"), tx("隔着屏幕,也能聊得很近。", "Different places. Same conversation."), tx("文字、声音或视频,选择让你舒服的方式。", "A message, a voice, a face. Connect in a way that feels like you."), "/meetup", tx("探索语音厅", "Explore lounges"))} +

OPEN CONVERSATION

{tx("在路上,也有个地方聊聊。", "A place to talk, wherever you are.")}

{tx("聊城市、聊近况、问个小问题。从公开聊天开始认识彼此。", "Talk cities, share a little of your day, ask a question. Start in the community chat.")}

{tx("进入聊天群", "Join the conversation")}
{tx("大家最近在哪座城?", "Where’s everyone these days?")}{tx("下一站,想去看看海。", "Somewhere by the sea next.")} 🌊
+
{catalog.meetups.slice(0, 3).map((event, index) =>
{tx("语音 · 视频", "VOICE · VIDEO")} / 0{index + 1}

{tx(event.title)}

{event.city === "Online" ? tx("线上相聚", "Meet online") : tx(event.city)} · {event.date || tx("时间待确认", "Schedule to follow")}

)}

{tx("进入后可自行选择麦克风与摄像头。", "Choose your microphone and camera settings when you join.")}

+
+
} + + {visible("collaborate") &&
+ {sectionHead("04", tx("一起做事", "MAKE SOMETHING TOGETHER"), tx("有些想法,适合一起实现。", "Some ideas are better together."), tx("从互换一项技能,到一起完成一个项目。把同频变成同行。", "Exchange a skill. Find a collaborator. Turn a shared spark into something real."), "/team", tx("发现共创机会", "Find collaborators"))} +
{[ + { href: "/skills", Icon: HeartHandshake, title: tx("你擅长的,刚好是我需要的。", "Your strength. Someone’s next step."), text: tx("技能交换", "Skill exchange"), description: tx("提供你的擅长,也找到愿意分享的人。", "Share what you do well. Learn from someone new."), tone: "mint" }, + { href: "/work", Icon: Sparkles, title: tx("把「有空一起」变成进行中。", "Make “someday” a work in progress."), text: tx("远程协作", "Work together"), description: tx("用看板梳理任务,用文档记录共同的想法。", "Find momentum with boards and shared notes."), tone: "coral" }, + { href: "/ebook", Icon: BookOpen, title: tx("走过的路,也能照亮别人。", "A story worth passing on."), text: tx("社区共创", "Community creations"), description: tx("读一份经验小册,分享一个属于你的故事。", "Explore guides, share stories and create together."), tone: "amber" }, + ].filter(item => navigationVisible(config, item.href)).map(item => {item.text}

{item.title}

{item.description}

)}
+
} + + {visible("faq") &&

A LITTLE GOOD TO KNOW

{tx("来之前,你可能想知道。", "A few things you might be wondering.")}

{tx("还有问题?聊聊想法", "Something else on your mind?")}
{[ + [tx("还不是数字游民,也可以加入吗?", "Can I join if I’m not a digital nomad?"), tx("当然。正在远程工作、自由职业、计划出发,或只是对这种生活好奇,都可以先浏览社区,找到感兴趣的话题和朋友。", "Absolutely. Whether you work remotely, freelance, are planning a change, or are simply curious, explore the community and find a conversation that interests you.")], + [tx("第一次来,怎么开始认识人?", "Where should I start?"), tx("先写一段介绍,再按城市和兴趣看看大家。可以在公开聊天群打招呼,也可以选择一个咖啡聊主理人,查看时间后再预约。", "Add a short introduction, then browse people by city or interest. Say hello in the community chat, or explore coffee hosts and their available times.")], + [tx("我的位置和联系方式会公开吗?", "Will my location and contact details be public?"), tx("地图以城市为单位展示,不需要公开精确位置。发布介绍前请检查内容,只分享你愿意公开的信息。线下见面优先选择公共场所。", "The map works at city level. You don’t need to share an exact location. Review your introduction before publishing and only share what you’re comfortable making public. Choose public places for a first meeting.")], + ].map(([question, answer]) =>
{question}+

{answer}

)}
} + +
YOUR NEXT CHAPTER

{landing.socialInviteTitle}

{landing.socialInviteLead}

+ + + +
))} {!roles.length && ( @@ -398,8 +415,8 @@ export default function RoleBoard({ )}
{active && ( - setActive(null)}> - + selectRole(null)}> + )} diff --git a/src/modules/social/components/SiteShell.tsx b/src/modules/social/components/SiteShell.tsx index 8f2b201..c7dbfe3 100644 --- a/src/modules/social/components/SiteShell.tsx +++ b/src/modules/social/components/SiteShell.tsx @@ -2,7 +2,13 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; -import { LogOut } from "lucide-react"; +import { ArrowUpRight, ChevronDown, LogOut, Moon, Sun } from "lucide-react"; +import { useTheme } from "~/components/theme-provider"; +import { navigationDetail, routeMatches } from "@social/lib/navigation"; +import { navigationVisible } from "@social/lib/experience"; +import { useSocialConfig } from "./SocialExperience"; +import SocialCommandMenu from "./SocialCommandMenu"; +import SocialLangSwitch from "./SocialLangSwitch"; import { useEffect, useId, @@ -22,7 +28,7 @@ import { import { useRevealMotion } from "@social/lib/useRevealMotion"; import { useSocialI18n } from "@social/lib/useSocialI18n"; import { socialTx } from "@social/lib/socialTx"; -import { SocialMobileDock } from "./SocialNavigation"; +import { SocialFooter, SocialMobileDock } from "./SocialNavigation"; import SocialQuickRail from "./SocialQuickRail"; import SocialBrandLogo from "./SocialBrandLogo"; import JoinPayModal from "./JoinPayModal"; @@ -51,7 +57,9 @@ export default function SiteShell({ editorial?: boolean; onJoin?: () => void; }) { - const { t } = useSocialI18n(); + const { t, tx, locale } = useSocialI18n(); + const config = useSocialConfig(); + const { resolvedTheme, setTheme } = useTheme(); const [openGroup, setOpenGroup] = useState(null); const [menuOpen, setMenuOpen] = useState(false); const [scrolled, setScrolled] = useState(false); @@ -188,10 +196,11 @@ export default function SiteShell({
- {t.navGroups.map((g) => ( + {t.navGroups.map((g) => ({ ...g, items: g.items.filter(item => navigationVisible(config, item.href)) })).filter(g => g.items.length).map((g) => (
pathname.startsWith(socialPath(item.href))) ? " is-active" : ""}`} + className={`nav-group${openGroup === g.id ? " open" : ""}${g.items.some((item) => routeMatches(pathname, socialPath(item.href))) ? " is-active" : ""}`} + onBlur={(event) => { if (!event.currentTarget.contains(event.relatedTarget as Node)) setOpenGroup(null); }} onMouseEnter={() => { if (window.matchMedia("(min-width: 901px)").matches) setOpenGroup(g.id); @@ -209,26 +218,36 @@ export default function SiteShell({ className="nav-group-btn" aria-expanded={openGroup === g.id} aria-controls={`${menuId}-${g.id}`} - onClick={() => setOpenGroup(openGroup === g.id ? null : g.id)} + onClick={() => setOpenGroup(current => window.matchMedia("(hover: hover)").matches ? g.id : current === g.id ? null : g.id)} + onKeyDown={event => { + if (event.key === "ArrowDown" || event.key === "ArrowUp") { + event.preventDefault(); setOpenGroup(g.id); + requestAnimationFrame(() => { + const links = document.getElementById(`${menuId}-${g.id}`)?.querySelectorAll("a"); + links?.[event.key === "ArrowUp" ? links.length - 1 : 0]?.focus(); + }); + } + }} > {g.label} - - ▾ - +
- {g.items.map((item) => ( +
{g.label}{tx("用自己的节奏,找到连接", "Good connections start here")}
+
{g.items.map((item) => { const detail = navigationDetail(item.href, locale); const Icon = detail.icon; return ( - {item.label} + + {item.label}{detail.description} + - ))} + ); })}
))} @@ -263,6 +282,9 @@ export default function SiteShell({
+ + + {session ? : null} {session ? ( @@ -372,6 +394,7 @@ export default function SiteShell({ {children} +
diff --git a/src/modules/social/components/SkillsBoardClient.tsx b/src/modules/social/components/SkillsBoardClient.tsx index edf1625..f08bbff 100644 --- a/src/modules/social/components/SkillsBoardClient.tsx +++ b/src/modules/social/components/SkillsBoardClient.tsx @@ -1,211 +1,89 @@ "use client"; -import { useEffect, useState, type FormEvent } from "react"; -import { ArrowLeftRight, MapPin, Plus } from "lucide-react"; +import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent } from "react"; +import Link from "next/link"; +import { ArrowLeftRight, ArrowUpRight, Check, MapPin, Plus } from "lucide-react"; import SiteShell from "./SiteShell"; -import { PageIntro } from "./SocialUI"; +import { EmptyState, PageIntro, SearchField, SocialDialog } from "./SocialUI"; import { socialApi, getGuestId } from "@social/lib/api"; -import { loadJson } from "@social/lib/storage"; -import { socialTx } from "@social/lib/socialTx"; - -type SkillItem = { - id: string; - guestId: string; - author: string; - city: string; - offer: string; - want: string; - note: string; - createdAt: string; -}; +import { loadJson, saveJson } from "@social/lib/storage"; +import { useLocalState } from "@social/lib/useLocalState"; +import { useSocialI18n } from "@social/lib/useSocialI18n"; +import { socialPath } from "@social/lib/socialPath"; +type SkillItem = { id: string; guestId: string; author: string; city: string; offer: string; want: string; note: string; createdAt: string }; const SEED: SkillItem[] = [ - { - id: "seed-1", - guestId: "seed", - author: "Mia", - city: "清迈", - offer: "英语口语陪练", - want: "帮拍短视频 / 剪辑", - note: "每周 2 次 · 咖啡馆或线上均可", - createdAt: "", - }, - { - id: "seed-2", - guestId: "seed", - author: "Ken", - city: "里斯本", - offer: "帮看代码 / 架构 review", - want: "签证 / D7 经验咨询", - note: "远程异步也行", - createdAt: "", - }, + { id: "seed-1", guestId: "seed", author: "Mia", city: "清迈", offer: "英语口语陪练", want: "帮拍短视频 / 剪辑", note: "每周 2 次 · 咖啡馆或线上均可", createdAt: "" }, + { id: "seed-2", guestId: "seed", author: "Ken", city: "里斯本", offer: "帮看代码 / 架构 review", want: "签证 / D7 经验咨询", note: "远程异步也行", createdAt: "" }, ]; +const EMPTY = { city: "", offer: "", want: "", note: "" }; export default function SkillsBoardClient() { - const me = typeof window !== "undefined" ? getGuestId() : ""; + const { tx } = useSocialI18n(); const [items, setItems] = useState(SEED); - const [city, setCity] = useState(""); - const [offer, setOffer] = useState(""); - const [want, setWant] = useState(""); - const [note, setNote] = useState(""); - const [postCity, setPostCity] = useState(""); + const [draft, setDraft] = useLocalState("skill-exchange-draft", EMPTY); + const [query, setQuery] = useState(""); + const [view, setView] = useState("all"); + const [open, setOpen] = useState(false); const [busy, setBusy] = useState(false); - const [err, setErr] = useState(""); - - const load = async (filterCity = city) => { + const [loading, setLoading] = useState(false); + const [offline, setOffline] = useState(false); + const [error, setError] = useState(""); + const [message, setMessage] = useState(""); + const [closeId, setCloseId] = useState(null); + const lock = useRef(false); + const generation = useRef(0); + const me = typeof window !== "undefined" ? getGuestId() : ""; + const load = useCallback(async () => { + const current = ++generation.current; + setLoading(true); try { - const res = await socialApi.listSkills({ - city: filterCity || undefined, - limit: 80, - }); - const live = res.items || []; - setItems(live.length ? live : SEED); + const response = await socialApi.listSkills({ limit: 80 }); + if (current !== generation.current) return; + setItems(response.items.length ? response.items : SEED); + setOffline(false); saveJson("skill-exchange-cache", response.items); } catch { - setItems(SEED); - } - }; - - useEffect(() => { - const roster = loadJson<{ name?: string; city?: string }>("roster", {}); - if (roster.city) { - setPostCity(roster.city); - setCity(roster.city); - } - void load(roster.city || ""); - // eslint-disable-next-line react-hooks/exhaustive-deps + if (current !== generation.current) return; + setOffline(true); + const cached = loadJson("skill-exchange-cache", []); + if (Array.isArray(cached) && cached.length) setItems(cached); + } finally { if (current === generation.current) setLoading(false); } }, []); - - const submit = async (e: FormEvent) => { - e.preventDefault(); - if (busy) return; - setBusy(true); - setErr(""); + useEffect(() => { void load(); return () => { generation.current += 1; }; }, [load]); + const update = (key: keyof typeof EMPTY, value: string) => { setDraft(previous => ({ ...previous, [key]: value })); setError(""); }; + const submit = async (event: FormEvent) => { + event.preventDefault(); + if (lock.current || !draft.offer.trim() || !draft.want.trim()) return; + lock.current = true; setBusy(true); setError(""); setMessage(""); try { - const roster = loadJson<{ name?: string }>("roster", {}); - await socialApi.createSkill({ - author: roster.name || "游民", - city: postCity.trim(), - offer: offer.trim(), - want: want.trim(), - note: note.trim(), - }); - setOffer(""); - setWant(""); - setNote(""); + const profile = loadJson<{ name?: string }>("roster", {}); + await socialApi.createSkill({ author: profile.name || tx("游民", "Community member"), city: draft.city.trim(), offer: draft.offer.trim(), want: draft.want.trim(), note: draft.note.trim() }); + setDraft(EMPTY); setOpen(false); setMessage(tx("互换已发布。欢迎去聊天群介绍你的想法。", "Your exchange is published. Introduce it in the community chat.")); await load(); - } catch (ex) { - setErr(ex instanceof Error ? ex.message : socialTx("发布失败")); - } finally { - setBusy(false); - } + } catch { setError(tx("暂时未能发布,草稿已保存在当前设备。请重试。", "Couldn’t publish. Your draft is saved on this device. Please try again.")); } + finally { lock.current = false; setBusy(false); } }; + const closeExchange = async () => { + if (!closeId || lock.current) return; + lock.current = true; setBusy(true); setError(""); + try { await socialApi.closeSkill(closeId); setItems(previous => previous.filter(item => item.id !== closeId)); setCloseId(null); setMessage(tx("互换已关闭。", "Exchange closed.")); } + catch { setError(tx("暂时未能关闭,请重试。", "Couldn’t close the exchange. Please try again.")); } + finally { lock.current = false; setBusy(false); } + }; + const list = useMemo(() => { + const q = query.trim().toLowerCase(); + return items.filter(item => (view !== "mine" || item.guestId === me) && (!q || `${item.author} ${item.city} ${item.offer} ${item.want} ${item.note} ${tx(item.city)} ${tx(item.offer)} ${tx(item.want)}`.toLowerCase().includes(q))); + }, [items, view, query, me, tx]); - return ( - - -

- {socialTx("教英语换拍视频、帮忙看代码换签证咨询——写清楚你能给什么、想换什么。")} -

-
- -
void submit(ev)}> -

- {socialTx("发一条互换")} -

- - - -