ARCHIVE test12 Codex social overhaul — NEVER DEPLOY to .com/.cn.
Freeze experimental social/admin UX on test12 for reference only; see docs/archive/test12-NEVER-DEPLOY.md. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
499f2d3e26
commit
3e54c3ace2
@ -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`。
|
||||
|
||||
## 架构
|
||||
|
||||
```
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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() {
|
||||
<Route path="switches" element={<Switches />} />
|
||||
<Route path="social" element={<Navigate to="overview" replace />} />
|
||||
<Route path="social/overview" element={<Social />} />
|
||||
<Route path="social/experience" element={<SocialExperience />} />
|
||||
<Route path="social/roster" element={<Social />} />
|
||||
<Route path="social/messages" element={<Social />} />
|
||||
<Route path="social/reviews" element={<Social />} />
|
||||
|
||||
@ -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: '实时' },
|
||||
],
|
||||
},
|
||||
|
||||
@ -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; }
|
||||
}
|
||||
|
||||
17
docs/archive/test12-NEVER-DEPLOY.md
Normal file
17
docs/archive/test12-NEVER-DEPLOY.md
Normal file
@ -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.
|
||||
@ -43,6 +43,7 @@ const aliases = {
|
||||
};
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
distDir: process.env.NOMADRO_DIST_DIR || ".next",
|
||||
poweredByHeader: false,
|
||||
compress: true,
|
||||
experimental: {
|
||||
|
||||
BIN
public/social/cities/bali.jpg
Normal file
BIN
public/social/cities/bali.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
BIN
public/social/cities/chiangmai.jpg
Normal file
BIN
public/social/cities/chiangmai.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 183 KiB |
BIN
public/social/cities/dali.jpg
Normal file
BIN
public/social/cities/dali.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
BIN
public/social/cities/lisbon.jpg
Normal file
BIN
public/social/cities/lisbon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
46
scripts/audit-social-experience.py
Normal file
46
scripts/audit-social-experience.py
Normal file
@ -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())
|
||||
@ -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()
|
||||
|
||||
156
scripts/check-social-overhaul.py
Normal file
156
scripts/check-social-overhaul.py
Normal file
@ -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())
|
||||
18
scripts/probe-social-layout.py
Normal file
18
scripts/probe-social-layout.py
Normal file
@ -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())
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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:
|
||||
"认识同频的人:看看谁在这儿、开视频聊聊、出来见一面、一起做点事",
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -32,12 +32,22 @@ type LocaleContextValue = {
|
||||
};
|
||||
|
||||
const LocaleContext = createContext<LocaleContextValue | null>(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<LocaleContextValue>(() => {
|
||||
const audience: AudienceLane =
|
||||
audienceProfile?.audience ?? (locale === "zh" ? "cn" : "intl");
|
||||
audienceProfile?.audience ?? (isComHostname() ? "intl" : "cn");
|
||||
const isChina = audience === "cn";
|
||||
return {
|
||||
locale,
|
||||
|
||||
@ -19,41 +19,45 @@ type ThemeContextValue = {
|
||||
|
||||
const ThemeContext = createContext<ThemeContextValue | null>(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<ThemeMode>(FORCED_THEME);
|
||||
const [theme, updateTheme] = useState<ThemeMode>("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 (
|
||||
<ThemeContext.Provider value={{ theme, resolvedTheme, setTheme }}>
|
||||
{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'}})();`;
|
||||
|
||||
@ -280,6 +280,7 @@ export type NomadroRemoteConfig = {
|
||||
description?: string;
|
||||
}
|
||||
>;
|
||||
socialExperience?: import("~/modules/social/lib/experience").SocialExperienceConfig;
|
||||
socialVideoSources?: Record<string, string>;
|
||||
socialHiddenSections?: string[];
|
||||
/** 游民社区目录覆盖;空数组/非法字段回退包内 seed */
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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<CoffeeHost[]>([]);
|
||||
const [err, setErr] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [retry, setRetry] = useState(0);
|
||||
const [cityId, setCityId] = useState<string>("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<CoffeeHost[]>("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() {
|
||||
<div className="cf-hero-offline-copy">
|
||||
<p className="cf-eyebrow">{zh ? "OFFLINE · CITY" : "OFFLINE · CITY"}</p>
|
||||
<h1 className="cf-brand" id="cf-offline-brand">
|
||||
Nomadro <span>{zh ? "线下 Coffee" : "Offline Coffee"}</span>
|
||||
{copy.title || "Nomadro"} <span>{copy.accent || (zh ? "线下 Coffee" : "Offline Coffee")}</span>
|
||||
</h1>
|
||||
<p className="cf-title">
|
||||
{zh
|
||||
@ -83,9 +91,9 @@ export default function CoffeeLanding() {
|
||||
: "Pick a city. Book an offline coffee."}
|
||||
</p>
|
||||
<p className="cf-lead">
|
||||
{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.")}
|
||||
</p>
|
||||
<div className="cf-cta">
|
||||
<a className="cf-btn cf-btn-primary" href="#cf-hosts">
|
||||
@ -185,7 +193,7 @@ export default function CoffeeLanding() {
|
||||
</Link>
|
||||
<Link
|
||||
className="cf-btn cf-btn-ghost"
|
||||
href={socialPath(`/places?tab=cafes&city=${activeCity.id}`)}
|
||||
href={socialPath(`/places?city=${encodeURIComponent(activeCity.name)}`)}
|
||||
>
|
||||
{zh ? "同城咖啡馆" : "Cafés nearby"}
|
||||
</Link>
|
||||
@ -234,7 +242,8 @@ export default function CoffeeLanding() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{err && <p className="cf-error" role="alert">{err}</p>}
|
||||
<label className="cf-host-search"><span>{zh ? "找一个聊得来的话题或主理人" : "Find a topic or host"}</span><input type="search" value={search} onChange={event => setSearch(event.target.value)} placeholder={zh ? "名字、城市或话题…" : "Name, city or topic…"} /></label>
|
||||
{err && <p className="cf-error" role="alert">{hosts.length ? (zh ? "暂时无法更新,正在显示上次浏览的主理人。请重新加载后确认最新档期。" : "Couldn’t refresh. Showing previously viewed hosts. Retry to confirm current availability.") : (zh ? "暂时无法加载主理人,请稍后重试。" : "Couldn’t load hosts. Please try again.")}</p>}
|
||||
{err && <button className="cf-btn cf-btn-ghost" type="button" onClick={() => setRetry(value => value + 1)}>{zh ? '重新加载' : 'Retry'}</button>}
|
||||
{loading && <p className="cf-hint" role="status">{zh ? '正在寻找可约的人…' : 'Loading hosts…'}</p>}
|
||||
|
||||
@ -260,11 +269,11 @@ export default function CoffeeLanding() {
|
||||
</div>
|
||||
|
||||
{!filtered.length && !err && !loading ? (
|
||||
<p className="cf-empty">
|
||||
<div className="cf-empty"><p>
|
||||
{zh
|
||||
? "这城暂时没人开放预约,先逛咖啡馆地图,或换一座城。"
|
||||
: "No hosts here yet — try the café map or another city."}
|
||||
</p>
|
||||
</p><button className="cf-btn cf-btn-ghost" type="button" onClick={() => { setSearch(""); setCityId("all"); }}>{zh ? "重置筛选" : "Reset filters"}</button></div>
|
||||
) : null}
|
||||
|
||||
<div className="cf-cta cf-cta-foot">
|
||||
|
||||
469
src/modules/social/app/community.css
Normal file
469
src/modules/social/app/community.css
Normal file
@ -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; }
|
||||
}
|
||||
@ -633,7 +633,7 @@ function DateCardFace({ member }: { member: SocialRosterMember }) {
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
{member.online ? (
|
||||
{member.online && !member.example ? (
|
||||
<span className="social-date-online-pill">{socialTx("现在在线")}</span>
|
||||
) : null}
|
||||
<div className="social-date-meta">
|
||||
@ -642,7 +642,7 @@ function DateCardFace({ member }: { member: SocialRosterMember }) {
|
||||
<span className="social-date-gender" aria-hidden>
|
||||
{member.gender === "f" ? "👩" : member.gender === "m" ? "👨" : "🙂"}
|
||||
</span>{" "}
|
||||
{member.name}
|
||||
{member.name}{member.example && <span className="people-card-example">{socialTx("示例", "Example")}</span>}
|
||||
</h2>
|
||||
<p>
|
||||
{member.gender === "f"
|
||||
|
||||
@ -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() {
|
||||
</DemoBadge>
|
||||
</PageIntro>
|
||||
<p className="social-muted social-event-lead reveal">
|
||||
{socialTx("点进场次即开麦开摄像头,比只打字更近一点。")}
|
||||
{tx("先选一个感兴趣的话题,进入后再决定怎样参与。", "Pick a conversation that interests you, then choose how you’d like to join.")}
|
||||
</p>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
@ -121,7 +123,7 @@ export default function EventDirectory() {
|
||||
<div className="social-event-body">
|
||||
<div className="social-card-top">
|
||||
<span className="social-badge live">
|
||||
{event.mode === "hybrid" ? "可线下" : "语音厅"}
|
||||
{event.mode === "hybrid" ? tx("可线下", "Hybrid") : event.mode === "offline" ? tx("线下见面", "In person") : tx("语音厅", "Voice lounge")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="social-meetup-faces" aria-hidden>
|
||||
@ -135,13 +137,13 @@ export default function EventDirectory() {
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<h2>{event.title}</h2>
|
||||
<h2>{tx(event.title)}</h2>
|
||||
<p className="social-event-time">
|
||||
<Clock3 size={14} />
|
||||
{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")}
|
||||
</p>
|
||||
<p className="social-muted" suppressHydrationWarning>
|
||||
{scheduled ? `你那边大约是:${start.toLocaleString([], {
|
||||
{scheduled ? `${tx("你那边大约是:", "Your time: ")}${start.toLocaleString([], {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
|
||||
@ -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() {
|
||||
<h2 id="social-intent-title">{copy?.title || tx("今天,想从哪里开始?", "Where would you like to start?")}</h2>
|
||||
</div>
|
||||
<div className="intent-options" role="group" aria-label={tx("选择探索方向", "Choose what to explore")}>
|
||||
{journeys.map(journey => { const Mark = journey.icon; return <button key={journey.id} type="button" aria-pressed={intent === journey.id} aria-controls="social-intent-panel" onClick={() => setIntent(journey.id)}><Mark size={18} />{journey.label}</button>; })}
|
||||
{available.map(journey => { const Mark = journey.icon; return <button key={journey.id} type="button" aria-pressed={selected.id === journey.id} aria-controls="social-intent-panel" onClick={() => setIntent(journey.id)}><Mark size={18} />{journey.label}</button>; })}
|
||||
</div>
|
||||
<div className="intent-panel" id="social-intent-panel">
|
||||
<div className="intent-art" aria-hidden="true"><span /><Icon size={42} strokeWidth={1.3} /><i /></div>
|
||||
|
||||
@ -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<string, string> = {
|
||||
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<typeof getSocialSession>)?.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) => <div className="community-section-head"><div><p className="community-kicker"><span>{number}</span>{eyebrow}</p><h2>{title}</h2><p>{description}</p></div><Link className="community-text-link" href={socialPath(href)}>{label}<ArrowUpRight size={17} /></Link></div>;
|
||||
|
||||
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<HTMLDivElement>) => {
|
||||
if (event.pointerType !== "mouse") return;
|
||||
const panel = (event.target as Element).closest<HTMLElement>(
|
||||
".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 (
|
||||
<div
|
||||
className="home-flow social-flow social-fx social-home"
|
||||
onPointerMove={onPanelPointerMove}
|
||||
>
|
||||
<div className="social-fx-orbs" aria-hidden>
|
||||
<i className="social-fx-orb o1" />
|
||||
<i className="social-fx-orb o2" />
|
||||
<i className="social-fx-orb o3" />
|
||||
</div>
|
||||
<SiteShell home>
|
||||
<div className="connection-scroll-progress" aria-hidden="true" />
|
||||
<main id="social-main">
|
||||
<ConnectionHero
|
||||
onJoin={openJoin}
|
||||
promoUrl={promoUrl}
|
||||
copy={landingCopy}
|
||||
/>
|
||||
<ConnectionWays copy={landingCopy} />
|
||||
|
||||
<nav className="social-path" aria-label={socialTx("本页导航")}>
|
||||
<div className="container">
|
||||
<div className="social-path-track reveal">
|
||||
{PATH.map((p) => {
|
||||
const external = "external" in p && p.external;
|
||||
const href = external ? socialPath(p.href) : p.href;
|
||||
if (external) {
|
||||
return (
|
||||
<Link
|
||||
key={p.href}
|
||||
href={href}
|
||||
className="social-path-link"
|
||||
>
|
||||
<span className="social-path-emoji" aria-hidden>
|
||||
{p.emoji}
|
||||
</span>
|
||||
{p.label}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a
|
||||
key={p.href}
|
||||
href={href}
|
||||
className="social-path-link"
|
||||
aria-current={
|
||||
activeSection === p.href.slice(1)
|
||||
? "location"
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<span className="social-path-emoji" aria-hidden>
|
||||
{p.emoji}
|
||||
</span>
|
||||
{p.label}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
return <div className="social-home social-flow community-home">
|
||||
<SiteShell home>
|
||||
<main id="social-main">
|
||||
{announcement?.enabled && announceText && <a className="community-announcement" href={safeCommunityHref(announcement.href)}><Sparkles size={14} /><span>{announceText}</span><ArrowRight size={14} /></a>}
|
||||
<section className="community-hero" aria-labelledby="community-home-title">
|
||||
<div className="container community-hero-layout">
|
||||
<div className="community-hero-copy">
|
||||
<p className="community-kicker"><span className="community-signal" />{copy.eyebrow || landing.socialEyebrow}</p>
|
||||
<h1 id="community-home-title">{copy.title || tx("世界很大,", "A big world.")}<br /><span>{copy.accent || tx("同频的人不远。", "Your kind of people.")}</span></h1>
|
||||
<p className="community-hero-lead">{copy.description || tx("换一座城市,不必重新孤独。从一句你好、一杯咖啡开始,找到一起探索、一起创造的人。", "A new city doesn’t have to mean starting over alone. Find your people through a hello, a coffee, or something you build together.")}</p>
|
||||
<form className="community-hero-search" role="search" onSubmit={event => { event.preventDefault(); router.push(socialPath(`/people${query.trim() ? `?q=${encodeURIComponent(query.trim())}` : ""}`)); }}><Search size={19} /><input type="search" aria-label={tx("搜索城市、兴趣或朋友", "Search cities, interests or people")} placeholder={tx("你在哪座城?想认识什么样的人?", "A city, an interest, your kind of people…")} value={query} onChange={event => setQuery(event.target.value)} /><button type="submit" aria-label={tx("发现同频", "Find your people")}><ArrowRight size={20} /></button></form>
|
||||
<div className="community-hero-actions"><Link className="social-btn primary" href={socialPath("/people")}>{tx("认识同频的人", "Find your people")}<ArrowUpRight size={17} /></Link><Link className="community-text-link" href={socialPath("/chat")}><MessageCircle size={17} />{tx("先打个招呼", "Just say hello")}</Link></div>
|
||||
<div className="community-hero-note"><span className="community-mini-avatars">{roster.slice(0, 4).map(person => <SocialAvatar key={person.id} src={person.avatar} faceOk={person.faceOk} size={28} />)}</span><span>{tx("自由职业者、远程工作者和路上的你", "For freelancers, remote workers and the curious")}</span></div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<AttractiveRoster onJoin={openJoin} />
|
||||
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="date"
|
||||
aria-label={socialTx("认识一下")}
|
||||
>
|
||||
<div className="container">
|
||||
<div className="social-date-hero reveal is-alive">
|
||||
<div className="social-date-hero-copy">
|
||||
<span className="section-tag">
|
||||
<span>{socialTx("认识一下")}</span>
|
||||
<span>{socialTx("左右滑")}</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
💕
|
||||
</span>
|
||||
{socialTx("一张一张认识新朋友")}
|
||||
</h2>
|
||||
<p>
|
||||
{socialTx(
|
||||
"像翻相册一样:不感兴趣就跳过,想认识就留下。之后再决定要不要打招呼。",
|
||||
)}
|
||||
</p>
|
||||
<ul className="social-date-hero-steps">
|
||||
<li>
|
||||
<em>←</em> {socialTx("跳过")}
|
||||
</li>
|
||||
<li>
|
||||
<em>→</em> {socialTx("想认识")}
|
||||
</li>
|
||||
<li>
|
||||
<em>♥</em> {socialTx("稍后打招呼")}
|
||||
</li>
|
||||
</ul>
|
||||
<div className="social-date-stage-acts">
|
||||
<Link
|
||||
className="btn btn-primary"
|
||||
href={socialPath("/date")}
|
||||
>
|
||||
{socialTx("开始认识")}
|
||||
<ArrowUpRight size={16} />
|
||||
</Link>
|
||||
<Link
|
||||
className="btn btn-ghost"
|
||||
href={socialPath("/people")}
|
||||
>
|
||||
{socialTx("先浏览大家")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Link
|
||||
href={socialPath("/date")}
|
||||
className="social-date-hero-deck"
|
||||
aria-label={socialTx("开始认识")}
|
||||
>
|
||||
{datePreview.map((m, i) => (
|
||||
<div
|
||||
key={m.id}
|
||||
className={`social-date-hero-card social-date-hero-card-${i}`}
|
||||
style={{
|
||||
["--i" as string]: i,
|
||||
backgroundImage: `linear-gradient(180deg, transparent 35%, #0a0a0ef2 88%), url(${m.avatar})`,
|
||||
}}
|
||||
>
|
||||
{m.online ? (
|
||||
<span className="social-date-hero-online">{socialTx("在线")}</span>
|
||||
) : null}
|
||||
<div className="social-date-hero-meta">
|
||||
<strong>
|
||||
{m.name}
|
||||
<small>{m.title}</small>
|
||||
</strong>
|
||||
<em>{m.city.split("·")[0].trim()}</em>
|
||||
<p>{m.lookingFor}</p>
|
||||
<div className="social-date-card-tags">
|
||||
{m.tags.slice(0, 2).map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<span className="social-date-hero-cta">
|
||||
<Heart size={14} /> {socialTx("点这里开始滑")}
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="meetup"
|
||||
aria-label={socialTx("开视频聊聊")}
|
||||
>
|
||||
<div className="container">
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="meetup" />
|
||||
<span className="section-tag">
|
||||
<span>{socialTx("聊天群组")}</span>
|
||||
<span>{socialTx("语音 · 视频")}</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
📡
|
||||
</span>
|
||||
{landingCopy.socialOnlineTitle}
|
||||
</h2>
|
||||
<p>
|
||||
{socialTx("进语音厅直接开麦开摄像头,和大家面对面聊聊。")}
|
||||
</p>
|
||||
</div>
|
||||
<div className="social-panel-grid social-panel-grid-2">
|
||||
{meetups.map((m, i) => (
|
||||
<article
|
||||
key={m.id}
|
||||
className={`social-panel social-panel-fx reveal${i === 0 ? " is-accent" : ""}`}
|
||||
style={{ ["--stagger" as string]: `${i * 80}ms` }}
|
||||
>
|
||||
<div
|
||||
className="connection-meetup-art is-live"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className="connection-meetup-number">
|
||||
0{i + 1}
|
||||
</span>
|
||||
<div className="connection-audio-bars">
|
||||
{Array.from({ length: 14 }, (_, n) => (
|
||||
<i
|
||||
key={n}
|
||||
style={{
|
||||
height: `${12 + ((n * 17 + i * 13) % 48)}px`,
|
||||
animationDelay: `${n * -0.15}s`,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-video-grid">
|
||||
{roster.slice(i, i + 4).map((p) => (
|
||||
<span key={p.id} className="social-video-tile">
|
||||
<SocialAvatar
|
||||
src={p.avatar}
|
||||
size={36}
|
||||
lazy
|
||||
faceOk={p.faceOk}
|
||||
/>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<Radio size={22} strokeWidth={1.3} />
|
||||
</div>
|
||||
<div className="social-panel-meta">
|
||||
<span>
|
||||
{m.city === "Online" ? "语音厅" : m.city}
|
||||
</span>
|
||||
<time>
|
||||
{m.date} · {m.time}
|
||||
</time>
|
||||
</div>
|
||||
<div className="social-meetup-faces" aria-hidden>
|
||||
{roster.slice(i + 1, i + 5).map((p) => (
|
||||
<SocialAvatar
|
||||
key={p.id}
|
||||
src={p.avatar}
|
||||
size={24}
|
||||
lazy
|
||||
faceOk={p.faceOk}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<h3>{m.title}</h3>
|
||||
<p>{socialTx("开麦 / 开视频 · 认识新朋友")}</p>
|
||||
<Link
|
||||
className="btn btn-primary btn-sm"
|
||||
href={socialPath(`/meetup/${m.id}`)}
|
||||
>
|
||||
{socialTx("进入语音厅")}
|
||||
<ArrowUpRight size={14} />
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-section-actions reveal">
|
||||
<Link href={socialPath("/meetup")} className="btn btn-ghost">
|
||||
{socialTx("看看全部")}
|
||||
</Link>
|
||||
<Link href={socialPath("/chat")} className="btn btn-ghost">
|
||||
{socialTx("文字群聊")}
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost"
|
||||
onClick={openJoin}
|
||||
>
|
||||
{t.joinCommunity}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<div id="cities">
|
||||
<HomeCoffeeEntry />
|
||||
</div>
|
||||
|
||||
<section
|
||||
className="section section-compact"
|
||||
aria-label={socialTx("城市足迹")}
|
||||
>
|
||||
<div className="container">
|
||||
<div className="social-map-teaser reveal">
|
||||
<div className="social-map-teaser-copy">
|
||||
<strong>{socialTx("地图摘要")}</strong>
|
||||
<p>{socialTx("热门城市聚合 · 不暴露精确位置")}</p>
|
||||
<div className="social-map-teaser-chips">
|
||||
{[
|
||||
socialTx("清迈"),
|
||||
socialTx("巴厘岛"),
|
||||
socialTx("大理"),
|
||||
socialTx("里斯本"),
|
||||
socialTx("成都"),
|
||||
].map((name) => (
|
||||
<span key={name}>{name}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{liveOk ? (
|
||||
<Link href={socialPath("/map")} className="btn btn-primary">
|
||||
{socialTx("打开地图")}
|
||||
<ArrowUpRight size={15} aria-hidden />
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={openJoin}
|
||||
>
|
||||
{socialTx("去完善")}
|
||||
<ArrowUpRight size={15} aria-hidden />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<CityDirectory compact limit={6} />
|
||||
<div className="social-section-actions reveal">
|
||||
<Link href={socialPath("/coffeechat")} className="btn btn-primary">
|
||||
{socialTx("线下咖啡聊")}
|
||||
</Link>
|
||||
<Link href={socialPath("/places")} className="btn btn-ghost">
|
||||
{socialTx("逛城市")}
|
||||
</Link>
|
||||
<Link
|
||||
href={socialPath("/places")}
|
||||
className="btn btn-ghost"
|
||||
>
|
||||
{socialTx("咖啡馆见面")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="team"
|
||||
aria-label={socialTx("一起做点事")}
|
||||
>
|
||||
<div className="container">
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="team" />
|
||||
<span className="section-tag">
|
||||
<span>{socialTx("找搭子")}</span>
|
||||
<span>{socialTx("共创")}</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
🚀
|
||||
</span>
|
||||
{landingCopy.socialTeamTitle}
|
||||
</h2>
|
||||
<p>
|
||||
{socialTx(
|
||||
"有人在找帮手;也有人一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="social-together-tabs reveal" role="tablist">
|
||||
<Link
|
||||
href={socialPath("/team")}
|
||||
className="is-on"
|
||||
role="tab"
|
||||
aria-selected="true"
|
||||
>
|
||||
{socialTx("找搭子")}
|
||||
</Link>
|
||||
<Link href={socialPath("/ebook")} role="tab" aria-selected="false">
|
||||
{socialTx("共创")}
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="social-panel-grid social-panel-grid-3">
|
||||
{gigs.slice(0, 3).map((g, i) => (
|
||||
<Link
|
||||
key={g.id}
|
||||
href={socialPath(`/team#${g.id}`)}
|
||||
className="social-panel social-panel-fx connection-team reveal is-clickable"
|
||||
style={{ ["--stagger" as string]: `${i * 60}ms` }}
|
||||
>
|
||||
<div className="social-panel-ico" aria-hidden>
|
||||
{ROLE_EMOJI[g.kind || "parttime"] || "📝"}
|
||||
</div>
|
||||
<div className="social-panel-meta">
|
||||
<span>{TEAM_KIND_LABEL[g.kind || "parttime"]}</span>
|
||||
<span>{g.remote ? "线上也能做" : "可以见面做"}</span>
|
||||
</div>
|
||||
<h3>{g.title}</h3>
|
||||
<p>{g.pay}</p>
|
||||
<div className="social-panel-foot">
|
||||
{(g.tags || []).slice(0, 3).map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="social-ugc-row reveal">
|
||||
{SEED_EBOOKS.slice(0, 2).map((book) => (
|
||||
<Link
|
||||
key={book.id}
|
||||
href={socialPath("/ebook")}
|
||||
className="social-ugc-card"
|
||||
>
|
||||
<span className="social-ugc-ico" aria-hidden>
|
||||
<BookOpen size={20} />
|
||||
</span>
|
||||
<div>
|
||||
<em>{socialTx("共创 · 小册")}</em>
|
||||
<strong>{book.title}</strong>
|
||||
<p>{book.blurb}</p>
|
||||
</div>
|
||||
<ArrowUpRight size={16} />
|
||||
</Link>
|
||||
))}
|
||||
{SEED_VIDEOS.slice(0, 2).map((vid) => (
|
||||
<Link
|
||||
key={vid.id}
|
||||
href={socialPath("/videos")}
|
||||
className="social-ugc-card is-video"
|
||||
>
|
||||
<span className="social-ugc-ico" aria-hidden>
|
||||
{vid.coverEmoji}
|
||||
</span>
|
||||
<div>
|
||||
<em>{socialTx("共创 · 视频")}</em>
|
||||
<strong>{vid.title}</strong>
|
||||
<p>
|
||||
{vid.city} · {vid.minutes} 分钟
|
||||
</p>
|
||||
</div>
|
||||
<ArrowUpRight size={16} />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="social-section-actions reveal">
|
||||
<Link href={socialPath("/team")} className="btn btn-ghost">
|
||||
{socialTx("更多机会")}
|
||||
</Link>
|
||||
<Link href={socialPath("/ebook")} className="btn btn-ghost">
|
||||
{socialTx("逛共创")}
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost"
|
||||
onClick={openJoin}
|
||||
>
|
||||
{t.joinCommunity}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{!loggedIn ? (
|
||||
<section
|
||||
className="connection-invite container"
|
||||
aria-label={t.joinCommunity}
|
||||
>
|
||||
<div className="connection-invite-orbit" aria-hidden="true">
|
||||
<span />
|
||||
<span />
|
||||
<Sparkles size={52} strokeWidth={1} />
|
||||
</div>
|
||||
<div>
|
||||
<span className="connection-eyebrow">{t.joinCommunity}</span>
|
||||
<h2>{landingCopy.socialInviteTitle}</h2>
|
||||
<p>{landingCopy.socialInviteLead}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="btn connection-join"
|
||||
onClick={openJoin}
|
||||
>
|
||||
{socialTx("加入游民社区")} <ArrowUpRight size={19} />
|
||||
</button>
|
||||
</section>
|
||||
) : null}
|
||||
</main>
|
||||
|
||||
<footer className="footer social-home-footer">
|
||||
<div className="container">
|
||||
<div className="footer-grid footer-grid-rings">
|
||||
<div className="footer-brand">
|
||||
<SocialBrandLogo />
|
||||
<p>{socialTx("认识同频的人 · 开视频聊聊 · 出来见一面 · 一起做点事")}</p>
|
||||
</div>
|
||||
<div className="footer-links footer-links-primary">
|
||||
<h4>{socialTx("认识人")}</h4>
|
||||
<button
|
||||
type="button"
|
||||
className="social-footer-link"
|
||||
onClick={openJoin}
|
||||
>
|
||||
{t.joinCommunity}
|
||||
</button>
|
||||
<Link href={socialPath("/people")}>{socialTx("想见的人")}</Link>
|
||||
<Link href={socialPath("/date")}>{socialTx("约会")}</Link>
|
||||
<Link href={socialPath("/meetup")}>{socialTx("语音厅")}</Link>
|
||||
<Link href={socialPath("/chat")}>{socialTx("大家聊天")}</Link>
|
||||
</div>
|
||||
<div className="footer-links footer-links-secondary">
|
||||
<h4>{socialTx("见面 · 做事")}</h4>
|
||||
<Link href={socialPath("/places")}>{socialTx("城市")}</Link>
|
||||
<Link href={socialPath("/team")}>{socialTx("找搭子")}</Link>
|
||||
<Link href={socialPath("/ebook")}>{socialTx("共创")}</Link>
|
||||
<Link href={socialPath("/feedback")}>{socialTx("说说想法")}</Link>
|
||||
</div>
|
||||
<div className="footer-links footer-links-more">
|
||||
<h4>{socialTx("更多")}</h4>
|
||||
<Link href={socialPath("/skills")}>{socialTx("技能交换")}</Link>
|
||||
<Link href={socialPath("/coffeechat")}>
|
||||
{socialTx("线下咖啡聊")}
|
||||
</Link>
|
||||
<Link href={socialPath("/wrapped")}>{socialTx("年度回顾")}</Link>
|
||||
<Link href="/portal">{socialTx("门户首页")}</Link>
|
||||
<Link href="/nav">{socialTx("出海导航")}</Link>
|
||||
<Link href="/community">{socialTx("旅居社群")}</Link>
|
||||
<Link href="/book">{socialTx("数字游民小册")}</Link>
|
||||
<Link href={socialPath("/blog")}>{socialTx("博客")}</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="home-wrapped-strip">
|
||||
<span>{socialTx("回看这一年的足迹与遇见")}</span>
|
||||
<Link href={socialPath("/wrapped")} className="btn btn-ghost btn-sm">
|
||||
{socialTx("年度回顾")} <ArrowUpRight size={14} />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="footer-bottom social-home-footer-bottom">
|
||||
<p suppressHydrationWarning>
|
||||
© {new Date().getFullYear()} nomadro · {socialTx("游民社区")}
|
||||
</p>
|
||||
<div className="social-home-follow-row">
|
||||
<Link href={socialPath("/blog")}>{socialTx("博客")}</Link>
|
||||
{showXFollow ? (
|
||||
<a
|
||||
className="social-home-follow-x"
|
||||
href={xProfileUrl(DEFAULT_X_HANDLE)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={() =>
|
||||
trackFollow("click", {
|
||||
channel: "x",
|
||||
place: "social_home_footer",
|
||||
})
|
||||
}
|
||||
>
|
||||
<span aria-hidden>𝕏</span> Follow {formatXHandle()}
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="community-world" aria-label={tx("从线上问候,到真实相遇", "From a hello online to a real connection")}>
|
||||
<div className="community-world-grid" aria-hidden />
|
||||
<div className="community-world-orbit orbit-one" aria-hidden /><div className="community-world-orbit orbit-two" aria-hidden /><div className="community-world-orbit orbit-three" aria-hidden />
|
||||
<div className="community-world-center"><Globe2 size={82} strokeWidth={.65} /><span>same wavelength.</span><small>DIFFERENT COORDINATES</small></div>
|
||||
{roster.slice(0, 3).map((person, index) => <Link key={person.id} href={socialPath(`/people/${person.id}`)} className={`community-world-person person-${index}`}><SocialAvatar src={person.avatar} size={44} faceOk={person.faceOk} /><span><strong>{person.name}{person.example && <span className="people-card-example">{tx("示例", "Example")}</span>}</strong><small><MapPin size={11} />{person.city.split("·")[0].trim()}</small></span><ArrowUpRight size={14} /></Link>)}
|
||||
<Link className="community-world-coffee" href={socialPath("/coffeechat")}><span><Coffee size={22} /></span><div><strong>{tx("下一杯咖啡,和新朋友。", "Your next coffee. A new friend.")}</strong><small>{tx("给真实的相遇留点时间", "Make a little room for connection")}</small></div><ArrowUpRight size={16} /></Link>
|
||||
<div className="community-world-caption"><span><Waves size={14} />{tx("连接,不受坐标限制", "Connection goes beyond coordinates")}</span><span>01 — 03</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</SiteShell>
|
||||
</div>
|
||||
);
|
||||
<div className="container community-hero-foot"><a href="#discover"><ArrowDown size={14} />{tx("找到你的打开方式", "Find your way in")}</a><span>{tx("认识人 / 见一面 / 一起做事", "MEET PEOPLE / MEET IN PERSON / BUILD TOGETHER")}</span></div>
|
||||
</section>
|
||||
|
||||
{visible("discover") && <div id="discover"><HomeActionRail /></div>}
|
||||
|
||||
{visible("people") && navigationVisible(config, "/people") && <section className="container community-section" id="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"))}
|
||||
<div className="community-city-filters" role="group" aria-label={tx("按城市看朋友", "Find people by city")}>{["", ...Array.from(new Set(roster.map(p => p.city.split("·")[0].trim()))).slice(0, 5)].map(name => <button key={name} type="button" aria-pressed={city === name} onClick={() => setCity(name)}>{name ? tx(name) : tx("所有城市", "Everywhere")}</button>)}</div>
|
||||
<div className="community-people-grid">{people.map(person => <article className="community-person-card" key={person.id}><div className="community-person-top"><SocialAvatar src={person.avatar} faceOk={person.faceOk} size={56} lazy /><button type="button" className="community-follow" aria-pressed={Boolean(likes[person.id])} aria-label={likes[person.id] ? tx(`取消关注 ${person.name}`, `Unfollow ${person.name}`) : tx(`关注 ${person.name}`, `Follow ${person.name}`)} onClick={() => setRosterLike(person.id, !likes[person.id])}>{likes[person.id] ? <Check size={17} /> : <Users size={17} />}</button></div><Link href={socialPath(`/people/${person.id}`)}><h3>{person.name}{person.example && <span className="people-card-example">{tx("示例", "Example")}</span>}</h3><p className="community-person-title">{tx(person.title)}</p><span className="community-person-city"><MapPin size={12} />{tx(person.city)}</span><p className="community-person-want">{tx(person.lookingFor)}</p><span className="community-person-tags">{person.tags.slice(0, 2).map(tag => <span key={tag}>{tx(tag)}</span>)}</span><span className="community-person-link">{tx("看看介绍", "Get to know them")}<ArrowUpRight size={15} /></span></Link></article>)}</div>
|
||||
<p className="community-data-note">{tx("标注「示例」的资料用于体验浏览;真实成员以公开资料为准。关注保存在当前设备。", "Profiles marked “Example” let you explore the experience. Real members appear with their published details. Follows stay on this device.")} <Link href={socialPath("/roster")}>{tx("写下我的介绍", "Add your introduction")}<ArrowUpRight size={12} /></Link></p>
|
||||
</section>}
|
||||
|
||||
{visible("cities") && navigationVisible(config, "/places") && <section className="community-cities-section" id="cities"><div className="container community-section">
|
||||
{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"))}
|
||||
<div className="community-city-grid">{cities.map(item => <Link key={item.id} className="community-city-card" href={socialPath(`/places/${item.id}`)}><div className="community-city-image" style={item.cover ? { backgroundImage: `url(${item.cover})` } : undefined}><span>{item.emoji} {tx(item.country)}</span><ArrowUpRight size={19} /></div><div><h3>{tx(item.name)}</h3><p>{tx(item.vibe)}</p></div></Link>)}</div>
|
||||
<div className="community-coffee-band"><span className="community-band-icon"><Coffee size={27} strokeWidth={1.5} /></span><div><h3>{tx("一杯咖啡的时间,刚刚好。", "A coffee’s worth of time. A world of possibility.")}</h3><p>{tx("看看主理人的话题和可预约时间,找到聊得来的那个人。", "Find a host, pick a topic, and choose a time that works for you.")}</p></div><Link className="social-btn" href={socialPath("/coffeechat")}>{tx("约杯咖啡", "Find a coffee chat")}<ArrowUpRight size={16} /></Link></div>
|
||||
</div></section>}
|
||||
|
||||
{visible("meetup") && navigationVisible(config, "/meetup") && <section className="container community-section" id="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"))}
|
||||
<div className="community-conversation-grid"><Link className="community-chat-feature" href={socialPath("/chat")}><span className="community-feature-mark"><MessageCircle size={25} /></span><p className="community-kicker">OPEN CONVERSATION</p><h3>{tx("在路上,也有个地方聊聊。", "A place to talk, wherever you are.")}</h3><p>{tx("聊城市、聊近况、问个小问题。从公开聊天开始认识彼此。", "Talk cities, share a little of your day, ask a question. Start in the community chat.")}</p><span className="community-feature-link">{tx("进入聊天群", "Join the conversation")}<ArrowUpRight size={17} /></span><div className="community-chat-bubbles" aria-hidden><span>{tx("大家最近在哪座城?", "Where’s everyone these days?")}</span><span>{tx("下一站,想去看看海。", "Somewhere by the sea next.")} 🌊</span></div></Link>
|
||||
<div className="community-lounge-list">{catalog.meetups.slice(0, 3).map((event, index) => <Link key={event.id} href={socialPath(`/meetup/${event.id}`)}><span className="community-lounge-icon"><Radio size={21} /></span><div><small>{tx("语音 · 视频", "VOICE · VIDEO")} / 0{index + 1}</small><h3>{tx(event.title)}</h3><p>{event.city === "Online" ? tx("线上相聚", "Meet online") : tx(event.city)} · {event.date || tx("时间待确认", "Schedule to follow")}</p></div><ArrowUpRight size={18} /></Link>)}<p className="community-data-note">{tx("进入后可自行选择麦克风与摄像头。", "Choose your microphone and camera settings when you join.")}</p></div>
|
||||
</div>
|
||||
</section>}
|
||||
|
||||
{visible("collaborate") && <section className="container community-section" id="team">
|
||||
{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"))}
|
||||
<div className="community-build-grid">{[
|
||||
{ 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 => <Link key={item.href} className={`community-build-card ${item.tone}`} href={socialPath(item.href)}><item.Icon size={29} strokeWidth={1.4} /><span>{item.text}</span><h3>{item.title}</h3><p>{item.description}</p><ArrowUpRight size={20} /></Link>)}</div>
|
||||
</section>}
|
||||
|
||||
{visible("faq") && <section className="container community-faq" id="faq"><div><p className="community-kicker">A LITTLE GOOD TO KNOW</p><h2>{tx("来之前,你可能想知道。", "A few things you might be wondering.")}</h2><Link className="community-text-link" href={socialPath("/feedback")}>{tx("还有问题?聊聊想法", "Something else on your mind?")}<ArrowUpRight size={16} /></Link></div><div>{[
|
||||
[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]) => <details key={question}><summary>{question}<span aria-hidden>+</span></summary><p>{answer}</p></details>)}</div></section>}
|
||||
|
||||
<section className="container community-invite"><div><span className="community-kicker">YOUR NEXT CHAPTER</span><h2>{landing.socialInviteTitle}</h2><p>{landing.socialInviteLead}</p></div><button className="social-btn primary" type="button" onClick={openJoin}>{t.joinCommunity}<ArrowUpRight size={18} /></button><Compass className="community-invite-compass" size={190} strokeWidth={.5} aria-hidden /></section>
|
||||
</main>
|
||||
<SocialFooter />
|
||||
</SiteShell>
|
||||
</div>;
|
||||
}
|
||||
|
||||
@ -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: () => <div className="social-map-canvas social-map-canvas--skeleton" />,
|
||||
});
|
||||
const SocialGlobe3D = dynamic(() => import("./SocialGlobe3D"), {
|
||||
ssr: false,
|
||||
loading: () => <div className="sm-globe sm-globe--skeleton" />,
|
||||
});
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
import { getSocialLive } from "@social/lib/socialLive";
|
||||
|
||||
const SocialMapCanvas = dynamic(() => import("./SocialMapCanvas"), { ssr: false, loading: () => <div className="social-map-canvas--skeleton" role="status">Loading map…</div> });
|
||||
const SocialGlobe3D = dynamic(() => import("./SocialGlobe3D"), { ssr: false, loading: () => <div className="sm-globe--skeleton" role="status">Loading globe…</div> });
|
||||
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<Mode>(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<SocialMapCity[]>(seedCities);
|
||||
const [selectedId, setSelectedId] = useState<string | null>(cityParam);
|
||||
const [selectedPersonId, setSelectedPersonId] = useState<string | null>(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 (
|
||||
<SiteShell title={socialTx("地图")} immersive>
|
||||
<div
|
||||
className={`sm-discover${effectiveMode === "globe" ? " is-globe" : " is-flat"}${isH5 ? " is-h5" : ""}`}
|
||||
>
|
||||
<div className="sm-discover-stage">
|
||||
{effectiveMode === "globe" ? (
|
||||
<SocialGlobe3D
|
||||
cities={cities}
|
||||
people={people}
|
||||
selectedId={selectedId}
|
||||
onSelectCity={(c) => {
|
||||
setSelectedId(c.id);
|
||||
setSelectedPersonId(null);
|
||||
}}
|
||||
onSelectPerson={onSelectPerson}
|
||||
/>
|
||||
) : (
|
||||
<SocialMapCanvas
|
||||
cities={cities}
|
||||
people={people}
|
||||
selectedId={selectedId}
|
||||
selectedPersonId={selectedPersonId}
|
||||
onSelectCity={(c) => {
|
||||
setSelectedId(c.id);
|
||||
setSelectedPersonId(null);
|
||||
}}
|
||||
onSelectPerson={onSelectPerson}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="sm-discover-ui">
|
||||
{effectiveMode === "flat" && !isH5 ? (
|
||||
<div className="sm-discover-hero">
|
||||
<p className="sm-discover-kicker">
|
||||
{offline ? "离线种子 · 模糊位置" : "同频游民 · 全球发现"}
|
||||
</p>
|
||||
<h1>
|
||||
Nomadro<span>Map</span>
|
||||
</h1>
|
||||
<p className="sm-discover-lead">深色底图 · 点脉冲飞到城市</p>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="sm-discover-topbar">
|
||||
{isH5 ? null : effectiveMode === "flat" ? (
|
||||
<label className="sm-discover-search">
|
||||
<Search size={16} aria-hidden />
|
||||
<input
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="搜城市 / 国家"
|
||||
aria-label="搜索城市"
|
||||
/>
|
||||
</label>
|
||||
) : (
|
||||
<p className="sm-globe-title">
|
||||
Nomadro<span>Globe</span>
|
||||
</p>
|
||||
)}
|
||||
{!isH5 ? (
|
||||
<div className="sm-mode-switch" role="tablist" aria-label="地图模式">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={effectiveMode === "flat"}
|
||||
className={effectiveMode === "flat" ? "is-on" : ""}
|
||||
onClick={() => switchMode("flat")}
|
||||
>
|
||||
<MapIcon size={15} aria-hidden />
|
||||
平面
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={effectiveMode === "globe"}
|
||||
className={effectiveMode === "globe" ? "is-on" : ""}
|
||||
onClick={() => switchMode("globe")}
|
||||
>
|
||||
<Box size={15} aria-hidden />
|
||||
立体
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* H5:点中城市时浮层卡片,不占目录底栏 */}
|
||||
{isH5 && (selected || selectedPerson) ? (
|
||||
<div className="sm-h5-sheet" role="dialog" aria-label="城市">
|
||||
{selectedPerson ? (
|
||||
<article className="sm-rail-card sm-rail-person">
|
||||
<button
|
||||
type="button"
|
||||
className="sm-rail-close"
|
||||
aria-label="关闭"
|
||||
onClick={() => setSelectedPersonId(null)}
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
<div className="sm-rail-person-head">
|
||||
<SocialAvatar
|
||||
src={selectedPerson.avatar}
|
||||
size={56}
|
||||
faceOk={selectedPerson.faceOk}
|
||||
/>
|
||||
<div>
|
||||
<h2>{selectedPerson.name}</h2>
|
||||
<p>{selectedPerson.title}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="sm-rail-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/people/${selectedPerson.id}`)}
|
||||
>
|
||||
看看介绍 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
) : selected ? (
|
||||
<article className="sm-rail-card">
|
||||
<button
|
||||
type="button"
|
||||
className="sm-rail-close"
|
||||
aria-label="关闭"
|
||||
onClick={() => {
|
||||
setSelectedId(null);
|
||||
setSelectedPersonId(null);
|
||||
}}
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
<h2>
|
||||
{selected.emoji} {selected.name}
|
||||
<span>{selected.country}</span>
|
||||
</h2>
|
||||
<div className="sm-rail-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(
|
||||
`/people?city=${encodeURIComponent(selected.name)}`,
|
||||
)}
|
||||
>
|
||||
想见的人
|
||||
</Link>
|
||||
<Link
|
||||
className="social-btn"
|
||||
href={socialPath(`/places/${selected.id}`)}
|
||||
>
|
||||
详情
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{showRail ? (
|
||||
<aside className="sm-discover-rail" aria-label="发现面板">
|
||||
{selectedPerson ? (
|
||||
<article className="sm-rail-card sm-rail-person">
|
||||
<button
|
||||
type="button"
|
||||
className="sm-rail-close"
|
||||
aria-label="关闭"
|
||||
onClick={() => setSelectedPersonId(null)}
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
<div className="sm-rail-person-head">
|
||||
<SocialAvatar
|
||||
src={selectedPerson.avatar}
|
||||
size={72}
|
||||
faceOk={selectedPerson.faceOk}
|
||||
/>
|
||||
<div>
|
||||
<h2>
|
||||
{selectedPerson.name}
|
||||
{selectedPerson.verified ? <em>✓</em> : null}
|
||||
</h2>
|
||||
<p>{selectedPerson.title}</p>
|
||||
<span className="sm-rail-route">{selectedPerson.routeLabel}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p className="sm-rail-meta">
|
||||
<MapPin size={14} aria-hidden />
|
||||
{selectedPerson.cityName} · 近似位置
|
||||
</p>
|
||||
<div className="sm-rail-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/people/${selectedPerson.id}`)}
|
||||
>
|
||||
看看介绍 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => switchMode("flat")}
|
||||
>
|
||||
平面定位
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
) : null}
|
||||
|
||||
{selected ? (
|
||||
<article className="sm-rail-card">
|
||||
<button
|
||||
type="button"
|
||||
className="sm-rail-close"
|
||||
aria-label="清除城市"
|
||||
onClick={() => {
|
||||
setSelectedId(null);
|
||||
setSelectedPersonId(null);
|
||||
}}
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
<p className="sm-rail-emoji">{selected.emoji}</p>
|
||||
<h2>
|
||||
{selected.name}
|
||||
<span>{selected.country}</span>
|
||||
</h2>
|
||||
{selected.vibe ? <p className="sm-rail-vibe">{selected.vibe}</p> : null}
|
||||
<ul className="sm-rail-stats">
|
||||
<li>
|
||||
<Users size={15} /> {selected.memberCount}
|
||||
</li>
|
||||
<li>
|
||||
<Radio size={15} /> {selected.meetupCount || 0} 局
|
||||
</li>
|
||||
</ul>
|
||||
<div className="sm-rail-faces">
|
||||
{cityPeople.slice(0, 6).map((p) => (
|
||||
<button
|
||||
key={p.id}
|
||||
type="button"
|
||||
className={selectedPersonId === p.id ? "is-on" : ""}
|
||||
onClick={() => onSelectPerson(p)}
|
||||
title={p.name}
|
||||
>
|
||||
<SocialAvatar
|
||||
src={p.avatar}
|
||||
size={40}
|
||||
faceOk={p.faceOk}
|
||||
/>
|
||||
</button>
|
||||
))}
|
||||
{!cityPeople.length ? (
|
||||
<span className="sm-rail-empty">这座城还没有示例头像点</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="sm-rail-actions">
|
||||
{effectiveMode === "globe" ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={() => {
|
||||
setSelectedId(selected.id);
|
||||
switchMode("flat");
|
||||
}}
|
||||
>
|
||||
平面放大看人
|
||||
</button>
|
||||
) : (
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(
|
||||
`/people?city=${encodeURIComponent(selected.name)}`,
|
||||
)}
|
||||
>
|
||||
想见的人
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
className="social-btn"
|
||||
href={socialPath(`/places/${selected.id}`)}
|
||||
>
|
||||
城市详情
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
) : (
|
||||
<article className="sm-rail-card">
|
||||
<h2>热门城市</h2>
|
||||
<p className="sm-rail-vibe">
|
||||
{effectiveMode === "globe"
|
||||
? "拖动旋转 · 点头像选城"
|
||||
: "点脉冲圈飞过去"}
|
||||
</p>
|
||||
<ul className="sm-rail-hot">
|
||||
{filteredCities.map((c) => (
|
||||
<li key={c.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setSelectedId(c.id);
|
||||
if (effectiveMode === "globe") switchMode("flat");
|
||||
}}
|
||||
>
|
||||
<span>
|
||||
{c.emoji} {c.name}
|
||||
</span>
|
||||
<em>{c.memberCount}</em>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<Link className="social-btn" href={socialPath("/places")}>
|
||||
全部城市目录
|
||||
</Link>
|
||||
</article>
|
||||
)}
|
||||
|
||||
<p className="sm-rail-privacy">头像点城市级抖动 · 不展示精确 GPS</p>
|
||||
</aside>
|
||||
) : null}
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
return <SiteShell title={tx("地图", "Community map")}>
|
||||
<PageIntro title={tx("世界很大,同频不远", "A world of connection")} accent={tx("从一座城开始", "Start with a city")} description={tx("看看下一站,找到同城朋友与适合见面的地方。地图只展示城市级近似位置。", "Explore your next stop, find people nearby and discover a place to meet. Locations are approximate, at city level.")}><Link className="social-btn" href={socialPath("/places")}>{tx("城市目录", "City guide")}<ArrowUpRight size={15} /></Link></PageIntro>
|
||||
<div className="community-map-toolbar"><SearchField label={tx("搜索城市", "Search cities")} placeholder={tx("城市、国家或下一站…", "City, country or your next stop…")} value={query} onChange={setQuery} /><div className="community-map-modes" role="group" aria-label={tx("地图模式", "Map view")}><button type="button" aria-pressed={mode === "flat"} onClick={() => update("mode", "")}><MapIcon size={16} />{tx("平面", "Map")}</button><button type="button" aria-pressed={mode === "globe"} onClick={() => update("mode", "globe")}><Box size={16} />{tx("立体", "Globe")}</button></div></div>
|
||||
<div className="community-map-layout"><div className="community-map-stage">{mode === "globe" ? <SocialGlobe3D {...mapProps} onSelectPerson={pin => update("city", pin.cityId)} /> : <SocialMapCanvas {...mapProps} onSelectPerson={pin => router.push(socialPath(`/people/${pin.id}`))} />}
|
||||
{selected && <article className="community-map-selection"><button type="button" aria-label={tx("清除城市", "Clear city")} onClick={() => update("city", "")}><X size={17} /></button><span>{selected.emoji}</span><div><h2>{tx(selected.name)}</h2><p>{tx(selected.country)}</p></div><Link href={socialPath(`/places/${selected.id}`)}>{tx("探索", "Explore")}<ArrowUpRight size={15} /></Link></article>}
|
||||
</div><aside className="community-map-directory" aria-label={tx("地图城市目录", "Map cities")}><div className="community-map-directory-head"><h2>{query ? tx("搜索结果", "Search results") : tx("从这里出发", "Find your next stop")}</h2><span role="status">{filtered.length} {tx("座城市", "cities")}</span></div>{filtered.map(city => <button key={city.id} type="button" aria-pressed={selectedId === city.id} onClick={() => update("city", city.id)}><span className="community-map-city-emoji">{city.emoji}</span><span><strong>{tx(city.name)}</strong><small>{tx(city.country)}</small></span><MapPin size={15} /></button>)}{!filtered.length && <EmptyState emoji="⌕" title={tx("暂时没有这座城", "No matching city")} description={tx("换个关键词,或看看全部城市。", "Try another keyword or explore all cities.")}><button className="social-btn" type="button" onClick={() => setQuery("")}>{tx("清空搜索", "Clear search")}</button></EmptyState>}</aside></div>
|
||||
<p className="community-data-note">{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.")}</p>
|
||||
</SiteShell>;
|
||||
}
|
||||
|
||||
export default function MapClient() {
|
||||
return (
|
||||
<Suspense fallback={<div className="social-status">加载地图…</div>}>
|
||||
<MapClientInner />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
export default function MapClient() { return <Suspense fallback={<div className="social-status">Loading map…</div>}><MapClientInner /></Suspense>; }
|
||||
|
||||
@ -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 (
|
||||
<PeopleDirectory
|
||||
key={`${initialQuery}-${initialHere}-${initialSoon}`}
|
||||
initialQuery={initialQuery}
|
||||
initialHere={initialHere}
|
||||
initialSoon={initialSoon}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
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<Filters>(() => 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<Record<keyof Filters, string>> = { 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 (
|
||||
<SiteShell title={socialTx("想见的人")}>
|
||||
<PageIntro title={socialTx("想见的人")} accent="认识新朋友">
|
||||
<div className="social-actions">
|
||||
<DemoBadge>{list.length} 位</DemoBadge>
|
||||
<Link className="social-btn social-btn-ghost" href={socialPath("/map")}>
|
||||
地图
|
||||
</Link>
|
||||
</div>
|
||||
</PageIntro>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label={socialTx("搜索")}
|
||||
placeholder={socialTx("城市 / 名字 / 兴趣")}
|
||||
/>
|
||||
<div className="social-filters" aria-label={socialTx("筛选")}>
|
||||
{[
|
||||
{ id: "all", title: "全部" },
|
||||
{ id: "online", title: "示例在线" },
|
||||
{ id: "saved", title: "我关注的" },
|
||||
].map((f) => (
|
||||
<button
|
||||
key={f.id}
|
||||
className={filter === f.id ? "active" : ""}
|
||||
aria-pressed={filter === f.id}
|
||||
onClick={() => setFilter(f.id)}
|
||||
>
|
||||
{f.title}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-people-geo-filters" aria-label="地理与兴趣">
|
||||
<label>
|
||||
城市
|
||||
<select
|
||||
value={query && SOCIAL_CITIES.some((c) => c.name === query) ? query : ""}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
>
|
||||
<option value="">全部城市</option>
|
||||
{SOCIAL_CITIES.map((c) => (
|
||||
<option key={c.id} value={c.name}>
|
||||
{c.emoji} {c.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
职业
|
||||
<select value={profession} onChange={(e) => setProfession(e.target.value)}>
|
||||
<option value="">不限</option>
|
||||
{PROFESSION_HINTS.map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{p}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
兴趣
|
||||
<select value={interest} onChange={(e) => setInterest(e.target.value)}>
|
||||
<option value="">不限</option>
|
||||
{INTEREST_HINTS.map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{p}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
语言
|
||||
<select value={language} onChange={(e) => setLanguage(e.target.value)}>
|
||||
<option value="">不限</option>
|
||||
{LANG_HINTS.map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{p}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className={currentlyHere ? "active" : ""}
|
||||
aria-pressed={currentlyHere}
|
||||
onClick={() => {
|
||||
setCurrentlyHere((v) => !v);
|
||||
if (!currentlyHere) setArrivingSoon(false);
|
||||
}}
|
||||
>
|
||||
Currently Here
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={arrivingSoon ? "active" : ""}
|
||||
aria-pressed={arrivingSoon}
|
||||
onClick={() => {
|
||||
setArrivingSoon((v) => !v);
|
||||
if (!arrivingSoon) setCurrentlyHere(false);
|
||||
}}
|
||||
>
|
||||
Arriving Soon
|
||||
</button>
|
||||
</div>
|
||||
return <SiteShell title={tx("想见的人", "People")}>
|
||||
<PageIntro title={tx("想见的人", "Find your people")} accent={tx("从一句你好开始", "Start with a hello")} description={tx("城市、兴趣或正在做的事,都是认识彼此的好开场。", "A city, a shared interest, or a project you love. Find a little common ground.")}>
|
||||
<Link className="social-btn" href={socialPath("/roster")}><Sparkles size={15} />{tx("写我的介绍", "Add my introduction")}</Link>
|
||||
</PageIntro>
|
||||
<div className="social-toolbar people-toolbar">
|
||||
<div className="people-toolbar-top"><SearchField value={filters.q} onChange={value => update("q", value)} label={tx("搜索朋友", "Search people")} placeholder={tx("名字、城市、技能或兴趣", "Name, city, skill or interest")} />
|
||||
<label className="people-select">{tx("城市", "City")}<select value={filters.city} onChange={event => update("city", event.target.value)}><option value="">{tx("所有城市", "All cities")}</option>{filters.city && !cities.includes(filters.city) && <option value={filters.city}>{filters.city}</option>}{cities.map(city => <option key={city} value={city}>{tx(city)}</option>)}</select></label>
|
||||
<button className="social-btn people-refine" type="button" aria-expanded={expanded} aria-controls="people-refinements" onClick={() => setExpanded(!expanded)}><SlidersHorizontal size={15} />{tx("更多筛选", "Refine")}</button>
|
||||
</div>
|
||||
<ResultSummary
|
||||
count={list.length}
|
||||
unit="位朋友"
|
||||
filtered={filtered}
|
||||
onReset={reset}
|
||||
/>
|
||||
<div className="social-people-grid social-discovery-grid">
|
||||
{list.map((person, index) => (
|
||||
<Link
|
||||
key={person.id}
|
||||
href={socialPath(`/people/${person.id}`)}
|
||||
className={`social-people-chip social-chip-pop is-rich reveal${person.online ? " is-online" : ""}`}
|
||||
style={{ ["--stagger" as string]: `${Math.min(index, 12) * 40}ms` }}
|
||||
>
|
||||
<span className="social-people-chip-ava">
|
||||
<SocialAvatar
|
||||
src={person.avatar}
|
||||
size={52}
|
||||
lazy
|
||||
faceOk={person.faceOk}
|
||||
/>
|
||||
{person.online ? <i aria-hidden /> : null}
|
||||
</span>
|
||||
<strong>
|
||||
{person.name}
|
||||
{person.id === SELF_MEMBER_ID ? " · 我" : ""}
|
||||
</strong>
|
||||
<span className="connection-member-role">
|
||||
{person.title}
|
||||
{person.vibe ? ` · ${person.vibe.split("·")[0].trim()}` : ""}
|
||||
</span>
|
||||
<em>
|
||||
{person.city.split("·")[0].trim()}
|
||||
{person.tags[0] ? ` · ${person.tags[0]}` : ""}
|
||||
</em>
|
||||
<span className="social-people-chip-want" title={person.lookingFor}>
|
||||
{person.lookingFor}
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
{!list.length && (
|
||||
<EmptyState
|
||||
emoji="🌊"
|
||||
title={socialTx("暂时没找到")}
|
||||
description="换个城市或兴趣关键词试试,也可以清空筛选再看。"
|
||||
>
|
||||
<button className="social-btn" onClick={reset}>
|
||||
清空筛选
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
<div className="social-people-cta-bar">
|
||||
<Link className="social-btn primary" href={socialPath("/roster")}>
|
||||
<Sparkles size={16} />
|
||||
写我的介绍
|
||||
</Link>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
<div className="social-filters" aria-label={tx("查看范围", "People to show")}>{[["all", tx("所有朋友", "Everyone")], ["online", tx("在线", "Online")], ["saved", tx("我关注的", "Following")]].map(([id, label]) => <button key={id} type="button" aria-pressed={filters.view === id} className={filters.view === id ? "active" : ""} onClick={() => update("view", id)}>{label}</button>)}</div>
|
||||
{expanded && <div id="people-refinements" className="people-refinements">
|
||||
<label className="people-select">{tx("兴趣与技能", "Interests & skills")}<select value={filters.interest} onChange={event => update("interest", event.target.value)}><option value="">{tx("不限", "Any interest")}</option>{interests.map(interest => <option key={interest} value={interest}>{tx(interest)}</option>)}</select></label>
|
||||
<label className="people-select">{tx("语言", "Language")}<select value={filters.language} onChange={event => update("language", event.target.value)}><option value="">{tx("不限", "Any language")}</option>{languages.map(language => <option key={language}>{language}</option>)}</select></label>
|
||||
<label className="people-select">{tx("行程状态", "Travel plans")}<select value={filters.status} onChange={event => update("status", event.target.value)}><option value="">{tx("不限", "Any travel plan")}</option><option value="here">{tx("正在这里", "Currently here")}</option><option value="soon">{tx("即将到达", "Arriving soon")}</option></select></label>
|
||||
</div>}
|
||||
{active.length > 0 && <div className="people-filter-chips">{active.map(key => <button key={key} type="button" onClick={() => update(key, EMPTY[key])} aria-label={tx(`移除 ${chipLabels[key] || filters[key]}`, `Remove ${chipLabels[key] || filters[key]}`)}>{chipLabels[key] || tx(filters[key])}<X size={12} /></button>)}<button type="button" onClick={() => setFilters({ ...EMPTY })}>{tx("清空筛选", "Reset filters")}</button></div>}
|
||||
</div>
|
||||
<div className="people-results-bar"><p role="status" aria-live="polite">{list.length} {tx("位朋友", list.length === 1 ? "person" : "people")}</p><label className="people-sort">{tx("排序", "Sort")}<select aria-label={tx("排序", "Sort people")} value={filters.sort} onChange={event => update("sort", event.target.value)}><option value="recommended">{tx("为你发现", "Recommended")}</option><option value="online">{tx("在线优先", "Online first")}</option><option value="name">{tx("按名字", "Name")}</option></select></label></div>
|
||||
<div className="people-card-grid social-discovery-grid">{list.map(person => <article className="people-connection-card" key={person.id}>
|
||||
<div className="people-card-top"><Link href={socialPath(`/people/${person.id}`)} aria-label={tx(`查看 ${person.name} 的介绍`, `View ${person.name}'s profile`)}><SocialAvatar src={person.avatar} size={56} lazy faceOk={person.faceOk} /></Link><div><h2><Link href={socialPath(`/people/${person.id}`)}>{person.name}</Link>{person.example && <span className="people-card-example">{tx("示例", "Example")}</span>}</h2><p>{tx(person.title)}</p><span><MapPin size={12} />{tx(person.city)}</span></div><button type="button" className="people-follow-button" aria-pressed={Boolean(likes[person.id])} aria-label={likes[person.id] ? tx(`取消关注 ${person.name}`, `Unfollow ${person.name}`) : tx(`关注 ${person.name}`, `Follow ${person.name}`)} onClick={() => setRosterLike(person.id, !likes[person.id])}>{likes[person.id] ? <Check size={17} /> : <Users size={17} />}</button></div>
|
||||
<p className="people-card-bio">{tx(person.bio)}</p><p className="people-card-looking"><Sparkles size={13} />{tx(person.lookingFor)}</p>
|
||||
<div className="people-card-tags">{person.tags.slice(0, 4).map(tag => <button key={tag} type="button" onClick={() => update("interest", tag)}>{tx(tag)}</button>)}</div>
|
||||
{(isHere(person.status) || isSoon(person.status)) && <span className="people-card-status"><MapPin size={12} />{isHere(person.status) ? tx("正在这里", "Currently here") : tx("即将到达", "Arriving soon")}</span>}
|
||||
<div className="people-card-bottom"><span>{person.languages?.slice(0, 2).join(" · ") || tx("自在交流", "Find common ground")}</span><Link href={socialPath(`/people/${person.id}`)}>{tx("看看介绍", "View profile")}<ArrowUpRight size={14} /></Link></div>
|
||||
</article>)}</div>
|
||||
{!list.length && <EmptyState emoji="👋" title={filters.view === "saved" ? tx("把想认识的人,留在这里。", "Keep your kind of people close.") : tx("还没找到合适的朋友", "No one matches just yet")} description={tx("试试其他城市或兴趣,也可以先写下自己的介绍。", "Try another city or interest, or start with an introduction of your own.")}><button type="button" className="social-btn primary" onClick={() => setFilters({ ...EMPTY })}>{tx("看看所有朋友", "Explore everyone")}</button><Link className="social-btn" href={socialPath("/roster")}>{tx("写我的介绍", "Introduce yourself")}</Link></EmptyState>}
|
||||
<p className="community-data-note">{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.")}</p>
|
||||
</SiteShell>;
|
||||
}
|
||||
|
||||
@ -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("看这座城")}
|
||||
</Link>
|
||||
<Link className="sp-btn" href={socialPath("/map")}>
|
||||
<Link className="sp-btn" href={socialPath(`/people?city=${encodeURIComponent(activeCity.name)}`)}>
|
||||
{socialTx("想见的人")}
|
||||
</Link>
|
||||
<Link className="sp-btn" href={socialPath(`/map?city=${activeCity.id}`)}>
|
||||
{socialTx("打开地图")}
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@ -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<string[]>(`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<string, unknown> = { ...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} 分钟`,
|
||||
}));
|
||||
|
||||
@ -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<string[]>("saved-roles", []);
|
||||
const [active, setActive] = useState<SocialGig | null>(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({
|
||||
<span className="social-role-type">
|
||||
{TEAM_KIND_LABEL[gig.kind || "parttime"]}
|
||||
</span>
|
||||
<h2>{gig.title}</h2>
|
||||
<p>{gig.role}</p>
|
||||
<h2>{tx(gig.title)}</h2>
|
||||
<p>{tx(gig.role)}</p>
|
||||
<div className="social-role-meta">
|
||||
<span>
|
||||
<Globe2 size={13} />
|
||||
@ -365,13 +382,13 @@ export default function RoleBoard({
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
<div className="social-actions"><button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => setActive(gig)}
|
||||
onClick={() => selectRole(gig)}
|
||||
>
|
||||
{socialTx("我想参与")} <ArrowUpRight size={14} />
|
||||
</button>
|
||||
</button><ShareButton path={socialPath(`/team#${encodeURIComponent(gig.id)}`)} title={gig.title} /></div>
|
||||
</article>
|
||||
))}
|
||||
{!roles.length && (
|
||||
@ -398,8 +415,8 @@ export default function RoleBoard({
|
||||
)}
|
||||
</div>
|
||||
{active && (
|
||||
<SocialDialog title={socialTx("表达兴趣")} onClose={() => setActive(null)}>
|
||||
<ApplicationForm gig={active} />
|
||||
<SocialDialog title={socialTx("表达兴趣")} onClose={() => selectRole(null)}>
|
||||
<ApplicationForm key={active.id} gig={active} />
|
||||
</SocialDialog>
|
||||
)}
|
||||
</SiteShell>
|
||||
|
||||
@ -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<string | null>(null);
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const [scrolled, setScrolled] = useState(false);
|
||||
@ -188,10 +196,11 @@ export default function SiteShell({
|
||||
<SocialBrandLogo onClick={closeMenus} />
|
||||
|
||||
<div ref={menuPanelRef} id={menuId} className={`nav-links${menuOpen ? " open" : ""}`}>
|
||||
{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) => (
|
||||
<div
|
||||
key={g.id}
|
||||
className={`nav-group${openGroup === g.id ? " open" : ""}${g.items.some((item) => 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}
|
||||
<span className="nav-group-caret" aria-hidden>
|
||||
▾
|
||||
</span>
|
||||
<ChevronDown className="nav-group-caret" size={14} aria-hidden />
|
||||
</button>
|
||||
<div id={`${menuId}-${g.id}`} className="nav-group-panel">
|
||||
{g.items.map((item) => (
|
||||
<div className="nav-panel-heading"><span>{g.label}</span><small>{tx("用自己的节奏,找到连接", "Good connections start here")}</small></div>
|
||||
<div className="nav-panel-entries">{g.items.map((item) => { const detail = navigationDetail(item.href, locale); const Icon = detail.icon; return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={socialPath(item.href)}
|
||||
aria-current={
|
||||
pathname === socialPath(item.href) ? "page" : undefined
|
||||
routeMatches(pathname, socialPath(item.href)) ? "page" : undefined
|
||||
}
|
||||
onClick={closeMenus}
|
||||
>
|
||||
{item.label}
|
||||
<span className="nav-entry-icon"><Icon size={19} strokeWidth={1.7} /></span>
|
||||
<span className="nav-entry-copy"><strong>{item.label}</strong><small>{detail.description}</small></span>
|
||||
<ArrowUpRight className="nav-entry-arrow" size={15} aria-hidden />
|
||||
</Link>
|
||||
))}
|
||||
); })}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@ -263,6 +282,9 @@ export default function SiteShell({
|
||||
</div>
|
||||
|
||||
<div className="nav-actions">
|
||||
<SocialCommandMenu />
|
||||
<SocialLangSwitch />
|
||||
<button className="nav-icon-btn social-theme-toggle" type="button" onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")} aria-label={resolvedTheme === "dark" ? t.themeLight : t.themeDark}>{resolvedTheme === "dark" ? <Sun size={18} /> : <Moon size={18} />}</button>
|
||||
{session ? <NotifyBell onNavigate={closeMenus} /> : null}
|
||||
{session ? (
|
||||
<NavAccountMenu session={session} onCloseMenus={closeMenus} />
|
||||
@ -372,6 +394,7 @@ export default function SiteShell({
|
||||
<SocialQuickRail />
|
||||
<TrialNudgeBanner />
|
||||
{children}
|
||||
<SocialFooter />
|
||||
</main>
|
||||
</div>
|
||||
<SocialMobileDock />
|
||||
|
||||
@ -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<SkillItem[]>(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<string | null>(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<SkillItem[]>("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 (
|
||||
<SiteShell title={socialTx("技能交换")}>
|
||||
<PageIntro title={socialTx("技能交换 / 互助板")} accent="以物易物式互助">
|
||||
<p className="social-muted">
|
||||
{socialTx("教英语换拍视频、帮忙看代码换签证咨询——写清楚你能给什么、想换什么。")}
|
||||
</p>
|
||||
</PageIntro>
|
||||
|
||||
<form className="social-skills-compose social-panel" onSubmit={(ev) => void submit(ev)}>
|
||||
<h2>
|
||||
<Plus size={16} aria-hidden /> {socialTx("发一条互换")}
|
||||
</h2>
|
||||
<label>
|
||||
{socialTx("城市")}
|
||||
<input
|
||||
value={postCity}
|
||||
onChange={(e) => setPostCity(e.target.value)}
|
||||
placeholder={socialTx("清迈 / 线上")}
|
||||
maxLength={64}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{socialTx("我能提供")}
|
||||
<input
|
||||
required
|
||||
value={offer}
|
||||
onChange={(e) => setOffer(e.target.value)}
|
||||
placeholder={socialTx("英语陪练 / 代码 review / …")}
|
||||
maxLength={200}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{socialTx("想换到")}
|
||||
<input
|
||||
required
|
||||
value={want}
|
||||
onChange={(e) => setWant(e.target.value)}
|
||||
placeholder={socialTx("拍视频 / 签证咨询 / …")}
|
||||
maxLength={200}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{socialTx("补充说明")}
|
||||
<textarea
|
||||
rows={2}
|
||||
value={note}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
maxLength={800}
|
||||
placeholder={socialTx("时间、线上线下、期望频率…")}
|
||||
/>
|
||||
</label>
|
||||
{err ? (
|
||||
<p className="social-join-err" role="alert">
|
||||
{err}
|
||||
</p>
|
||||
) : null}
|
||||
<button type="submit" className="social-btn coral" disabled={busy}>
|
||||
{busy ? socialTx("发布中…") : socialTx("发布互换")}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="social-skills-filter">
|
||||
<MapPin size={14} aria-hidden />
|
||||
<input
|
||||
value={city}
|
||||
onChange={(e) => setCity(e.target.value)}
|
||||
placeholder={socialTx("按城市筛选")}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") void load(city);
|
||||
}}
|
||||
/>
|
||||
<button type="button" className="social-btn" onClick={() => void load(city)}>
|
||||
{socialTx("筛选")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="social-skills-grid">
|
||||
{items.map((item) => (
|
||||
<article key={item.id} className="social-skills-card">
|
||||
<header>
|
||||
<strong>{item.author}</strong>
|
||||
<span>
|
||||
<MapPin size={12} aria-hidden /> {item.city || socialTx("全球 / 线上")}
|
||||
</span>
|
||||
</header>
|
||||
<p className="social-skills-swap">
|
||||
<em>{item.offer}</em>
|
||||
<ArrowLeftRight size={14} aria-hidden />
|
||||
<em>{item.want}</em>
|
||||
</p>
|
||||
{item.note ? <p className="social-skills-note">{item.note}</p> : null}
|
||||
{item.guestId === me && item.id.startsWith("sk_") ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() =>
|
||||
void socialApi.closeSkill(item.id).then(() => load(city))
|
||||
}
|
||||
>
|
||||
{socialTx("关闭")}
|
||||
</button>
|
||||
) : null}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
return <SiteShell title={tx("技能交换", "Skill exchange")}>
|
||||
<PageIntro title={tx("技能交换", "Skill exchange")} accent={tx("把擅长,变成彼此的帮助", "Trade what you know")} description={tx("你能提供什么,又想学会什么?写下来,找到可以互相帮助的人。", "Share what you’re good at and what you’d love to learn. Find someone to grow with.")}><button type="button" className="social-btn primary" onClick={() => { setError(""); setOpen(true); }}><Plus size={16} />{tx("发布互换", "Post an exchange")}</button></PageIntro>
|
||||
<div className="social-toolbar"><SearchField value={query} onChange={setQuery} label={tx("搜索技能互换", "Search skill exchanges")} placeholder={tx("城市、技能或想学的事…", "City, skill or something to learn…")} /><div className="social-filters">{[["all", tx("全部互换", "All exchanges")], ["mine", tx("我的发布", "My exchanges")]].map(([key, label]) => <button key={key} type="button" aria-pressed={view === key} className={view === key ? "active" : ""} onClick={() => setView(key)}>{label}</button>)}</div></div>
|
||||
{message && <p className="social-status" role="status"><Check size={15} />{message}</p>}
|
||||
{offline && <p className="social-inline-notice" role="status">{tx("暂时无法更新,正在显示缓存或示例内容。", "Couldn’t refresh. Showing cached or example exchanges.")}<button className="social-save" type="button" disabled={loading} onClick={() => void load()}>{tx("重新加载", "Retry")}</button></p>}
|
||||
<p className="community-data-note" role="status">{loading ? tx("正在更新互换…", "Refreshing exchanges…") : `${list.length} ${tx("条互换", "exchanges")}`}</p>
|
||||
<div className="social-skills-grid">{list.map(item => <article key={item.id} className="social-skills-card"><header><strong>{item.author}{item.guestId === "seed" && <small className="people-card-example">{tx("示例", "Example")}</small>}</strong><span><MapPin size={12} />{tx(item.city) || tx("全球 / 线上", "Anywhere / online")}</span></header><div className="community-skill-swap"><div><small>{tx("我能提供", "I can offer")}</small><h2>{tx(item.offer)}</h2></div><ArrowLeftRight size={20} /><div><small>{tx("想换到", "I’d love to learn")}</small><h3>{tx(item.want)}</h3></div></div>{item.note && <p className="social-skills-note">{tx(item.note)}</p>}<div className="social-actions">{item.guestId === me ? <button className="social-btn" type="button" onClick={() => { setError(""); setCloseId(item.id); }}>{tx("关闭互换", "Close exchange")}</button> : <Link className="social-btn" href={socialPath(item.guestId === "seed" ? "/chat" : `/people/${item.guestId}`)}>{item.guestId === "seed" ? tx("去群里交流", "Meet the community") : tx("了解发布者", "Meet the author")}<ArrowUpRight size={14} /></Link>}</div></article>)}</div>
|
||||
{!list.length && <EmptyState title={tx("还没有匹配的互换", "No matching exchanges yet")} description={tx("试试其他关键词,或把你的擅长分享出来。", "Try another search or share a skill of your own.")}><button className="social-btn" type="button" onClick={() => { setQuery(""); setView("all"); }}>{tx("看看全部", "Explore all")}</button><button className="social-btn primary" type="button" onClick={() => setOpen(true)}>{tx("发布互换", "Post an exchange")}</button></EmptyState>}
|
||||
{open && <SocialDialog title={tx("分享你的擅长", "Share a skill")} onClose={() => { if (!busy) setOpen(false); }}><form className="social-form" onSubmit={event => void submit(event)}><fieldset className="social-fieldset" disabled={busy}>{([['city', tx("城市", "City"), 64], ['offer', tx("我能提供", "I can offer"), 200], ['want', tx("想换到", "I’d love to learn"), 200]] as const).map(([key, label, max]) => <label key={key}>{label}<input value={draft[key]} required={key !== 'city'} maxLength={max} onChange={event => update(key, event.target.value)} /></label>)}<label>{tx("补充说明", "A little more detail")}<textarea rows={4} maxLength={800} value={draft.note} onChange={event => update("note", event.target.value)} placeholder={tx("每周的时间、线上或线下、如何互相帮助…", "Availability, online or in person, and what a good exchange looks like…")} /></label></fieldset>{error && <p className="social-status warn" role="alert">{error}</p>}<button type="submit" className="social-btn primary" disabled={busy || !draft.offer.trim() || !draft.want.trim()}>{busy ? tx("发布中…", "Publishing…") : tx("发布互换", "Publish exchange")}</button><p className="community-data-note">{tx("草稿保存在当前设备,发布后才会对其他人展示。", "Drafts stay on this device. An exchange becomes public after publishing.")}</p></form></SocialDialog>}
|
||||
{closeId && <SocialDialog title={tx("关闭这条互换?", "Close this exchange?")} onClose={() => { if (!busy) setCloseId(null); }}><p>{tx("关闭后,它将从公开互助板移除。", "It will be removed from the public exchange board.")}</p>{error && <p role="alert" className="social-status warn">{error}</p>}<div className="social-actions"><button type="button" className="social-btn" disabled={busy} onClick={() => setCloseId(null)}>{tx("继续保留", "Keep it open")}</button><button type="button" className="social-btn primary" disabled={busy} onClick={() => void closeExchange()}>{busy ? tx("关闭中…", "Closing…") : tx("确认关闭", "Close exchange")}</button></div></SocialDialog>}
|
||||
</SiteShell>;
|
||||
}
|
||||
|
||||
47
src/modules/social/components/SocialCommandMenu.tsx
Normal file
47
src/modules/social/components/SocialCommandMenu.tsx
Normal file
@ -0,0 +1,47 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { ArrowUpRight, Search } from "lucide-react";
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
import { navigationDetail } from "@social/lib/navigation";
|
||||
import { navigationVisible } from "@social/lib/experience";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import { SocialDialog } from "./SocialUI";
|
||||
|
||||
export default function SocialCommandMenu() {
|
||||
const { t, tx, locale } = useSocialI18n();
|
||||
const config = useSocialConfig();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [query, setQuery] = useState("");
|
||||
const results = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k" && !document.querySelector("dialog[open]")) {
|
||||
event.preventDefault(); setQuery(""); setOpen(true);
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, []);
|
||||
const items = useMemo(() => t.navGroups.flatMap(group => group.items.map(item => ({ ...item, group: group.label, ...navigationDetail(item.href, locale) })))
|
||||
.filter(item => navigationVisible(config, item.href) && `${item.label} ${item.group} ${item.description} ${item.href}`.toLowerCase().includes(query.trim().toLowerCase())), [t, locale, config, query]);
|
||||
return <>
|
||||
<button className="nav-icon-btn social-search-trigger" type="button" aria-label={tx("搜索社区功能", "Search community")} title={tx("搜索社区功能 · Ctrl/⌘ K", "Search community · Ctrl/⌘ K")} onClick={() => { setQuery(""); setOpen(true); }}><Search size={18} /><kbd>⌘ K</kbd></button>
|
||||
{open && <SocialDialog title={tx("你想从哪里开始?", "Where would you like to go?")} onClose={() => setOpen(false)}>
|
||||
<div className="social-command">
|
||||
<label className="social-command-search"><Search size={20} /><input autoFocus type="search" aria-label={tx("搜索页面或功能", "Search pages and features")} placeholder={tx("搜索人、咖啡、协作…", "People, coffee, collaboration…")} value={query} onChange={event => setQuery(event.target.value)} onKeyDown={event => { if (event.key === "ArrowDown") { event.preventDefault(); results.current?.querySelector("a")?.focus(); } }} /></label>
|
||||
<div className="social-command-results" ref={results} onKeyDown={event => {
|
||||
const links = Array.from(results.current?.querySelectorAll("a") || []);
|
||||
const index = links.indexOf(document.activeElement as HTMLAnchorElement);
|
||||
if (event.key === "ArrowDown" || event.key === "ArrowUp") { event.preventDefault(); links[(index + (event.key === "ArrowDown" ? 1 : -1) + links.length) % links.length]?.focus(); }
|
||||
}}>
|
||||
{items.map(item => { const Icon = item.icon; return <Link key={item.href} href={socialPath(item.href)} onClick={() => setOpen(false)}><span className="nav-entry-icon"><Icon size={20} /></span><span><strong>{item.label}<small>{item.group}</small></strong><em>{item.description}</em></span><ArrowUpRight size={16} /></Link>; })}
|
||||
{!items.length && <p className="social-command-empty" role="status">{tx("没有匹配的功能,换个关键词试试。", "No matching features. Try another keyword.")}</p>}
|
||||
</div>
|
||||
<p className="social-command-hint">{tx("↑ ↓ 选择 · Enter 打开 · Esc 关闭", "↑ ↓ Navigate · Enter Open · Esc Close")}</p>
|
||||
</div>
|
||||
</SocialDialog>}
|
||||
</>;
|
||||
}
|
||||
@ -180,6 +180,7 @@ export default function SocialGlobe3D({
|
||||
const rendererRef = useRef<THREE.WebGLRenderer | null>(null);
|
||||
const [overlays, setOverlays] = useState<OverlayPin[]>([]);
|
||||
const [ready, setReady] = useState(false);
|
||||
const [failed, setFailed] = useState(false);
|
||||
const drag = useRef({ active: false, lx: 0, ly: 0, rotY: 0.55, rotX: 0.08 });
|
||||
const autoSpin = useRef(true);
|
||||
const fitDistanceRef = useRef<(aspect: number) => number>(() => 4.2);
|
||||
@ -214,12 +215,13 @@ export default function SocialGlobe3D({
|
||||
|
||||
const w = Math.max(wrap.clientWidth, 320);
|
||||
const h = Math.max(wrap.clientHeight, 320);
|
||||
const renderer = new THREE.WebGLRenderer({
|
||||
let renderer: THREE.WebGLRenderer;
|
||||
try { renderer = new THREE.WebGLRenderer({
|
||||
canvas,
|
||||
antialias: true,
|
||||
alpha: true,
|
||||
powerPreference: "high-performance",
|
||||
});
|
||||
}); } catch { setFailed(true); return; }
|
||||
renderer.setClearColor(0x000000, 0);
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2.5));
|
||||
renderer.setSize(w, h, false);
|
||||
@ -480,7 +482,7 @@ export default function SocialGlobe3D({
|
||||
<div className="sm-globe-vignette" aria-hidden />
|
||||
{!ready ? (
|
||||
<div className="sm-map-status" role="status">
|
||||
生成立体地球…
|
||||
{failed ? "当前设备无法显示立体地图,请切换平面或使用城市目录 / Use the map or city list" : "生成立体地球… / Loading globe…"}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="sm-globe-overlays">
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
"use client";
|
||||
|
||||
/** 多语言切换已隐藏;跟随门户自动检测的语言。 */
|
||||
import { Languages } from "lucide-react";
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
|
||||
export default function SocialLangSwitch() {
|
||||
return null;
|
||||
const { locale, setLocale } = useSocialI18n();
|
||||
return <button className="nav-icon-btn social-language-toggle" type="button" aria-label={locale === "zh" ? "Switch to English" : "切换中文"} onClick={() => setLocale(locale === "zh" ? "en" : "zh")}><Languages size={18} /><span>{locale === "zh" ? "EN" : "中"}</span></button>;
|
||||
}
|
||||
|
||||
@ -44,9 +44,15 @@ function makePulseEl(city: SocialMapCity, selected: boolean): HTMLButtonElement
|
||||
el.innerHTML = `
|
||||
<i class="sm-pulse-ring" aria-hidden="true"></i>
|
||||
<i class="sm-pulse-ring sm-pulse-ring--delay" aria-hidden="true"></i>
|
||||
<span class="sm-pulse-core">${city.emoji || "·"}</span>
|
||||
<em class="sm-pulse-label">${city.name}<b>${city.memberCount}</b></em>
|
||||
<span class="sm-pulse-core"></span>
|
||||
<em class="sm-pulse-label"></em>
|
||||
`;
|
||||
el.querySelector(".sm-pulse-core")!.textContent = city.emoji || "·";
|
||||
const label = el.querySelector(".sm-pulse-label")!;
|
||||
label.textContent = city.name;
|
||||
const count = document.createElement("b");
|
||||
count.textContent = String(city.memberCount);
|
||||
label.append(count);
|
||||
return el;
|
||||
}
|
||||
|
||||
@ -61,18 +67,28 @@ function makePersonEl(
|
||||
el.innerHTML = `
|
||||
${opts.showApprox ? `<span class="sm-approx-tag">approximate location</span>` : ""}
|
||||
<span class="sm-route" aria-hidden="true">
|
||||
<b>${pin.fromCode}</b><i>›</i><b>${pin.toCode}</b>
|
||||
<b></b><i>›</i><b></b>
|
||||
<span class="sm-route-bars"><i></i><i></i></span>
|
||||
</span>
|
||||
${opts.showApprox ? `<span class="sm-approx-halo" aria-hidden="true"></span>` : ""}
|
||||
<span class="sm-ava-wrap">
|
||||
${pin.vip ? `<span class="sm-badge sm-badge--vip" title="VIP">♛</span>` : ""}
|
||||
${pin.verified ? `<span class="sm-badge sm-badge--ok" title="verified">✓</span>` : ""}
|
||||
<img class="sm-ava" src="${pin.avatar}" alt="" width="48" height="48" loading="lazy" />
|
||||
<span class="sm-gender sm-gender--${pin.gender}" aria-hidden="true">${pin.gender === "f" ? "♀" : "♂"}</span>
|
||||
<img class="sm-ava" alt="" width="48" height="48" loading="lazy" />
|
||||
<span class="sm-gender" aria-hidden="true"></span>
|
||||
</span>
|
||||
<span class="sm-pin-tip" aria-hidden="true"></span>
|
||||
`;
|
||||
const codes = el.querySelectorAll(".sm-route > b");
|
||||
codes[0].textContent = pin.fromCode;
|
||||
codes[1].textContent = pin.toCode;
|
||||
const gender = el.querySelector(".sm-gender")!;
|
||||
gender.classList.add(pin.gender === "f" ? "sm-gender--f" : "sm-gender--m");
|
||||
gender.textContent = pin.gender === "f" ? "♀" : "♂";
|
||||
try {
|
||||
const avatar = new URL(pin.avatar, location.origin);
|
||||
if (["https:", "http:"].includes(avatar.protocol)) (el.querySelector("img") as HTMLImageElement).src = avatar.href;
|
||||
} catch { /* Missing portraits leave the city marker available. */ }
|
||||
return el;
|
||||
}
|
||||
|
||||
@ -158,12 +174,20 @@ export default function SocialMapCanvas({
|
||||
map.on("error", onError);
|
||||
};
|
||||
|
||||
tryStyle(0);
|
||||
try {
|
||||
tryStyle(0);
|
||||
} catch {
|
||||
setStatus("地图暂不可用,请从城市目录继续探索 / Explore the city list below");
|
||||
}
|
||||
const timeout = setTimeout(() => {
|
||||
if (!readyRef.current) setStatus("底图加载较慢,可从城市目录继续探索 / Explore the city list below");
|
||||
}, 12000);
|
||||
|
||||
const onWinResize = () => mapRef.current?.resize();
|
||||
window.addEventListener("resize", onWinResize);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
window.removeEventListener("resize", onWinResize);
|
||||
markersRef.current.forEach((m) => m.remove());
|
||||
markersRef.current = [];
|
||||
|
||||
@ -2,25 +2,27 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
CircleUserRound,
|
||||
Compass,
|
||||
Heart,
|
||||
House,
|
||||
MessageCircle,
|
||||
MapPin,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
import {
|
||||
WechatOaModal,
|
||||
DEFAULT_X_HANDLE,
|
||||
formatXHandle,
|
||||
xProfileUrl,
|
||||
} from "~/components/social-follow";
|
||||
import { useAudienceModule } from "~/modules/audience";
|
||||
import { trackFollow } from "~/lib/analytics/track";
|
||||
import { openSocialJoinModal } from "@social/lib/joinModal";
|
||||
import { isSocialHomePath, socialPath } from "@social/lib/socialPath";
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
|
||||
const DOCK_ICONS = [House, MessageCircle, Heart, Compass, CircleUserRound] as const;
|
||||
const DOCK_ICONS = [House, MapPin, MessageCircle, Users, CircleUserRound] as const;
|
||||
|
||||
export function SocialMobileDock() {
|
||||
const pathname = usePathname();
|
||||
@ -73,6 +75,8 @@ export function SocialMobileDock() {
|
||||
export function SocialFooter() {
|
||||
const { t, locale } = useSocialI18n();
|
||||
const zh = locale === "zh";
|
||||
const { followChannel } = useAudienceModule();
|
||||
const [wechatOpen, setWechatOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<footer className="social-workspace-footer">
|
||||
@ -84,14 +88,15 @@ export function SocialFooter() {
|
||||
<Link href={socialPath("/feedback")}>
|
||||
{t.navGroups.find((g) => g.id === "together")?.items.find((i) => i.href === "/feedback")?.label || "Contact"}
|
||||
</Link>
|
||||
<a
|
||||
{followChannel === "x" && <a
|
||||
href={xProfileUrl(DEFAULT_X_HANDLE)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={() => trackFollow("click", { channel: "x", place: "social_footer" })}
|
||||
>
|
||||
{zh ? `关注 X ${formatXHandle()}` : `Follow ${formatXHandle()}`}
|
||||
</a>
|
||||
</a>}
|
||||
{followChannel === "wechat" && <button type="button" className="social-footer-link" onClick={() => setWechatOpen(true)}>{zh ? "关注公众号" : "Follow on WeChat"}</button>}
|
||||
<button
|
||||
type="button"
|
||||
className="social-footer-link"
|
||||
@ -100,6 +105,7 @@ export function SocialFooter() {
|
||||
{t.joinCommunity}
|
||||
</button>
|
||||
</div>
|
||||
<WechatOaModal open={wechatOpen} onClose={() => setWechatOpen(false)} />
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,58 +2,24 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { openSocialJoinModal } from "@social/lib/joinModal";
|
||||
import { ChevronRight, House } from "lucide-react";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { navigationDetail, routeMatches } from "@social/lib/navigation";
|
||||
import { navigationVisible } from "@social/lib/experience";
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
|
||||
export default function SocialQuickRail() {
|
||||
const pathname = usePathname();
|
||||
const { t } = useSocialI18n();
|
||||
const track = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
const container = track.current;
|
||||
const active = container?.querySelector<HTMLElement>('[aria-current="page"]');
|
||||
if (container && active) container.scrollLeft = Math.max(0, active.offsetLeft - container.offsetLeft - (container.clientWidth - active.clientWidth) / 2);
|
||||
}, [pathname, t.rail]);
|
||||
return (
|
||||
<nav className="social-quick-rail" aria-label={t.railAria}>
|
||||
<div ref={track} className="social-quick-rail-track">
|
||||
{t.rail.map((item) => {
|
||||
if (item.href === "/join") {
|
||||
return (
|
||||
<button
|
||||
key={item.href}
|
||||
type="button"
|
||||
className="social-quick-chip"
|
||||
onClick={() => openSocialJoinModal({ reason: "cta" })}
|
||||
>
|
||||
<span aria-hidden>{item.emoji}</span>
|
||||
{item.label}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
const href = socialPath(item.href);
|
||||
const active =
|
||||
item.href === "/ebook"
|
||||
? pathname.startsWith(socialPath("/ebook")) ||
|
||||
pathname.startsWith(socialPath("/videos"))
|
||||
: item.href === "/"
|
||||
? pathname === "/" || pathname === socialPath("/")
|
||||
: pathname.startsWith(href);
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={href}
|
||||
className={`social-quick-chip${active ? " is-active" : ""}`}
|
||||
aria-current={active ? "page" : undefined}
|
||||
>
|
||||
<span aria-hidden>{item.emoji}</span>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
const { t, tx, locale } = useSocialI18n();
|
||||
const config = useSocialConfig();
|
||||
const group = t.navGroups.find(group => group.items.some(item => routeMatches(pathname, socialPath(item.href))));
|
||||
return <nav className="social-journey-nav" aria-label={t.railAria}>
|
||||
<div className="social-breadcrumb"><Link href="/" aria-label={tx("社区首页", "Community home")}><House size={15} /></Link><ChevronRight size={13} /><span>{group?.label || tx("我的社区", "My community")}</span></div>
|
||||
<div className="social-journey-links">{(group?.items || [{ href: "/people", label: tx("发现朋友", "Discover people") }, { href: "/roster", label: tx("我的名片", "My profile") }]).filter(item => navigationVisible(config, item.href)).map(item => {
|
||||
const Icon = navigationDetail(item.href, locale).icon;
|
||||
const active = routeMatches(pathname, socialPath(item.href));
|
||||
return <Link key={item.href} href={socialPath(item.href)} aria-current={active ? "page" : undefined}><Icon size={15} /><span>{item.label}</span></Link>;
|
||||
})}</div>
|
||||
</nav>;
|
||||
}
|
||||
|
||||
@ -83,6 +83,12 @@ async function req<T>(
|
||||
throw new Error(msg);
|
||||
}
|
||||
const data = (await res.json()) as T;
|
||||
if (method !== "GET") {
|
||||
const resource = path.split("/")[1]?.split("?")[0];
|
||||
for (const key of _memTtl.keys()) {
|
||||
if (key.startsWith(`GET:/${resource}`)) _memTtl.delete(key);
|
||||
}
|
||||
}
|
||||
if (cacheKey) _memTtl.set(cacheKey, { at: Date.now(), data });
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -31,8 +31,7 @@ export const SOCIAL_CITIES: SocialCity[] = [
|
||||
vibe: "苍山洱海 · 慢生活",
|
||||
blurb: "湖边骑行、古城咖啡馆、时区友好的远程日常。",
|
||||
highlights: ["洱海骑行与落日局", "租金友好", "社区局密集"],
|
||||
cover:
|
||||
"https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=1600&q=80",
|
||||
cover: "/social/cities/dali.jpg",
|
||||
members: 520,
|
||||
meetupCount: 12,
|
||||
costHint: "¥3,000/月起",
|
||||
@ -160,8 +159,7 @@ export const SOCIAL_CITIES: SocialCity[] = [
|
||||
country: "泰国",
|
||||
emoji: "🌿",
|
||||
vibe: "Nimman · 游民大本营",
|
||||
cover:
|
||||
"https://images.unsplash.com/photo-1528183429752-a97d0bf99b5a?auto=format&fit=crop&w=1600&q=80",
|
||||
cover: "/social/cities/chiangmai.jpg",
|
||||
members: 940,
|
||||
meetupCount: 36,
|
||||
costHint: "฿18,000/月起",
|
||||
@ -173,6 +171,7 @@ export const SOCIAL_CITIES: SocialCity[] = [
|
||||
},
|
||||
{
|
||||
id: "bali",
|
||||
cover: "/social/cities/bali.jpg",
|
||||
name: "巴厘岛",
|
||||
country: "印尼",
|
||||
emoji: "🌴",
|
||||
@ -188,6 +187,7 @@ export const SOCIAL_CITIES: SocialCity[] = [
|
||||
},
|
||||
{
|
||||
id: "lisbon",
|
||||
cover: "/social/cities/lisbon.jpg",
|
||||
name: "里斯本",
|
||||
country: "葡萄牙",
|
||||
emoji: "🌊",
|
||||
|
||||
@ -212,7 +212,7 @@ export function useDiscoveryRoster(_opts?: {
|
||||
// Dating: mock portraits count as face-ok; never pad with no-face remotes
|
||||
const mocks = seed
|
||||
.filter((m) => !liveIds.has(m.id))
|
||||
.map((m) => ({ ...m, faceOk: true })); // stock portraits only
|
||||
.map((m) => ({ ...m, faceOk: true, example: true })); // stock portraits only
|
||||
const merged = [
|
||||
...live,
|
||||
...(requireFace ? mocks.filter((m) => m.faceOk === true) : mocks),
|
||||
|
||||
27
src/modules/social/lib/experience.ts
Normal file
27
src/modules/social/lib/experience.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import type { NomadroRemoteConfig } from "~/lib/remote-config";
|
||||
import type { SocialLocale } from "./i18n";
|
||||
|
||||
export type SocialPageCopy = { eyebrow?: string; title?: string; accent?: string; description?: string };
|
||||
export type SocialExperienceConfig = {
|
||||
navigation?: Record<string, boolean>;
|
||||
sections?: Record<string, boolean>;
|
||||
pages?: Partial<Record<SocialLocale, Record<string, SocialPageCopy>>>;
|
||||
announcement?: { enabled?: boolean; zh?: string; en?: string; href?: string };
|
||||
featuredCityIds?: string[];
|
||||
};
|
||||
|
||||
export function experiencePage(config: NomadroRemoteConfig, locale: SocialLocale, key: string): SocialPageCopy {
|
||||
return config.copy.socialExperience?.pages?.[locale]?.[key] || {};
|
||||
}
|
||||
|
||||
export function navigationVisible(config: NomadroRemoteConfig, href: string) {
|
||||
return config.copy.socialExperience?.navigation?.[href.split("/").filter(Boolean)[0]] !== false;
|
||||
}
|
||||
|
||||
export function homeSectionVisible(config: NomadroRemoteConfig, key: string) {
|
||||
return config.copy.socialExperience?.sections?.[key] !== false && !config.copy.socialHiddenSections?.includes(key);
|
||||
}
|
||||
|
||||
export function safeCommunityHref(value: string | undefined) {
|
||||
return value && /^\/(?:social(?:\/|\?|$)|$)/.test(value) && !value.includes("\\") ? value : "/social/people";
|
||||
}
|
||||
@ -98,7 +98,9 @@ const zh: SocialDictionary = {
|
||||
label: "一起做事",
|
||||
items: [
|
||||
{ href: "/team", label: "找搭子" },
|
||||
{ href: "/skills", label: "技能交换" },
|
||||
{ href: "/ebook", label: "共创" },
|
||||
{ href: "/videos", label: "社区影像" },
|
||||
{ href: "/work", label: "远程工作" },
|
||||
{ href: "/feedback", label: "说说想法" },
|
||||
],
|
||||
@ -129,7 +131,7 @@ const zh: SocialDictionary = {
|
||||
{ href: "#people", label: "想见的人", emoji: "👋" },
|
||||
{ href: "#date", label: "约会", emoji: "💕" },
|
||||
{ href: "/coffeechat", label: "线下咖啡", emoji: "☕", external: true },
|
||||
{ href: "/team", label: "技能交换", emoji: "🔄", external: true },
|
||||
{ href: "/skills", label: "技能交换", emoji: "🔄", external: true },
|
||||
{ href: "#cities", label: "城市", emoji: "📍" },
|
||||
{ href: "/map", label: "地图", emoji: "🗺️", external: true },
|
||||
{ href: "#team", label: "一起做事", emoji: "🚀" },
|
||||
@ -179,7 +181,7 @@ const en: SocialDictionary = {
|
||||
navGroups: [
|
||||
{
|
||||
id: "online",
|
||||
label: "Meet online",
|
||||
label: "Meet people",
|
||||
items: [
|
||||
{ href: "/chat", label: "Chat rooms" },
|
||||
{ href: "/people", label: "People" },
|
||||
@ -201,7 +203,9 @@ const en: SocialDictionary = {
|
||||
label: "Build together",
|
||||
items: [
|
||||
{ href: "/team", label: "Find buddies" },
|
||||
{ href: "/skills", label: "Skill exchange" },
|
||||
{ href: "/ebook", label: "Co-create" },
|
||||
{ href: "/videos", label: "Community films" },
|
||||
{ href: "/work", label: "Remote work" },
|
||||
{ href: "/feedback", label: "Feedback" },
|
||||
],
|
||||
@ -232,7 +236,7 @@ const en: SocialDictionary = {
|
||||
{ href: "#people", label: "People", emoji: "👋" },
|
||||
{ href: "#date", label: "Dating", emoji: "💕" },
|
||||
{ href: "/coffeechat", label: "Coffee chat", emoji: "☕", external: true },
|
||||
{ href: "#skills", label: "Skill swap", emoji: "🔄" },
|
||||
{ href: "/skills", label: "Skill swap", emoji: "🔄", external: true },
|
||||
{ href: "#cities", label: "Cities", emoji: "📍" },
|
||||
{ href: "/map", label: "Map", emoji: "🗺️", external: true },
|
||||
{ href: "#team", label: "Collaborate", emoji: "🚀" },
|
||||
|
||||
@ -11,7 +11,10 @@ export function localizeSocialConfig(
|
||||
config: NomadroRemoteConfig,
|
||||
locale: string | undefined | null,
|
||||
): NomadroRemoteConfig {
|
||||
if (toSocialLocale(locale) === "zh") return config;
|
||||
if (toSocialLocale(locale) === "zh") {
|
||||
const overrides = config.copy.socialExperience?.pages?.zh || {};
|
||||
return { ...config, copy: { ...config.copy, socialPages: { ...config.copy.socialPages, ...overrides } } };
|
||||
}
|
||||
|
||||
const landing = getSocialDictionary("en").landing;
|
||||
const remotePages = config.copy.socialPages || {};
|
||||
@ -27,6 +30,7 @@ export function localizeSocialConfig(
|
||||
description: en.description || "",
|
||||
};
|
||||
}
|
||||
Object.assign(socialPages, config.copy.socialExperience?.pages?.en || {});
|
||||
|
||||
return {
|
||||
...config,
|
||||
|
||||
28
src/modules/social/lib/navigation.ts
Normal file
28
src/modules/social/lib/navigation.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { BookOpen, BriefcaseBusiness, Coffee, Compass, Heart, HeartHandshake, Map, MessageCircle, MessagesSquare, Radio, Sparkles, Users, Video } from "lucide-react";
|
||||
import type { SocialLocale } from "./i18n";
|
||||
|
||||
const entries = {
|
||||
chat: { icon: MessageCircle, zh: "一起聊聊近况,交换沿途的发现", en: "Say hello and swap stories along the way" },
|
||||
people: { icon: Users, zh: "从城市、兴趣和技能,发现同频的人", en: "Find your people through cities, interests and skills" },
|
||||
date: { icon: Heart, zh: "一张一张认识,按自己的节奏靠近", en: "Discover someone new, one introduction at a time" },
|
||||
meetup: { icon: Radio, zh: "选一个话题,用声音和画面拉近距离", en: "Drop into a conversation with voice and video" },
|
||||
coffeechat: { icon: Coffee, zh: "选主理人、挑时间,认真聊一杯咖啡", en: "Find a host and make time for a real conversation" },
|
||||
map: { icon: Map, zh: "看看世界各地的城市和社区足迹", en: "Explore cities and community connections worldwide" },
|
||||
places: { icon: Compass, zh: "探索城市生活与适合见面的咖啡馆", en: "Discover local life and a cafe for your next hello" },
|
||||
team: { icon: BriefcaseBusiness, zh: "找到合适的角色,把想法变成行动", en: "Find a role and turn a shared idea into action" },
|
||||
skills: { icon: HeartHandshake, zh: "交换擅长的事,让彼此走得更远", en: "Trade what you know and learn something new" },
|
||||
ebook: { icon: BookOpen, zh: "读沿途的经验,也写下自己的故事", en: "Read community guides and contribute your story" },
|
||||
videos: { icon: Video, zh: "用镜头记录生活,一起分享灵感", en: "Explore community films and share your perspective" },
|
||||
work: { icon: Sparkles, zh: "从一张看板、一份文档开始协作", en: "Keep things moving with boards and shared notes" },
|
||||
feedback: { icon: MessagesSquare, zh: "告诉我们,你想要怎样的社区", en: "Help shape the community you want to be part of" },
|
||||
};
|
||||
|
||||
export function navigationDetail(href: string, locale: SocialLocale) {
|
||||
const key = href.split("/").filter(Boolean)[0] as keyof typeof entries;
|
||||
const entry = entries[key] || entries.people;
|
||||
return { icon: entry.icon, description: entry[locale] };
|
||||
}
|
||||
|
||||
export function routeMatches(pathname: string, href: string) {
|
||||
return pathname === href || pathname.startsWith(href + "/");
|
||||
}
|
||||
@ -71,6 +71,7 @@ export function discoveryItemToMember(item: {
|
||||
tags?: string[];
|
||||
status?: string;
|
||||
faceOk?: boolean;
|
||||
languages?: string[];
|
||||
}): SocialRosterMember {
|
||||
const tags =
|
||||
item.tags?.length
|
||||
@ -97,5 +98,6 @@ export function discoveryItemToMember(item: {
|
||||
gender: (item.gender as SocialRosterMember["gender"]) || "f",
|
||||
availability: item.availability || "",
|
||||
faceOk,
|
||||
languages: Array.isArray(item.languages) ? item.languages.filter(language => typeof language === "string") : [],
|
||||
};
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ export type SocialRosterMember = {
|
||||
gallery?: string[];
|
||||
/** Detector saw a face in avatar — required for dating feed. */
|
||||
faceOk?: boolean;
|
||||
example?: boolean;
|
||||
};
|
||||
|
||||
const MOCK_ROSTER_SEED: SocialRosterMember[] = [
|
||||
|
||||
@ -11,7 +11,6 @@ import {
|
||||
} from "./i18n";
|
||||
import { socialTx, setSocialTxLocale } from "./socialTx";
|
||||
|
||||
const UNLOCK_KEY = "nomadro-lang-unlock";
|
||||
|
||||
export type TranslateFn = (zh: string, en?: string) => string;
|
||||
|
||||
@ -41,11 +40,6 @@ export function useSocialI18n(): {
|
||||
|
||||
const setLocale = useCallback(
|
||||
(next: SocialLocale) => {
|
||||
try {
|
||||
window.sessionStorage.setItem(UNLOCK_KEY, "1");
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
setSocialTxLocale(next);
|
||||
setPortalLocale(next);
|
||||
},
|
||||
|
||||
@ -6,10 +6,13 @@ import { socialPath } from "@social/lib/socialPath";
|
||||
import { socialTx } from "@social/lib/socialTx";
|
||||
import { useSocialI18n } from "@social/lib/useSocialI18n";
|
||||
import "./work.css";
|
||||
import { experiencePage } from "@social/lib/experience";
|
||||
import { useSocialConfig } from "@social/components/SocialExperience";
|
||||
|
||||
export default function WorkClient() {
|
||||
const { locale } = useSocialI18n();
|
||||
const zh = locale === "zh";
|
||||
const copy = experiencePage(useSocialConfig(), locale, "work");
|
||||
|
||||
return (
|
||||
<SiteShell title={socialTx("远程工作")}>
|
||||
@ -24,12 +27,12 @@ export default function WorkClient() {
|
||||
Nomadro <span>Work</span>
|
||||
</p>
|
||||
<h1 className="work-landing-title">
|
||||
{zh ? "远程一起做事" : "Work together, remotely"}
|
||||
{copy.title || (zh ? "远程一起做事" : "Work together, remotely")}
|
||||
</h1>
|
||||
<p className="work-landing-lead">
|
||||
{zh
|
||||
{copy.description || (zh
|
||||
? "看板推进任务,文档沉淀共识——同一套 Nomadro 远程协作。"
|
||||
: "Kanban for momentum, pads for shared notes — one Nomadro work surface."}
|
||||
: "Keep projects moving with a shared board. Turn ideas into clear notes and next steps.")}
|
||||
</p>
|
||||
<div className="work-landing-cta">
|
||||
<Link
|
||||
@ -125,19 +128,7 @@ export default function WorkClient() {
|
||||
</Link>
|
||||
</section>
|
||||
|
||||
<details className="work-landing-dev">
|
||||
<summary>{zh ? "开发者本地启动" : "Local developer setup"}</summary>
|
||||
<ol>
|
||||
<li>
|
||||
<code>pnpm dev:work-api</code>
|
||||
<span>{zh ? "FastAPI work_svc" : "FastAPI work_svc"}</span>
|
||||
</li>
|
||||
<li>
|
||||
<code>pnpm dev</code>
|
||||
<span>→ /social/work</span>
|
||||
</li>
|
||||
</ol>
|
||||
</details>
|
||||
<div className="social-inline-notice"><span>✦</span><p>{zh ? "先写下一个共同目标,再拆成可以开始的小任务。还缺搭档?" : "Start with a shared goal, then break it into small steps. Need a collaborator?"} <Link href={socialPath("/team")}>{zh ? "去找搭子 ↗" : "Find your team ↗"}</Link></p></div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
@ -13,22 +17,52 @@
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [{ "name": "next" }],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"~/*": ["./src/*"],
|
||||
"@ebook/*": ["./src/modules/ebook/*"],
|
||||
"@community/*": ["./src/modules/community/*"],
|
||||
"@social/*": ["./src/modules/social/*"],
|
||||
"@navmini/*": ["./src/modules/nav/*"],
|
||||
"@vip/*": ["./src/modules/vip/*"],
|
||||
"@work/*": ["./src/modules/work/*"],
|
||||
"@notify/*": ["./src/modules/notify/*"],
|
||||
"@coffee/*": ["./src/modules/coffee/*"],
|
||||
"@nomadro/pay": ["./packages/pay/src/index.ts"],
|
||||
"@nomadro/pb": ["./packages/pb/src/index.ts"],
|
||||
"@nomadro/sdk": ["./packages/sdk/src/index.ts"]
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"~/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@ebook/*": [
|
||||
"./src/modules/ebook/*"
|
||||
],
|
||||
"@community/*": [
|
||||
"./src/modules/community/*"
|
||||
],
|
||||
"@social/*": [
|
||||
"./src/modules/social/*"
|
||||
],
|
||||
"@navmini/*": [
|
||||
"./src/modules/nav/*"
|
||||
],
|
||||
"@vip/*": [
|
||||
"./src/modules/vip/*"
|
||||
],
|
||||
"@work/*": [
|
||||
"./src/modules/work/*"
|
||||
],
|
||||
"@notify/*": [
|
||||
"./src/modules/notify/*"
|
||||
],
|
||||
"@coffee/*": [
|
||||
"./src/modules/coffee/*"
|
||||
],
|
||||
"@nomadro/pay": [
|
||||
"./packages/pay/src/index.ts"
|
||||
],
|
||||
"@nomadro/pb": [
|
||||
"./packages/pb/src/index.ts"
|
||||
],
|
||||
"@nomadro/sdk": [
|
||||
"./packages/sdk/src/index.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
@ -38,7 +72,9 @@
|
||||
"src/**/*.mts",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts",
|
||||
"packages/**/*.ts"
|
||||
"packages/**/*.ts",
|
||||
".next-social-dev/types/**/*.ts",
|
||||
".next-social-dev/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user