Deepen /social UX: people profiles, city directory, date deck, and plain-language IA.
Hide membership entry, brand ebook/video as 共创, harden H5 touch layout, and align copy with everyday nomad language. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
bbe2514e96
commit
efb408162d
@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "nomadro",
|
||||
"short_name": "nomadro",
|
||||
"description": "随处工作,自由生活 · 出海导航 · 数字游民小册 · 旅居社群",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "any",
|
||||
"background_color": "#0a0e17",
|
||||
"theme_color": "#0a0e17",
|
||||
"lang": "zh-CN",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/favicon.svg?v=2",
|
||||
"sizes": "any",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/icon-192.png?v=2",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512.png?v=2",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/apple-touch-icon.png?v=2",
|
||||
"sizes": "180x180",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -12,22 +12,22 @@ export default function manifest(): MetadataRoute.Manifest {
|
||||
lang: "zh-CN",
|
||||
icons: [
|
||||
{
|
||||
src: "/favicon.svg",
|
||||
src: "/favicon.svg?v=2",
|
||||
sizes: "any",
|
||||
type: "image/svg+xml",
|
||||
},
|
||||
{
|
||||
src: "/icon-192.png",
|
||||
src: "/icon-192.png?v=2",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: "/icon-512.png",
|
||||
src: "/icon-512.png?v=2",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: "/apple-touch-icon.png",
|
||||
src: "/apple-touch-icon.png?v=2",
|
||||
sizes: "180x180",
|
||||
type: "image/png",
|
||||
},
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
import ChatRoomClient from "@social/components/ChatRoomClient";
|
||||
import { SEED_CHANNELS } from "@social/lib/seed";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const channelId = SEED_CHANNELS.some((c) => c.id === id) ? id : SEED_CHANNELS[0].id;
|
||||
return <ChatRoomClient channelId={channelId} />;
|
||||
/** 旧多频道 URL → 唯一全屏聊天室 */
|
||||
export default async function Page({
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||
}) {
|
||||
const sp = await searchParams;
|
||||
const introRaw = sp.intro;
|
||||
const intro = Array.isArray(introRaw) ? introRaw[0] : introRaw;
|
||||
if (intro) {
|
||||
redirect(`/social/chat?intro=${encodeURIComponent(intro)}`);
|
||||
}
|
||||
redirect("/social/chat");
|
||||
}
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
import { Suspense } from "react";
|
||||
import CoffeechatClient from "@social/components/CoffeechatClient";
|
||||
|
||||
export default function Page() {
|
||||
return <CoffeechatClient />;
|
||||
return (
|
||||
<Suspense fallback={<div className="social-status">加载同城目录…</div>}>
|
||||
<CoffeechatClient />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,12 +9,14 @@ import "@social/app/experience.css";
|
||||
import "@social/app/interaction.css";
|
||||
import "@social/app/studio.css";
|
||||
import "@social/app/motion.css";
|
||||
import "@social/app/depth.css";
|
||||
import "@social/app/vivid.css";
|
||||
import SocialExperience from "@social/components/SocialExperience";
|
||||
|
||||
export const metadata = {
|
||||
title: "游民社区 · nomadro",
|
||||
description:
|
||||
"数字游民社交:线上聊天 · Meetup · Coffeechat · 职业花名册 · UGC",
|
||||
"认识同频的人:看看谁在这儿、开视频聊聊、出来见一面、一起做点事",
|
||||
};
|
||||
|
||||
export default function SocialLayout({
|
||||
|
||||
15
src/app/social/people/[id]/page.tsx
Normal file
15
src/app/social/people/[id]/page.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { Suspense } from "react";
|
||||
import PeopleProfileClient from "@social/components/PeopleProfileClient";
|
||||
|
||||
export default async function PeopleProfilePage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
return (
|
||||
<Suspense fallback={<div className="social-status">加载游民名片…</div>}>
|
||||
<PeopleProfileClient id={id} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import VipClient from "@social/components/VipClient";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
/** 会员入口已隐藏,直达统一加入社区。 */
|
||||
export default function Page() {
|
||||
return <VipClient />;
|
||||
redirect("/social/join");
|
||||
}
|
||||
|
||||
@ -149,6 +149,18 @@ export type NomadroRemoteConfig = {
|
||||
}
|
||||
>;
|
||||
socialVideoSources?: Record<string, string>;
|
||||
/** 游民社区目录覆盖;空数组/非法字段回退包内 seed */
|
||||
socialCatalogs?: {
|
||||
cafes?: Array<Record<string, unknown>>;
|
||||
meetups?: Array<Record<string, unknown>>;
|
||||
gigs?: Array<Record<string, unknown>>;
|
||||
};
|
||||
socialWayChat?: string;
|
||||
socialWayDate?: string;
|
||||
socialWayCafe?: string;
|
||||
socialWayTeam?: string;
|
||||
socialPayJoinLabel?: string;
|
||||
socialOaJoinLabel?: string;
|
||||
};
|
||||
/** 导航页分类 / 链接(后台可增删改隐) */
|
||||
navContent?: NavContent;
|
||||
@ -382,6 +394,99 @@ export const DEFAULT_REMOTE_CONFIG: NomadroRemoteConfig = {
|
||||
socialOnlineTitle: "随时,聊得来",
|
||||
socialOfflineTitle: "同城,见一面",
|
||||
socialTeamTitle: "一起,做点事",
|
||||
socialWayChat: "开视频聊聊",
|
||||
socialWayDate: "认识一下",
|
||||
socialWayCafe: "找个地方见面",
|
||||
socialWayTeam: "找搭子 · 共创",
|
||||
socialPayJoinLabel: "加入社区",
|
||||
socialOaJoinLabel: "先看看公众号",
|
||||
socialPages: {
|
||||
people: {
|
||||
eyebrow: "先逛逛大家",
|
||||
title: "想见的人",
|
||||
accent: "认识新朋友",
|
||||
description:
|
||||
"点开卡片,看看对方在做什么。现在是示例介绍,方便你先熟悉;想打招呼,去大家聊天的地方说一句就好。",
|
||||
},
|
||||
date: {
|
||||
eyebrow: "慢慢认识",
|
||||
title: "认识一下",
|
||||
accent: "想认识的人",
|
||||
description:
|
||||
"右滑表示想认识,会先记在你这边。接下来可以去聊天室打个招呼——不是一对一私信,而是大家一起聊。",
|
||||
},
|
||||
chat: {
|
||||
eyebrow: "大家在这儿聊",
|
||||
title: "聊天室",
|
||||
accent: "打个招呼",
|
||||
description:
|
||||
"进来跟大家说说话。网络不好时,刚才的话可能先留在你这边,联网后再试一次就行。",
|
||||
},
|
||||
meetup: {
|
||||
eyebrow: "面对面更近",
|
||||
title: "随时,聊得来",
|
||||
accent: "开视频",
|
||||
description:
|
||||
"几个人一起开摄像头见面聊天。点「想参加」只是先记在你这边,还不等于已经约好。",
|
||||
},
|
||||
coffeechat: {
|
||||
eyebrow: "约出来喝一杯",
|
||||
title: "同城,见一面",
|
||||
accent: "城市与咖啡馆",
|
||||
description:
|
||||
"先选城市,再挑适合见面的咖啡馆。看完介绍、聊过天之后,出来见一面会更自然。",
|
||||
},
|
||||
team: {
|
||||
eyebrow: "不只好玩,也能做事",
|
||||
title: "一起,做点事",
|
||||
accent: "找搭子",
|
||||
description:
|
||||
"有人在找帮手、兼职伙伴;也有人一起做共创(小册与视频)。点卡片看看详情。",
|
||||
},
|
||||
gigs: {
|
||||
eyebrow: "帮得上忙的机会",
|
||||
title: "兼职与志愿",
|
||||
accent: "一起做事",
|
||||
description: "想帮忙、想兼职,都从这里看看。合适再表达兴趣。",
|
||||
},
|
||||
join: {
|
||||
eyebrow: "先找到组织",
|
||||
title: "加入社区",
|
||||
accent: "欢迎你来",
|
||||
description:
|
||||
"付费加入后能更方便认识大家;也可以先关注公众号,慢慢了解社区动态。",
|
||||
},
|
||||
vip: {
|
||||
eyebrow: "想多一点支持",
|
||||
title: "会员",
|
||||
description: "开通后能更方便参与社区活动。具体权益以页面说明为准。",
|
||||
},
|
||||
roster: {
|
||||
eyebrow: "让别人认识你",
|
||||
title: "我的介绍",
|
||||
description:
|
||||
"写几句关于自己的话,草稿会先留在你这边。愿意的话,也可以出现在「想见的人」里。",
|
||||
},
|
||||
feedback: {
|
||||
eyebrow: "说说你的想法",
|
||||
title: "意见反馈",
|
||||
accent: "我们在听",
|
||||
description:
|
||||
"有不顺手的地方尽管说。发送失败时会先留在你这边,有网后再试一次。",
|
||||
},
|
||||
ebook: {
|
||||
eyebrow: "共创",
|
||||
title: "共创 · 小册",
|
||||
accent: "大家写的",
|
||||
description: "社区一起写的经验。先看看目录;想完整阅读,可以去书库。",
|
||||
},
|
||||
videos: {
|
||||
eyebrow: "共创",
|
||||
title: "共创 · 视频",
|
||||
accent: "大家拍的",
|
||||
description: "社区一起拍的路上故事。有的可以看,有的先看封面。",
|
||||
},
|
||||
},
|
||||
},
|
||||
navContent: structuredClone(DEFAULT_NAV_CONTENT),
|
||||
platforms: {
|
||||
|
||||
@ -20,18 +20,19 @@
|
||||
- **交互**:粘性区块导航与当前位置、方向键筛选成员、关注本地保存;原生 `dialog` 管理视频与加群弹窗的焦点、Escape、背景锁定。
|
||||
- **全站布局**:桌面为宽幅内容 + 顶部分组导航;移动端为顶部菜单 + 底部快捷入口。没有侧栏,聊天室频道也使用横向切换。
|
||||
- **全站动效**:`SocialExperience` / `experience.css` 提供星点连线、鼠标柔光、漂移光晕、卡片聚光和页面入场;`interaction.css` / `studio.css` 提供声波、会前雷达、名片透视与书封动效。动效可切为轻量,系统减少动态效果设置优先;离开页面或标签页隐藏时清理/暂停动画。
|
||||
- **视觉终态层**:`depth.css` + `vivid.css`(最后加载)统一玻璃导航、快捷轨、约会进度、聊天跳转最新、咖啡馆主从、Meetup 雷达、触控 ≥44px;子页 `SocialQuickRail` 横向跳转。
|
||||
|
||||
## 子页面与交互边界
|
||||
|
||||
- `/people`:按城市 / 技能 / 兴趣搜索展示成员,收藏与名片弹窗;成员和在线状态为演示资料,交流入口通向真实公开频道,没有虚构私信或匹配结果。
|
||||
- `/chat`、`/chat/[id]`:频道搜索、破冰话题、引用回复、表情、IME 友好的 Enter 发送、独立消息区滚动、本机草稿。连接现有 API / Centrifugo,失败保留「仅本机」消息并支持手动重试;反应与频道收藏仅本机保存。
|
||||
- `/people`:按城市 / 技能 / 兴趣搜索展示成员,收藏与名片弹窗;成员和在线状态为演示资料,可选显示本机已发布名片;交流入口通向真实公开频道,没有虚构私信或匹配结果。
|
||||
- `/chat`、`/chat/[id]`:全站唯一公开厅;破冰话题、引用回复、表情、IME 友好的 Enter 发送、独立消息区滚动、本机草稿。连接现有 API / Centrifugo,失败保留「仅本机」消息并支持手动重试;反应仅本机保存。`/chat/[id]` 重定向到公开厅。
|
||||
- `/meetup`、`/meetup/[id]`:活动收藏表示本机参与计划,不是预约成功;导出日历按活动 IANA 时区转换为 UTC,种子默认 `Asia/Shanghai`。视频房间在明确点击进入后才加载,麦克风 / 摄像头默认关闭,支持布局切换、重连、新窗口和离开。音视频能力依赖现有 MiroTalk 服务及用户授权。
|
||||
- `/coffeechat`:城市 / 关键词 / 网络 / 评分筛选,地点收藏、可分享选中地点、真实评价提交与离线重试。目录中的地点、带宽、评分仅作种子参考;邀约进入公开频道,不伪造订位或即时到场人数。
|
||||
- `/roster`:编辑时实时预览名片与完成度,本机草稿优先;慢返回的服务端资料不会覆盖正在编辑的内容。保存调用现有资料 API,明确区别同步成功与尚未同步。
|
||||
- `/team`、`/gigs`:搜索技能与角色、类型筛选、收藏、参与申请弹窗,校验必填项、保留本机草稿、失败重试和重复提交保护。目录机会是否开放需另行确认。
|
||||
- `/videos`、`/date`、`/ebook`:统一搜索、收藏、内容详情和话题讨论入口。视频没有片源时明确展示目录预览,不显示假播放器;小册入口通向门户书库,不承诺目录主题已有对应完整正文。
|
||||
- `/join`、`/vip`、`/feedback`:加入步骤、已有社群引导、会员中心入口、反馈草稿与离线重试;购买遵循 `payEnabled`,不承诺未实现的优先席位等权益。
|
||||
- **子页面运营**:`/admin/config` 的 `copy.socialPages` 支持按路由键覆盖 `{ eyebrow, title, accent, description }`;`copy.socialVideoSources` 按目录 ID 配置 http(s) 或站内片源。编辑器校验 JSON,非法配置禁止提交;空配置使用内置默认文案。
|
||||
- `/join`、`/vip`、`/feedback`:加群双路径(付费入群 + 关注公众号)、会员中心入口、反馈草稿与离线重试、「再提一条」;购买遵循 `payEnabled`,不承诺未实现的优先席位等权益。
|
||||
- **子页面运营**:`/admin/config` 的 `copy.socialPages` 支持按路由键覆盖 `{ eyebrow, title, accent, description }`;`copy.socialVideoSources` 按目录 ID 配置片源;`copy.socialCatalogs` 可覆盖 cafes/meetups/gigs(空/非法回退包内 seed)。编辑器校验 JSON;空配置使用内置默认文案。
|
||||
- **存储**:`useLocalState` 统一草稿、偏好和收藏,兼容服务端渲染和跨标签页更新。本机保存不会冒充服务器发布、真实关注关系或账号登录。
|
||||
|
||||
## 首页(数字游民社交)
|
||||
@ -42,8 +43,6 @@
|
||||
- CTA:仅「加群」→ 邮箱弹窗 → PC/H5 `zpay`、微信内 H5 `xpay`、小程序引导虚拟支付(`JoinPayModal` + `triggerPay`)
|
||||
- 下方:三种连接入口 → 成员花名册 → Meetup → Coffeechat → **远程团队**(`/social/team`:志愿者 / 兼职 / 全职)→ 加入邀请。
|
||||
- 首页成员 / 活动预览沿用种子数据,演示在线状态明确标注,非实时成员统计。
|
||||
- 世界时钟展示清迈、大理、里斯本、巴厘岛的实际本地时间,并链接对应城市发现页。
|
||||
|
||||
## 本地验收
|
||||
|
||||
- TypeScript 全量检查与改动范围 ESLint。
|
||||
|
||||
1419
src/modules/social/app/depth.css
Normal file
1419
src/modules/social/app/depth.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -113,9 +113,241 @@
|
||||
border-color: #4ecdc455;
|
||||
}
|
||||
.social-workspace {
|
||||
--nav-height: 80px;
|
||||
--nav-height: 72px;
|
||||
min-height: 100dvh;
|
||||
}
|
||||
.social-workspace-dense {
|
||||
--nav-height: 64px;
|
||||
}
|
||||
.social-page-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px 18px;
|
||||
padding: 4px 0 14px;
|
||||
margin-bottom: 6px;
|
||||
border-bottom: 1px solid var(--sx-line);
|
||||
}
|
||||
.social-page-head-copy {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
min-width: min(100%, 28rem);
|
||||
}
|
||||
.social-page-head h1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
font-size: clamp(22px, 2.4vw, 28px);
|
||||
letter-spacing: -0.04em;
|
||||
font-weight: 750;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.social-page-head-eyebrow {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--sx-mint);
|
||||
opacity: 0.9;
|
||||
}
|
||||
.social-page-head-desc {
|
||||
margin: 0;
|
||||
max-width: 42rem;
|
||||
color: var(--text-secondary, rgba(255, 255, 255, 0.62));
|
||||
font-size: 14px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.social-page-head-mark {
|
||||
font-size: 0.92em;
|
||||
line-height: 1;
|
||||
opacity: 0.72;
|
||||
}
|
||||
.social-page-head-title {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 0.35em;
|
||||
}
|
||||
.social-page-head-accent {
|
||||
color: var(--sx-mint);
|
||||
font-weight: 650;
|
||||
font-size: 0.72em;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
.social-demo-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 10px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid color-mix(in srgb, var(--sx-mint) 35%, transparent);
|
||||
background: color-mix(in srgb, var(--sx-mint) 12%, transparent);
|
||||
color: var(--sx-mint);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.social-nav-join {
|
||||
min-height: 36px;
|
||||
padding-inline: 14px;
|
||||
}
|
||||
.social-join-paths {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
margin: 8px 0 22px;
|
||||
}
|
||||
.social-join-path {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
align-content: start;
|
||||
}
|
||||
.social-join-path h2 {
|
||||
margin: 0;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
.social-join-path p {
|
||||
margin: 0;
|
||||
color: var(--text-secondary, rgba(255, 255, 255, 0.62));
|
||||
line-height: 1.5;
|
||||
}
|
||||
.social-join-path-ico {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 14px;
|
||||
background: color-mix(in srgb, var(--sx-mint) 14%, transparent);
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
.social-benefit-list {
|
||||
list-style: none;
|
||||
margin: 0 0 12px;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
.social-benefit-list li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.social-publish-toggle {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
margin: 4px 0 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.social-publish-toggle input {
|
||||
margin-top: 3px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.social-join-success {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
justify-items: start;
|
||||
}
|
||||
.social-channel-solo {
|
||||
max-width: 32rem;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.social-join-paths {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
.social-chat-live {
|
||||
background: var(--sc-bg, var(--bg-primary));
|
||||
}
|
||||
.social-chat-live-bar {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.social-chat-live .social-live-stage {
|
||||
min-height: 0;
|
||||
}
|
||||
.social-chat-live .social-conversation {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
background: transparent !important;
|
||||
}
|
||||
.social-chat-live .social-conversation-top {
|
||||
display: none !important;
|
||||
}
|
||||
.social-chat-live .social-connection-status {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
.social-chat-live .social-thread-wrap,
|
||||
.social-chat-live .social-chat-thread {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
}
|
||||
.social-chat-live .social-chat-composer {
|
||||
margin: 0;
|
||||
border-radius: 0 !important;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.social-live-root .social-mobile-dock {
|
||||
z-index: 40;
|
||||
}
|
||||
/* 唯一聊天室:隐藏旧频道分类条 */
|
||||
.social-chat-solo .social-chat-live-tabs,
|
||||
.social-chat-live-tabs {
|
||||
display: none !important;
|
||||
}
|
||||
.social-chat-live-tabs-legacy {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-shrink: 0;
|
||||
overflow-x: auto;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
border-bottom: var(--sc-border, 1px solid rgba(171, 195, 213, 0.12));
|
||||
background: color-mix(in srgb, var(--sc-bg, #0a0e17) 92%, transparent);
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.social-chat-live-tabs .social-live-tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
min-height: 36px;
|
||||
padding: 0 12px;
|
||||
border-radius: 999px;
|
||||
border: 0;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
color: var(--sc-muted, var(--text-muted));
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
}
|
||||
.social-chat-live-tabs .social-live-tab.active,
|
||||
.social-chat-live-tabs .social-live-tab[aria-current="page"] {
|
||||
color: #0a0e17;
|
||||
background: var(--sc-gradient, linear-gradient(90deg, #ff6b6b, #4ecdc4));
|
||||
}
|
||||
.social-workspace .navbar {
|
||||
position: fixed;
|
||||
inset: 0 0 auto;
|
||||
@ -202,14 +434,20 @@
|
||||
}
|
||||
.social-workspace-grid {
|
||||
display: block;
|
||||
max-width: 1250px;
|
||||
margin: auto;
|
||||
padding: 105px 32px 60px;
|
||||
max-width: none;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: calc(var(--nav-height) + 12px) 20px 88px;
|
||||
min-height: 100dvh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.social-workspace-dense .social-workspace-grid {
|
||||
padding: calc(var(--nav-height) + 8px) 16px 80px;
|
||||
}
|
||||
.social-workspace .social-main {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 1184px;
|
||||
max-width: 1400px;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
@ -232,6 +470,76 @@
|
||||
padding: 36px 0 34px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-page-intro .social-emoji-field {
|
||||
z-index: 0;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.social-page-intro > :not(.social-emoji-field) {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.social-workspace .social-fx-orbs {
|
||||
opacity: 0.35;
|
||||
}
|
||||
.social-workspace .social-fx-orb.o3 {
|
||||
display: block;
|
||||
}
|
||||
.social-room-hero {
|
||||
position: relative;
|
||||
margin: 8px 0 22px;
|
||||
padding: 22px 22px 20px;
|
||||
border: 1px solid var(--sx-line);
|
||||
border-radius: 20px;
|
||||
background: color-mix(in srgb, var(--sx-surface) 88%, transparent);
|
||||
backdrop-filter: blur(14px);
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-room-hero h1 {
|
||||
font-size: clamp(26px, 3vw, 36px);
|
||||
letter-spacing: -0.04em;
|
||||
margin: 12px 0 8px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.social-room-hero > p {
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
max-width: 54ch;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.social-room-hero-emoji {
|
||||
position: absolute;
|
||||
inset: auto 16px 14px auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.social-room-hero-emoji i {
|
||||
font-style: normal;
|
||||
font-size: 0.95rem;
|
||||
opacity: 0.28;
|
||||
filter: none;
|
||||
animation: social-emoji-fly 10s ease-in-out infinite;
|
||||
}
|
||||
.social-room-hero-emoji i:nth-child(2) {
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
.social-room-hero-emoji i:nth-child(3) {
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
.social-room-hero-emoji i:nth-child(4) {
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
.social-workspace .reveal {
|
||||
opacity: 0;
|
||||
transform: translateY(18px);
|
||||
transition:
|
||||
opacity 0.55s var(--sx-ease),
|
||||
transform 0.55s var(--sx-ease);
|
||||
}
|
||||
.social-workspace .reveal.visible {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
.social-page-kicker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -675,6 +983,13 @@
|
||||
font-size: 12px;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.social-empty-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.social-empty .social-btn {
|
||||
margin-top: 18px;
|
||||
}
|
||||
@ -1102,6 +1417,15 @@
|
||||
backdrop-filter: blur(20px);
|
||||
padding: 8px 10px max(9px, env(safe-area-inset-bottom));
|
||||
}
|
||||
.social-chat-live .social-chat-composer {
|
||||
padding-bottom: calc(12px + 64px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
.social-date-root .social-date-stage {
|
||||
padding-bottom: calc(12px + 72px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
.social-date-root .social-date-deck {
|
||||
height: min(520px, calc(100dvh - 300px));
|
||||
}
|
||||
.social-mobile-dock a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@ -85,36 +85,36 @@
|
||||
.social-emoji-float {
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
|
||||
filter: none;
|
||||
animation-name: social-emoji-fly;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-iteration-count: infinite;
|
||||
will-change: transform, opacity;
|
||||
opacity: 0.22;
|
||||
}
|
||||
|
||||
.social-emoji-field-soft {
|
||||
z-index: 0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
@keyframes social-emoji-fly {
|
||||
0% {
|
||||
transform: translate3d(0, 12px, 0) rotate(-12deg) scale(0.92);
|
||||
opacity: 0.25;
|
||||
}
|
||||
40% {
|
||||
transform: translate3d(10px, -28px, 0) rotate(8deg) scale(1.12);
|
||||
opacity: 0.85;
|
||||
}
|
||||
70% {
|
||||
transform: translate3d(-8px, -10px, 0) rotate(-4deg) scale(1.02);
|
||||
opacity: 0.55;
|
||||
}
|
||||
0%,
|
||||
100% {
|
||||
transform: translate3d(0, 12px, 0) rotate(-12deg) scale(0.92);
|
||||
opacity: 0.25;
|
||||
transform: translate3d(0, 4px, 0) rotate(-2deg) scale(1);
|
||||
opacity: 0.14;
|
||||
}
|
||||
50% {
|
||||
transform: translate3d(4px, -8px, 0) rotate(2deg) scale(1.04);
|
||||
opacity: 0.28;
|
||||
}
|
||||
}
|
||||
|
||||
/* Emoji marquee belt */
|
||||
/* Emoji marquee belt — quiet divider */
|
||||
.social-fx-belt {
|
||||
overflow: hidden;
|
||||
padding: 10px 0 18px;
|
||||
padding: 6px 0 10px;
|
||||
opacity: 0.35;
|
||||
mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
|
||||
}
|
||||
|
||||
@ -122,15 +122,15 @@
|
||||
display: flex;
|
||||
width: max-content;
|
||||
gap: 0;
|
||||
animation: social-belt-run 22s linear infinite;
|
||||
animation: social-belt-run 48s linear infinite;
|
||||
}
|
||||
|
||||
.social-fx-belt-track span {
|
||||
padding-right: 48px;
|
||||
font-size: 1.35rem;
|
||||
letter-spacing: 0.35em;
|
||||
padding-right: 56px;
|
||||
font-size: 0.95rem;
|
||||
letter-spacing: 0.45em;
|
||||
white-space: nowrap;
|
||||
opacity: 0.55;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
@keyframes social-belt-run {
|
||||
@ -188,9 +188,10 @@
|
||||
|
||||
.social-title-emoji {
|
||||
display: inline-block;
|
||||
margin-right: 0.35em;
|
||||
animation: social-emoji-wiggle 1.8s ease-in-out infinite;
|
||||
transform-origin: 50% 80%;
|
||||
margin-right: 0.28em;
|
||||
opacity: 0.82;
|
||||
animation: none;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
@keyframes social-emoji-wiggle {
|
||||
@ -198,14 +199,8 @@
|
||||
100% {
|
||||
transform: rotate(0deg) scale(1);
|
||||
}
|
||||
20% {
|
||||
transform: rotate(-14deg) scale(1.18);
|
||||
}
|
||||
40% {
|
||||
transform: rotate(12deg) scale(1.1);
|
||||
}
|
||||
60% {
|
||||
transform: rotate(-8deg) scale(1.14);
|
||||
50% {
|
||||
transform: rotate(2deg) scale(1.02);
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,24 +508,25 @@
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 1.6rem;
|
||||
letter-spacing: 0.4em;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 0.2em;
|
||||
pointer-events: none;
|
||||
animation: social-burst-up 0.75s ease forwards;
|
||||
opacity: 0.55;
|
||||
animation: social-burst-up 0.55s ease forwards;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
@keyframes social-burst-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px) scale(0.7);
|
||||
transform: translateY(6px) scale(0.9);
|
||||
}
|
||||
35% {
|
||||
opacity: 1;
|
||||
40% {
|
||||
opacity: 0.55;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: translateY(-36px) scale(1.35);
|
||||
transform: translateY(-18px) scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -746,9 +746,15 @@ html.light .social-flow,
|
||||
|
||||
/* Immersive Meetup live room — stay in-app, no new tab */
|
||||
.social-live-root {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
min-height: 100dvh;
|
||||
height: 100dvh;
|
||||
max-height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: var(--sc-bg, #0a0e17);
|
||||
}
|
||||
|
||||
.social-live-bar {
|
||||
@ -845,14 +851,15 @@ html.light .social-flow,
|
||||
}
|
||||
|
||||
.social-live-stage {
|
||||
flex: 1;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.social-live-stage.layout-split {
|
||||
grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
|
||||
grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
|
||||
}
|
||||
|
||||
.social-live-stage.layout-video,
|
||||
@ -863,6 +870,7 @@ html.light .social-flow,
|
||||
.social-live-video,
|
||||
.social-live-chat {
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-left: var(--sc-border);
|
||||
@ -875,16 +883,18 @@ html.light .social-flow,
|
||||
|
||||
.social-live-frame-wrap {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
min-height: min(70vh, 720px);
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
background: #05070c;
|
||||
}
|
||||
|
||||
.social-live-iframe {
|
||||
flex: 1;
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
min-height: min(70vh, 720px);
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
border: 0;
|
||||
background: #000;
|
||||
}
|
||||
@ -1004,17 +1014,28 @@ html.light .social-flow,
|
||||
@media (max-width: 900px) {
|
||||
.social-live-stage.layout-split {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: minmax(42vh, 1fr) minmax(38vh, 1fr);
|
||||
grid-template-rows: minmax(48dvh, 1.2fr) minmax(34dvh, 0.9fr);
|
||||
}
|
||||
|
||||
.social-live-chat {
|
||||
border-left: none;
|
||||
border-top: var(--sc-border);
|
||||
}
|
||||
}
|
||||
|
||||
.social-live-iframe {
|
||||
min-height: 42vh;
|
||||
}
|
||||
/* Live / full-bleed rooms: hide floating FX chrome that steals viewport */
|
||||
.social-experience:has(.social-live-root) .social-fx-control,
|
||||
.social-experience:has(.social-live-root) .social-ambient,
|
||||
.social-experience:has(.social-live-root) .social-pointer-glow,
|
||||
.social-experience:has(.social-workspace-dense) .social-fx-control {
|
||||
display: none !important;
|
||||
}
|
||||
.social-experience:has(.social-live-root) .social-ambient,
|
||||
.social-experience:has(.social-live-root) .social-pointer-glow {
|
||||
display: none !important;
|
||||
}
|
||||
.social-experience:has(.social-live-root) .social-constellation {
|
||||
opacity: 0.18;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
|
||||
@ -218,10 +218,14 @@
|
||||
}
|
||||
.connection-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 25px;
|
||||
gap: 14px 22px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.connection-actions .connection-film {
|
||||
text-decoration: none;
|
||||
}
|
||||
.social-home .connection-join {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@ -585,22 +589,22 @@
|
||||
font-size: 8px;
|
||||
}
|
||||
|
||||
/* Three clear doors into the existing product. */
|
||||
/* Entry doors into the product. */
|
||||
.connection-ways {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 14px;
|
||||
margin-bottom: 50px;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.connection-way {
|
||||
--way-accent: var(--connection-mint);
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 25px 22px;
|
||||
gap: 12px;
|
||||
padding: 18px 16px;
|
||||
border: 1px solid var(--connection-border);
|
||||
border-radius: 15px;
|
||||
background: linear-gradient(
|
||||
@ -1629,14 +1633,14 @@
|
||||
display: none;
|
||||
}
|
||||
.connection-ways {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 8px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.connection-way {
|
||||
min-height: 83px;
|
||||
padding: 16px 18px;
|
||||
gap: 16px;
|
||||
min-height: 72px;
|
||||
padding: 14px 14px;
|
||||
gap: 12px;
|
||||
}
|
||||
.connection-way-icon {
|
||||
width: 40px;
|
||||
|
||||
@ -293,6 +293,17 @@
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.social-chat-starters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
max-width: 420px;
|
||||
}
|
||||
.social-chat-starters .social-btn {
|
||||
font-size: 12px;
|
||||
min-height: 40px;
|
||||
}
|
||||
.social-composer-emoji {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
@ -1176,3 +1187,356 @@
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.social-home .social-date-hero {
|
||||
text-align: left;
|
||||
justify-items: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
/* —— Date / 约会 swipe deck —— */
|
||||
.social-date-root {
|
||||
background:
|
||||
radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 107, 107, 0.16), transparent 60%),
|
||||
var(--sc-bg, #0a0e17);
|
||||
}
|
||||
.social-date-bar {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.social-date-bar-tools {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.social-date-stage {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 18px;
|
||||
padding: 12px 16px 24px;
|
||||
}
|
||||
.social-date-deck {
|
||||
position: relative;
|
||||
width: min(420px, 100%);
|
||||
height: min(620px, calc(100dvh - 220px));
|
||||
min-height: 420px;
|
||||
}
|
||||
.social-date-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 24px;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: #12141c;
|
||||
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
will-change: transform;
|
||||
}
|
||||
.social-date-card.is-next {
|
||||
transform: scale(0.96) translateY(12px);
|
||||
opacity: 0.75;
|
||||
pointer-events: none;
|
||||
}
|
||||
.social-date-card.is-top {
|
||||
cursor: grab;
|
||||
z-index: 2;
|
||||
transition: transform 0.18s ease;
|
||||
}
|
||||
.social-date-card.is-dragging {
|
||||
cursor: grabbing;
|
||||
transition: none;
|
||||
}
|
||||
.social-date-card.is-fly-like {
|
||||
animation: social-date-fly-like 0.28s ease-in forwards;
|
||||
}
|
||||
.social-date-card.is-fly-pass {
|
||||
animation: social-date-fly-pass 0.28s ease-in forwards;
|
||||
}
|
||||
@keyframes social-date-fly-like {
|
||||
to {
|
||||
transform: translate3d(130vw, 40px, 0) rotate(28deg);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes social-date-fly-pass {
|
||||
to {
|
||||
transform: translate3d(-130vw, 40px, 0) rotate(-28deg);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.social-date-photo {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-position: center top;
|
||||
background-size: cover;
|
||||
}
|
||||
.social-date-gradient {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
transparent 38%,
|
||||
rgba(8, 10, 16, 0.55) 62%,
|
||||
rgba(8, 10, 16, 0.92) 100%
|
||||
);
|
||||
}
|
||||
.social-date-meta {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
padding: 20px 18px 22px;
|
||||
color: #fff;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
.social-date-name h2 {
|
||||
margin: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: clamp(26px, 5vw, 34px);
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
.social-date-name h2 > i {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 999px;
|
||||
background: #22c55e;
|
||||
box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
|
||||
}
|
||||
.social-date-name p,
|
||||
.social-date-city,
|
||||
.social-date-bio,
|
||||
.social-date-want {
|
||||
margin: 0;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.social-date-city {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
color: #4ecdc4;
|
||||
}
|
||||
.social-date-want {
|
||||
color: rgba(255, 230, 109, 0.92);
|
||||
}
|
||||
.social-date-meta .social-tags {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.social-date-meta .social-tags span {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgba(255, 255, 255, 0.14);
|
||||
color: #fff;
|
||||
}
|
||||
.social-date-stamp {
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
z-index: 3;
|
||||
padding: 8px 14px;
|
||||
border: 3px solid;
|
||||
border-radius: 12px;
|
||||
font-weight: 850;
|
||||
letter-spacing: 0.08em;
|
||||
font-size: 20px;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
.social-date-stamp.like {
|
||||
left: 18px;
|
||||
color: #4ade80;
|
||||
border-color: #4ade80;
|
||||
background: rgba(34, 197, 94, 0.12);
|
||||
transform: rotate(-12deg);
|
||||
}
|
||||
.social-date-stamp.pass {
|
||||
right: 18px;
|
||||
color: #ff8f8f;
|
||||
border-color: #ff6b6b;
|
||||
background: rgba(255, 107, 107, 0.12);
|
||||
transform: rotate(12deg);
|
||||
}
|
||||
.social-date-online-pill {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 2;
|
||||
padding: 5px 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(34, 197, 94, 0.92);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.02em;
|
||||
box-shadow: 0 8px 20px rgba(34, 197, 94, 0.35);
|
||||
}
|
||||
.social-date-bio {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-date-want {
|
||||
font-weight: 600;
|
||||
}
|
||||
.social-date-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 18px;
|
||||
}
|
||||
.social-date-act {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(18, 20, 28, 0.92);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
transform 0.15s ease,
|
||||
box-shadow 0.15s ease;
|
||||
}
|
||||
.social-date-act:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.social-date-act:not(:disabled):hover {
|
||||
transform: translateY(-2px) scale(1.04);
|
||||
}
|
||||
.social-date-act.pass {
|
||||
color: #ff6b6b;
|
||||
box-shadow: 0 10px 28px rgba(255, 107, 107, 0.18);
|
||||
}
|
||||
.social-date-act.like {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
color: #22c55e;
|
||||
box-shadow: 0 12px 32px rgba(34, 197, 94, 0.22);
|
||||
}
|
||||
.social-date-act.reset {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: #ffe66d;
|
||||
}
|
||||
.social-date-empty {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-content: center;
|
||||
justify-items: center;
|
||||
gap: 12px;
|
||||
text-align: center;
|
||||
border-radius: 24px;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.16);
|
||||
background: rgba(18, 20, 28, 0.7);
|
||||
}
|
||||
.social-date-empty p {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.social-date-likes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
width: min(420px, 100%);
|
||||
padding: 10px 14px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 107, 107, 0.28);
|
||||
background: rgba(255, 107, 107, 0.08);
|
||||
font-size: 12px;
|
||||
color: #ffc4c0;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
}
|
||||
.social-date-likes > div {
|
||||
display: flex;
|
||||
}
|
||||
.social-date-likes > div > * {
|
||||
margin-left: -8px;
|
||||
border: 2px solid #0a0e17;
|
||||
border-radius: 999px;
|
||||
}
|
||||
.social-date-likes > div > *:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
.social-date-likes > em {
|
||||
margin-left: auto;
|
||||
font-style: normal;
|
||||
color: #4ecdc4;
|
||||
font-weight: 650;
|
||||
}
|
||||
.social-date-match-list {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.social-date-match-row {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
.social-date-match-row strong {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
}
|
||||
.social-date-match-row p {
|
||||
margin: 2px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--sc-muted, #9fb0bf);
|
||||
}
|
||||
.social-date-toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 28px;
|
||||
z-index: 30;
|
||||
translate: -50% 0;
|
||||
padding: 10px 16px;
|
||||
border-radius: 999px;
|
||||
background: rgba(12, 14, 20, 0.92);
|
||||
border: 1px solid rgba(78, 205, 196, 0.35);
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
pointer-events: none;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.social-date-deck {
|
||||
height: min(560px, calc(100dvh - 240px));
|
||||
min-height: 380px;
|
||||
}
|
||||
.social-date-act {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
}
|
||||
.social-date-act.like {
|
||||
width: 66px;
|
||||
height: 66px;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.social-date-card.is-top,
|
||||
.social-date-card.is-fly-like,
|
||||
.social-date-card.is-fly-pass {
|
||||
transition: none;
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,8 +61,8 @@
|
||||
}
|
||||
|
||||
.connection-hero .social-emoji-field {
|
||||
z-index: 1;
|
||||
opacity: 1;
|
||||
z-index: 0;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.connection-hero-layout {
|
||||
@ -71,8 +71,8 @@
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-emoji-float {
|
||||
opacity: 0.82 !important;
|
||||
filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45)) !important;
|
||||
opacity: 0.22 !important;
|
||||
filter: none !important;
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-timing-function: ease-in-out !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
@ -171,12 +171,12 @@
|
||||
animation: social-live-ping 1.35s ease-out infinite !important;
|
||||
}
|
||||
|
||||
/* Undo Codex display:none / animation:none */
|
||||
/* Title emoji: visible but calm (no infinite wiggle) */
|
||||
.social-experience[data-immersive="true"] .social-home .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
margin-right: 0.3em !important;
|
||||
animation: social-emoji-wiggle 1.6s ease-in-out infinite !important;
|
||||
transform-origin: 50% 80%;
|
||||
margin-right: 0.28em !important;
|
||||
animation: none !important;
|
||||
opacity: 0.85 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse {
|
||||
@ -291,7 +291,14 @@
|
||||
.social-home
|
||||
.connection-cafe
|
||||
.social-panel-ico {
|
||||
animation: social-ico-bounce 1.55s ease-in-out infinite !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.connection-cafe:hover
|
||||
.social-panel-ico {
|
||||
animation: social-ico-bounce 1.55s ease-in-out 1 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-chip-pop {
|
||||
@ -365,6 +372,61 @@
|
||||
animation-delay: var(--stagger, 0ms) !important;
|
||||
}
|
||||
|
||||
/* Workspace subpages share immersive FX with home */
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orbs {
|
||||
opacity: 0.58 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orb {
|
||||
animation: social-orb-drift 9s ease-in-out infinite !important;
|
||||
filter: blur(52px) !important;
|
||||
opacity: 0.55 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
margin-right: 0.28em;
|
||||
animation: none !important;
|
||||
opacity: 0.85 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse {
|
||||
position: relative !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::after {
|
||||
content: "" !important;
|
||||
display: block !important;
|
||||
position: absolute !important;
|
||||
inset: -5px !important;
|
||||
border-radius: inherit !important;
|
||||
border: 2px solid rgba(78, 205, 196, 0.5) !important;
|
||||
pointer-events: none !important;
|
||||
animation: social-btn-ring 1.45s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before {
|
||||
animation-delay: 0.7s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-room-hero-emoji i {
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-timing-function: ease-in-out !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
opacity: 0.25 !important;
|
||||
filter: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-role-art > i {
|
||||
animation: sx-orbit 18s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-page-intro .social-emoji-float {
|
||||
opacity: 0.2 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
* Immersive is an explicit opt-in. It must beat OS prefers-reduced-motion
|
||||
* (Windows “显示动画” off, automation browsers, etc.). Light mode still respects reduce.
|
||||
@ -381,12 +443,28 @@
|
||||
animation-iteration-count: infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb {
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orb {
|
||||
animation: social-orb-drift 8s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-title-emoji {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-room-hero-emoji i {
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
opacity: 0.22 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::after {
|
||||
animation: social-btn-ring 1.45s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-fx-belt-track {
|
||||
animation: social-belt-run 14s linear infinite !important;
|
||||
animation: social-belt-run 48s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-signal i {
|
||||
@ -417,7 +495,7 @@
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
animation: social-emoji-wiggle 1.6s ease-in-out infinite !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::before,
|
||||
|
||||
@ -150,6 +150,50 @@
|
||||
}
|
||||
.social-role-card {
|
||||
gap: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-role-art {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-height: 88px;
|
||||
margin: -4px -4px 4px;
|
||||
border-radius: 14px;
|
||||
background:
|
||||
radial-gradient(circle at 20% 30%, #4ecdc433, transparent 55%),
|
||||
radial-gradient(circle at 80% 70%, #ff6b6b28, transparent 50%),
|
||||
linear-gradient(135deg, #4ecdc40f, #ffe66d0a);
|
||||
color: var(--sx-mint);
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-role-art > span {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 10px;
|
||||
font-family: var(--font-display, inherit);
|
||||
font-size: 28px;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.06em;
|
||||
opacity: 0.22;
|
||||
}
|
||||
.social-role-art > i {
|
||||
position: absolute;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border: 1px solid #4ecdc433;
|
||||
border-radius: 50%;
|
||||
animation: sx-orbit 22s linear infinite;
|
||||
}
|
||||
.social-role-art > i:nth-of-type(2) {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border-color: #ff6b6b33;
|
||||
animation-direction: reverse;
|
||||
animation-duration: 16s;
|
||||
}
|
||||
.social-role-art > svg {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.social-role-symbol {
|
||||
display: grid;
|
||||
|
||||
1249
src/modules/social/app/vivid.css
Normal file
1249
src/modules/social/app/vivid.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,14 @@ import {
|
||||
useState,
|
||||
useSyncExternalStore,
|
||||
} from "react";
|
||||
import { MOCK_ROSTER, type SocialRosterMember } from "@social/lib/rosterMock";
|
||||
import Link from "next/link";
|
||||
import type { SocialRosterMember } from "@social/lib/rosterMock";
|
||||
import {
|
||||
SELF_MEMBER_ID,
|
||||
useDiscoveryRoster,
|
||||
} from "@social/lib/discoveryRoster";
|
||||
import { loadJson, saveJson } from "@social/lib/storage";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import SocialAvatar from "./SocialAvatar";
|
||||
import SectionSpark from "./SectionSpark";
|
||||
|
||||
@ -44,6 +50,7 @@ const FILTERS = [
|
||||
];
|
||||
|
||||
export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
const roster = useDiscoveryRoster();
|
||||
const likesSnapshot = useSyncExternalStore(
|
||||
subscribeLikes,
|
||||
getLikesSnapshot,
|
||||
@ -54,7 +61,7 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
[likesSnapshot],
|
||||
);
|
||||
const [filter, setFilter] = useState<"all" | "online" | "f" | "m">("all");
|
||||
const [activeId, setActiveId] = useState<string | null>(null);
|
||||
const [highlightId, setHighlightId] = useState<string | null>(null);
|
||||
const [burst, setBurst] = useState(false);
|
||||
const burstTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const filterId = useId();
|
||||
@ -64,16 +71,16 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
const id: unknown = (event as CustomEvent).detail;
|
||||
if (
|
||||
typeof id !== "string" ||
|
||||
!MOCK_ROSTER.some((member) => member.id === id)
|
||||
!roster.some((member) => member.id === id)
|
||||
)
|
||||
return;
|
||||
setFilter("all");
|
||||
setActiveId(id);
|
||||
setHighlightId(id);
|
||||
};
|
||||
window.addEventListener("nomadro-social-select-member", selectMember);
|
||||
return () =>
|
||||
window.removeEventListener("nomadro-social-select-member", selectMember);
|
||||
}, []);
|
||||
}, [roster]);
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
@ -83,20 +90,25 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
);
|
||||
|
||||
const list = useMemo(() => {
|
||||
return MOCK_ROSTER.filter((m) => {
|
||||
return roster.filter((m) => {
|
||||
if (filter === "online") return m.online;
|
||||
if (filter === "f" || filter === "m") return m.gender === filter;
|
||||
return true;
|
||||
});
|
||||
}, [filter]);
|
||||
}, [filter, roster]);
|
||||
|
||||
const online = useMemo(() => MOCK_ROSTER.filter((m) => m.online), []);
|
||||
const active = list.find((m) => m.id === activeId) || null;
|
||||
const online = useMemo(() => roster.filter((m) => m.online), [roster]);
|
||||
|
||||
const toggleLike = (m: SocialRosterMember) => {
|
||||
const toggleLike = (
|
||||
event: { preventDefault(): void; stopPropagation(): void },
|
||||
m: SocialRosterMember,
|
||||
) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
saveJson(LIKE_KEY, { ...likes, [m.id]: !likes[m.id] });
|
||||
window.dispatchEvent(new Event(LIKES_CHANGED));
|
||||
setBurst(true);
|
||||
setHighlightId(m.id);
|
||||
if (burstTimer.current) clearTimeout(burstTimer.current);
|
||||
burstTimer.current = setTimeout(() => setBurst(false), 700);
|
||||
};
|
||||
@ -111,16 +123,22 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="people" />
|
||||
<span className="section-tag">
|
||||
<span>01 / FIND YOUR PEOPLE</span>
|
||||
<span>有相似的热爱,也有不同的精彩</span>
|
||||
<span>看看谁在这儿</span>
|
||||
<span>点开认识</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
👋
|
||||
</span>
|
||||
这些人,也许你会想见
|
||||
想见的人
|
||||
</h2>
|
||||
<p>从好奇一个人的生活开始,让下一次相遇自然发生。</p>
|
||||
<p>
|
||||
点开卡片,看看对方在做什么、想认识谁。
|
||||
现在是示例介绍,方便你先逛逛
|
||||
{roster.some((m) => m.id === SELF_MEMBER_ID)
|
||||
? "(也包含你写好的介绍)"
|
||||
: ""}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="social-people-bar reveal">
|
||||
@ -131,15 +149,15 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
</div>
|
||||
<p>
|
||||
<strong className="social-count-pulse">{online.length}</strong>{" "}
|
||||
位演示在线
|
||||
<span> · 非实时统计</span>
|
||||
位现在在线
|
||||
<span> · 示例数据</span>
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm social-btn-pulse"
|
||||
onClick={onJoin}
|
||||
>
|
||||
加群认识
|
||||
加入社区认识
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -160,7 +178,7 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
className={`social-people-filter${filter === f.id ? " active" : ""}`}
|
||||
onClick={() => {
|
||||
setFilter(f.id);
|
||||
setActiveId(null);
|
||||
setHighlightId(null);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
const key = event.key;
|
||||
@ -178,7 +196,7 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
FILTERS.length;
|
||||
const next = FILTERS[nextIndex];
|
||||
setFilter(next.id);
|
||||
setActiveId(null);
|
||||
setHighlightId(null);
|
||||
document.getElementById(`${filterId}-${next.id}`)?.focus();
|
||||
}}
|
||||
>
|
||||
@ -194,13 +212,12 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
aria-labelledby={`${filterId}-${filter}`}
|
||||
>
|
||||
{list.map((m, i) => (
|
||||
<button
|
||||
<Link
|
||||
key={m.id}
|
||||
type="button"
|
||||
className={`social-people-chip social-chip-pop${m.online ? " is-online" : ""}${likes[m.id] ? " is-liked" : ""}${activeId === m.id ? " is-active" : ""}`}
|
||||
href={socialPath(`/people/${m.id}`)}
|
||||
className={`social-people-chip social-chip-pop is-rich${m.online ? " is-online" : ""}${likes[m.id] ? " is-liked" : ""}${highlightId === m.id ? " is-active" : ""}`}
|
||||
style={{ ["--stagger" as string]: `${Math.min(i, 12) * 40}ms` }}
|
||||
onClick={() => setActiveId(activeId === m.id ? null : m.id)}
|
||||
aria-pressed={activeId === m.id}
|
||||
onClick={() => setHighlightId(m.id)}
|
||||
>
|
||||
<span className="social-people-chip-ava">
|
||||
<SocialAvatar src={m.avatar} size={52} lazy />
|
||||
@ -211,69 +228,54 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
</em>
|
||||
) : null}
|
||||
</span>
|
||||
<strong>{m.name}</strong>
|
||||
<span className="connection-member-role">{m.title}</span>
|
||||
<em>{m.city.split("·")[0].trim()}</em>
|
||||
</button>
|
||||
<strong>
|
||||
{m.name}
|
||||
{m.id === SELF_MEMBER_ID ? " · 我" : ""}
|
||||
</strong>
|
||||
<span className="connection-member-role">
|
||||
{m.title}
|
||||
{m.vibe ? ` · ${m.vibe.split("·")[0].trim()}` : ""}
|
||||
</span>
|
||||
<em>
|
||||
{m.city.split("·")[0].trim()}
|
||||
{m.tags[0] ? ` · ${m.tags[0]}` : ""}
|
||||
</em>
|
||||
<span className="social-people-chip-want" title={m.lookingFor}>
|
||||
{m.lookingFor}
|
||||
</span>
|
||||
<span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className="social-people-chip-like"
|
||||
aria-label={likes[m.id] ? "取消关注" : "关注"}
|
||||
onClick={(e) => toggleLike(e, m)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") toggleLike(e, m);
|
||||
}}
|
||||
>
|
||||
{likes[m.id] ? "♥" : "♡"}
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{active ? (
|
||||
<div
|
||||
className={`social-people-detail social-detail-in reveal visible${burst ? " is-burst" : ""}`}
|
||||
role="status"
|
||||
>
|
||||
{burst ? (
|
||||
<span className="social-burst" aria-hidden>
|
||||
✨💫💖
|
||||
</span>
|
||||
) : null}
|
||||
<SocialAvatar src={active.avatar} size={44} />
|
||||
<div>
|
||||
<strong>
|
||||
{active.name}
|
||||
<span>
|
||||
{active.title} · {active.city}
|
||||
{active.online ? " · 在线" : ""}
|
||||
</span>
|
||||
</strong>
|
||||
<p>{active.lookingFor}</p>
|
||||
<div className="social-people-detail-tags">
|
||||
{active.tags.slice(0, 3).map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-people-detail-acts">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm"
|
||||
onClick={() => toggleLike(active)}
|
||||
>
|
||||
{likes[active.id] ? "♥ 已关注" : "♡ 关注"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm social-btn-pulse"
|
||||
onClick={onJoin}
|
||||
>
|
||||
打招呼 👋
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="social-people-hint">
|
||||
👆 点选一位,看 TA 想认识什么样的人
|
||||
</p>
|
||||
)}
|
||||
{burst ? (
|
||||
<span className="social-burst social-burst-float" aria-hidden>
|
||||
♥
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
<p className="social-people-hint">👆 点卡片看看详情,也可以先点爱心关注</p>
|
||||
|
||||
<div className="social-section-actions reveal">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary social-btn-pulse"
|
||||
onClick={onJoin}
|
||||
>
|
||||
加群,认识他们 ✨
|
||||
<Link href={socialPath("/people")} className="btn btn-primary">
|
||||
看看更多人
|
||||
</Link>
|
||||
<Link href={socialPath("/date")} className="btn btn-ghost">
|
||||
去左右滑认识
|
||||
</Link>
|
||||
<button type="button" className="btn btn-ghost" onClick={onJoin}>
|
||||
加入社区
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ import {
|
||||
type FormEvent,
|
||||
} from "react";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import {
|
||||
ArrowUpRight,
|
||||
Coffee,
|
||||
@ -20,18 +21,22 @@ import {
|
||||
Wifi,
|
||||
} from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import CityDirectory from "./CityDirectory";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
PageIntro,
|
||||
SearchField,
|
||||
ShareButton,
|
||||
} from "./SocialUI";
|
||||
import { SEED_CAFES } from "@social/lib/seed";
|
||||
import { socialApi } from "@social/lib/api";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { uid } from "@social/lib/storage";
|
||||
import { resolveSocialCatalog } from "@social/lib/resolveCatalog";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import type { SocialCafe, SocialCafeReview } from "@social/lib/types";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
|
||||
type Review = SocialCafeReview & { local?: boolean };
|
||||
|
||||
@ -52,6 +57,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
const [author, setAuthor] = useLocalState("nick", "游民");
|
||||
const [score, setScore] = useState(5);
|
||||
const [text, setText] = useState("");
|
||||
const [photoNote, setPhotoNote] = useState("");
|
||||
const [status, setStatus] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const lock = useRef(false);
|
||||
@ -71,7 +77,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
})
|
||||
.catch(() => {
|
||||
if (active)
|
||||
setStatus("当前离线:本机评价尚未送达社区,可联网后手动重试。");
|
||||
setStatus("网络不太好:评价先留在你这边了,有网后再点「再发一次」。");
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
@ -80,8 +86,18 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
const submit = async (event?: FormEvent, retry?: Review) => {
|
||||
event?.preventDefault();
|
||||
const payload = retry
|
||||
? { author: retry.author, score: retry.score, text: retry.text }
|
||||
: { author: author.trim() || "游民", score, text: text.trim() };
|
||||
? {
|
||||
author: retry.author,
|
||||
score: retry.score,
|
||||
text: retry.text,
|
||||
photoNote: retry.photoNote,
|
||||
}
|
||||
: {
|
||||
author: author.trim() || "游民",
|
||||
score,
|
||||
text: text.trim(),
|
||||
photoNote: photoNote.trim() || undefined,
|
||||
};
|
||||
if (!payload.text || lock.current) return;
|
||||
lock.current = true;
|
||||
setBusy(true);
|
||||
@ -102,8 +118,11 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
.catch(() =>
|
||||
setStatus("评价已发布;列表暂未刷新,请稍后重新打开查看。"),
|
||||
);
|
||||
setStatus("评价已发布,谢谢你分享真实体验。");
|
||||
if (!retry && textRef.current.trim() === payload.text) setText("");
|
||||
setStatus("评价已发布");
|
||||
if (!retry && textRef.current.trim() === payload.text) {
|
||||
setText("");
|
||||
setPhotoNote("");
|
||||
}
|
||||
} catch {
|
||||
if (!retry)
|
||||
setReviews((current) => [
|
||||
@ -116,20 +135,27 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
},
|
||||
...current,
|
||||
]);
|
||||
setStatus("已保存到本机,尚未发布。联网后可点击评价下方的「重试发布」。");
|
||||
if (!retry && textRef.current.trim() === payload.text) setText("");
|
||||
setStatus("先留在你这边了。有网后点评价下面的「再发一次」就行。");
|
||||
if (!retry && textRef.current.trim() === payload.text) {
|
||||
setText("");
|
||||
setPhotoNote("");
|
||||
}
|
||||
} finally {
|
||||
lock.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
const invitation = `有朋友想在${cafe.city}的 ${cafe.name} 喝杯咖啡聊聊吗?想交流远程工作和最近的生活。`;
|
||||
const invitation = `有人约在 ${cafe.city} · ${cafe.name} 喝咖啡,一起聊聊远程生活?`;
|
||||
return (
|
||||
<section className="social-panel social-cafe-detail" id={id}>
|
||||
<div className="social-cafe-detail-hero" aria-hidden>
|
||||
<Coffee size={42} strokeWidth={1.2} />
|
||||
<span>{cafe.city}</span>
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
<span>THE NEXT COFFEE COULD CHANGE EVERYTHING</span>
|
||||
<span>详情</span>
|
||||
<ShareButton
|
||||
path={`/social/coffeechat#${cafe.id}`}
|
||||
path={socialPath(`/coffeechat#${cafe.id}`)}
|
||||
title={`${cafe.city} · ${cafe.name}`}
|
||||
/>
|
||||
</div>
|
||||
@ -148,28 +174,31 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
</span>
|
||||
<span>
|
||||
<Star size={15} />
|
||||
目录评分 {cafe.rating}
|
||||
{cafe.rating}
|
||||
</span>
|
||||
<span>{cafe.partners ? "推荐见面点" : "社区收录"}</span>
|
||||
</div>
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={`/social/chat/coffee?intro=${encodeURIComponent(invitation)}`}
|
||||
className="social-btn coral"
|
||||
href={socialPath(
|
||||
`/chat?intro=${encodeURIComponent(invitation)}`,
|
||||
)}
|
||||
>
|
||||
<MessageCircle size={15} />
|
||||
发起公开 Coffeechat 邀约 <ArrowUpRight size={15} />
|
||||
去聊天室约人 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
<p className="social-muted social-cafe-invite-note">
|
||||
先在公开频道交流时间与人数,确认后再安排见面。
|
||||
先在聊天室约好时间,再出来见面。评分供参考,你也可以留下自己的体验。
|
||||
</p>
|
||||
<div className="social-review-layout">
|
||||
<div>
|
||||
<h3>真实体验,让下一次约见更轻松。</h3>
|
||||
<h3>写评价</h3>
|
||||
<form
|
||||
className="social-form"
|
||||
onSubmit={(event) => void submit(event)}
|
||||
>
|
||||
<label>
|
||||
你的名字
|
||||
名字
|
||||
<input
|
||||
value={author}
|
||||
onChange={(event) => setAuthor(event.target.value)}
|
||||
@ -178,7 +207,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
/>
|
||||
</label>
|
||||
<fieldset className="social-star-rating">
|
||||
<legend>你的评分</legend>
|
||||
<legend>评分</legend>
|
||||
{[1, 2, 3, 4, 5].map((value) => (
|
||||
<button
|
||||
type="button"
|
||||
@ -196,14 +225,23 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
))}
|
||||
</fieldset>
|
||||
<label>
|
||||
分享一次真实体验
|
||||
体验
|
||||
<textarea
|
||||
required
|
||||
rows={4}
|
||||
maxLength={1000}
|
||||
value={text}
|
||||
onChange={(event) => setText(event.target.value)}
|
||||
placeholder="网络稳定吗?插座够不够?适合安静工作还是深聊?"
|
||||
placeholder="网速 / 插座 / 适合工作还是聊天"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
合照备注(选填)
|
||||
<input
|
||||
maxLength={200}
|
||||
value={photoNote}
|
||||
onChange={(event) => setPhotoNote(event.target.value)}
|
||||
placeholder="例如:二楼靠窗合影位很好拍"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
@ -211,19 +249,18 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
className="social-btn"
|
||||
disabled={busy || !text.trim()}
|
||||
>
|
||||
{busy ? "正在提交…" : "发布评价"}
|
||||
{busy ? "提交中…" : "发布"}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<div className="social-section-label">
|
||||
社区评价 <span>{reviews.length} 条(含本机未发布)</span>
|
||||
评价 <span>{reviews.length}</span>
|
||||
</div>
|
||||
{!reviews.length ? (
|
||||
<EmptyState
|
||||
title="第一条真实评价,从你开始"
|
||||
description="你的一个小建议,可能帮下一位游民找到熟悉感。"
|
||||
/>
|
||||
<EmptyState title="还没有评价" description="写一条帮后来的人。">
|
||||
<span className="social-muted">也可以先写在你这边</span>
|
||||
</EmptyState>
|
||||
) : (
|
||||
<div className="social-review-list">
|
||||
{reviews.map((review) => (
|
||||
@ -235,6 +272,9 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
</span>
|
||||
</header>
|
||||
<p>{review.text}</p>
|
||||
{review.photoNote ? (
|
||||
<p className="social-muted">合照:{review.photoNote}</p>
|
||||
) : null}
|
||||
<small suppressHydrationWarning>
|
||||
{new Date(review.at).toLocaleDateString()}
|
||||
</small>
|
||||
@ -244,7 +284,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
disabled={busy}
|
||||
onClick={() => void submit(undefined, review)}
|
||||
>
|
||||
仅本机 · 重试发布
|
||||
还没发出 · 再发一次
|
||||
</button>
|
||||
)}
|
||||
</article>
|
||||
@ -255,7 +295,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
</div>
|
||||
{status && (
|
||||
<p
|
||||
className={`social-status${status.includes("本机") ? " warn" : ""}`}
|
||||
className={`social-status${status.includes("你这边") || status.includes("网络不太好") ? " warn" : ""}`}
|
||||
role="status"
|
||||
>
|
||||
{status}
|
||||
@ -266,50 +306,81 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {
|
||||
}
|
||||
|
||||
export default function CafeDirectory() {
|
||||
const [query, setQuery] = useState("");
|
||||
const [city, setCity] = useState("all");
|
||||
const config = useSocialConfig();
|
||||
const searchParams = useSearchParams();
|
||||
const catalog = useMemo(
|
||||
() => resolveSocialCatalog(config.copy.socialCatalogs),
|
||||
[config.copy.socialCatalogs],
|
||||
);
|
||||
const seedCafes = catalog.cafes;
|
||||
const cityParam = (searchParams.get("city") || "").trim();
|
||||
const initialCity = useMemo(() => {
|
||||
if (!cityParam) return "all";
|
||||
const exact = seedCafes.find((c) => c.city === cityParam)?.city;
|
||||
if (exact) return exact;
|
||||
const fuzzy = seedCafes.find((c) =>
|
||||
c.city.includes(cityParam) || cityParam.includes(c.city),
|
||||
)?.city;
|
||||
return fuzzy || "all";
|
||||
}, [cityParam, seedCafes]);
|
||||
const [query, setQuery] = useState(cityParam && initialCity === "all" ? cityParam : "");
|
||||
const [city, setCity] = useState(initialCity);
|
||||
const [sort, setSort] = useState("recommended");
|
||||
useEffect(() => {
|
||||
setCity(initialCity);
|
||||
if (cityParam && initialCity === "all") setQuery(cityParam);
|
||||
}, [initialCity, cityParam]);
|
||||
const selected =
|
||||
useSyncExternalStore(
|
||||
subscribeHash,
|
||||
() => location.hash.slice(1),
|
||||
() => "",
|
||||
) || SEED_CAFES[0].id;
|
||||
) || seedCafes[0]?.id || "";
|
||||
const [saved] = useLocalState<string[]>("saved-cafes", []);
|
||||
const id = useId();
|
||||
const cafes = useMemo(
|
||||
() =>
|
||||
SEED_CAFES.filter(
|
||||
(cafe) =>
|
||||
(city === "all" || cafe.city === city) &&
|
||||
(sort !== "saved" || saved.includes(cafe.id)) &&
|
||||
`${cafe.name} ${cafe.city} ${cafe.vibe}`
|
||||
.toLowerCase()
|
||||
.includes(query.toLowerCase()),
|
||||
).sort((a, b) =>
|
||||
sort === "wifi"
|
||||
? b.wifiMbps - a.wifiMbps
|
||||
: sort === "rating"
|
||||
? b.rating - a.rating
|
||||
: 0,
|
||||
),
|
||||
[query, city, sort, saved],
|
||||
seedCafes
|
||||
.filter(
|
||||
(cafe) =>
|
||||
(city === "all" || cafe.city === city) &&
|
||||
(sort !== "saved" || saved.includes(cafe.id)) &&
|
||||
`${cafe.name} ${cafe.city} ${cafe.vibe}`
|
||||
.toLowerCase()
|
||||
.includes(query.toLowerCase()),
|
||||
)
|
||||
.sort((a, b) =>
|
||||
sort === "wifi"
|
||||
? b.wifiMbps - a.wifiMbps
|
||||
: sort === "rating"
|
||||
? b.rating - a.rating
|
||||
: 0,
|
||||
),
|
||||
[query, city, sort, saved, seedCafes],
|
||||
);
|
||||
const active = cafes.find((cafe) => cafe.id === selected) || cafes[0];
|
||||
return (
|
||||
<SiteShell title="Coffeechat">
|
||||
<PageIntro
|
||||
eyebrow="GOOD COFFEE. BETTER COMPANY."
|
||||
title="先约一杯咖啡,"
|
||||
accent="再把网友变成朋友。"
|
||||
description="找一个有插座、有好咖啡,也容得下好对话的地方。按城市找店,把下一次见面安排得更轻松。"
|
||||
/>
|
||||
<div className="social-toolbar">
|
||||
<SiteShell title="见一面">
|
||||
<PageIntro title="同城,见一面" accent="城市与咖啡馆">
|
||||
<DemoBadge>
|
||||
{catalog.source === "remote" ? "最新地点" : "先看看这些地方"}
|
||||
</DemoBadge>
|
||||
</PageIntro>
|
||||
<p className="social-muted reveal" style={{ marginBottom: 16 }}>
|
||||
先选城市,找到同城的人,再挑一家咖啡馆出来坐坐。
|
||||
</p>
|
||||
<div className="social-cafe-cities reveal">
|
||||
<CityDirectory compact />
|
||||
</div>
|
||||
<h3 className="social-section-label reveal" style={{ marginTop: 28 }}>
|
||||
适合见面的咖啡馆
|
||||
</h3>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label="搜索咖啡馆"
|
||||
placeholder="搜索店名、城市、氛围…"
|
||||
placeholder="店名 / 城市 / 氛围"
|
||||
/>
|
||||
<select
|
||||
aria-label="咖啡馆排序"
|
||||
@ -317,14 +388,14 @@ export default function CafeDirectory() {
|
||||
value={sort}
|
||||
onChange={(event) => setSort(event.target.value)}
|
||||
>
|
||||
<option value="recommended">目录顺序</option>
|
||||
<option value="wifi">网络优先</option>
|
||||
<option value="rating">评分优先</option>
|
||||
<option value="saved">我的收藏</option>
|
||||
<option value="recommended">推荐</option>
|
||||
<option value="wifi">网速</option>
|
||||
<option value="rating">评分</option>
|
||||
<option value="saved">收藏</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="social-filters social-city-filters">
|
||||
{["all", ...new Set(SEED_CAFES.map((cafe) => cafe.city))].map(
|
||||
<div className="social-filters social-city-filters reveal">
|
||||
{["all", ...new Set(seedCafes.map((cafe) => cafe.city))].map(
|
||||
(value) => (
|
||||
<button
|
||||
type="button"
|
||||
@ -333,21 +404,19 @@ export default function CafeDirectory() {
|
||||
key={value}
|
||||
onClick={() => setCity(value)}
|
||||
>
|
||||
{value === "all" ? "所有城市" : value}
|
||||
{value === "all" ? "全部" : value}
|
||||
</button>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
把相遇放进日常{" "}
|
||||
<span>地点与评分为种子目录参考,出发前请核实营业信息。</span>
|
||||
</div>
|
||||
<div className="social-cafe-layout">
|
||||
<div className="social-grid social-cafe-grid">
|
||||
{cafes.map((cafe, index) => (
|
||||
<article
|
||||
key={cafe.id}
|
||||
id={cafe.id}
|
||||
className={`social-card cafe-color-${index % 4}${active?.id === cafe.id ? " active" : ""}`}
|
||||
className={`social-card social-panel-fx reveal cafe-color-${index % 4}${active?.id === cafe.id ? " active" : ""}`}
|
||||
style={{ ["--stagger" as string]: `${index * 70}ms` }}
|
||||
>
|
||||
<div className="social-cafe-art" aria-hidden="true">
|
||||
<Coffee size={45} strokeWidth={1} />
|
||||
@ -366,7 +435,7 @@ export default function CafeDirectory() {
|
||||
<div className="social-tags">
|
||||
<span>★ {cafe.rating}</span>
|
||||
<span>WiFi {cafe.wifiMbps}M</span>
|
||||
<span>{cafe.partners ? "合作目录" : "社区收录"}</span>
|
||||
<span>{cafe.partners ? "推荐见面点" : "社区收录"}</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
@ -385,14 +454,37 @@ export default function CafeDirectory() {
|
||||
});
|
||||
}}
|
||||
>
|
||||
{active?.id === cafe.id ? "正在查看" : "看看这里"}
|
||||
{active?.id === cafe.id ? "查看中" : "详情"}
|
||||
<ArrowUpRight size={14} />
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
{!cafes.length && <EmptyState />}
|
||||
{!cafes.length && (
|
||||
<EmptyState
|
||||
emoji="☕"
|
||||
title="没有咖啡馆"
|
||||
description="换城市或清空筛选。"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setQuery("");
|
||||
setCity("all");
|
||||
setSort("recommended");
|
||||
}}
|
||||
>
|
||||
重置筛选
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
{active && (
|
||||
<aside className="social-cafe-aside">
|
||||
<CafeDetail key={active.id} cafe={active} id={id} />
|
||||
</aside>
|
||||
)}
|
||||
</div>
|
||||
{active && <CafeDetail key={active.id} cafe={active} id={id} />}
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,102 +1,42 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowUpRight,
|
||||
Coffee,
|
||||
Hash,
|
||||
MessageCircle,
|
||||
Radio,
|
||||
Sparkles,
|
||||
} from "lucide-react";
|
||||
import { ArrowUpRight, Hash, MessageCircle } from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import { BookmarkButton, EmptyState, PageIntro, SearchField } from "./SocialUI";
|
||||
import { SEED_CHANNELS } from "@social/lib/seed";
|
||||
import { DemoBadge, PageIntro } from "./SocialUI";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { SOCIAL_CHAT_ID } from "./ChatWorkspace";
|
||||
import { SEED_CHANNELS } from "@social/lib/seed";
|
||||
|
||||
const ICONS = [MessageCircle, Sparkles, Radio, Coffee];
|
||||
const STARTERS = [
|
||||
"大家好,第一次加入!你们都在哪座城市远程工作?",
|
||||
"最近在找适合办公的咖啡馆,有什么宝藏推荐?",
|
||||
"最近在做一个小项目,有想一起交流产品的朋友吗?",
|
||||
];
|
||||
/** Legacy multi-channel UI retired — product is a single public lobby. */
|
||||
export default function ChannelDirectory() {
|
||||
const [query, setQuery] = useState("");
|
||||
const channels = SEED_CHANNELS.filter((item) =>
|
||||
`${item.name} ${item.topic}`.toLowerCase().includes(query.toLowerCase()),
|
||||
);
|
||||
const channel =
|
||||
SEED_CHANNELS.find((item) => item.id === SOCIAL_CHAT_ID) ||
|
||||
SEED_CHANNELS[0];
|
||||
return (
|
||||
<SiteShell title="话题聊天室">
|
||||
<PageIntro
|
||||
eyebrow="CONVERSATIONS THAT CONNECT"
|
||||
title="一句你好,"
|
||||
accent="打开一整个世界。"
|
||||
description="聊远程工作,交换城市情报,分享一个今天的小发现。公开频道里,总有一段对话值得你加入。"
|
||||
/>
|
||||
<div className="social-toolbar">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder="搜索城市、频道或话题…"
|
||||
label="搜索频道"
|
||||
/>
|
||||
<span className="social-muted">{channels.length} 个话题频道</span>
|
||||
</div>
|
||||
<div className="social-grid social-channel-grid">
|
||||
{channels.map((channel) => {
|
||||
const index = SEED_CHANNELS.findIndex(
|
||||
(item) => item.id === channel.id,
|
||||
);
|
||||
const Icon = ICONS[index % ICONS.length];
|
||||
return (
|
||||
<article
|
||||
className={`social-card social-channel-card channel-${index}`}
|
||||
key={channel.id}
|
||||
>
|
||||
<div className="social-card-top">
|
||||
<span className="social-card-ico">
|
||||
<Icon size={25} strokeWidth={1.5} />
|
||||
</span>
|
||||
<span className="social-badge">公开频道</span>
|
||||
</div>
|
||||
<strong>{channel.name}</strong>
|
||||
<p>{channel.topic}</p>
|
||||
<div className="social-channel-preview">
|
||||
<Hash size={13} />
|
||||
<span>从报到开始,也可以先听听大家在聊什么。</span>
|
||||
</div>
|
||||
<div className="social-card-actions">
|
||||
<Link
|
||||
href={socialPath(`/chat/${channel.id}`)}
|
||||
className="social-btn primary"
|
||||
>
|
||||
加入对话 <ArrowUpRight size={14} />
|
||||
</Link>
|
||||
<BookmarkButton id={channel.id} collection="saved-channels" />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
{!channels.length && <EmptyState />}
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
不知道怎么开场? <span>点一个破冰话题,带进频道慢慢聊。</span>
|
||||
</div>
|
||||
<div className="social-icebreakers">
|
||||
{STARTERS.map((starter, index) => (
|
||||
<Link
|
||||
key={starter}
|
||||
href={socialPath(
|
||||
`/chat/general?intro=${encodeURIComponent(starter)}`,
|
||||
)}
|
||||
>
|
||||
<span>0{index + 1}</span>
|
||||
<p>{starter}</p>
|
||||
<ArrowUpRight size={17} />
|
||||
<SiteShell title="大家聊天">
|
||||
<PageIntro title="大家聊天" accent="打个招呼">
|
||||
<DemoBadge>一个聊天室,简单好找</DemoBadge>
|
||||
</PageIntro>
|
||||
<section className="social-panel social-channel-solo">
|
||||
<div className="social-card-top">
|
||||
<span className="social-card-ico">
|
||||
<MessageCircle size={25} strokeWidth={1.5} />
|
||||
</span>
|
||||
<span className="social-badge">随时可进</span>
|
||||
</div>
|
||||
<strong>{channel?.name || "大家聊天"}</strong>
|
||||
<p>{channel?.topic || "游民闲聊 · 打个招呼就好"}</p>
|
||||
<div className="social-channel-preview">
|
||||
<Hash size={13} />
|
||||
<span>约咖啡、打招呼、找人聊天,都在这里说一声就行。</span>
|
||||
</div>
|
||||
<div className="social-card-actions">
|
||||
<Link href={socialPath("/chat")} className="social-btn primary">
|
||||
进入聊天室 <ArrowUpRight size={14} />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
"use client";
|
||||
|
||||
export { default } from "./ChannelDirectory";
|
||||
import ChatWorkspace from "./ChatWorkspace";
|
||||
|
||||
/** 全站唯一聊天室;分类页暂时隐藏。 */
|
||||
export default function ChatListClient() {
|
||||
return <ChatWorkspace />;
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
import { useEffect, useRef, useState, type FormEvent } from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowDown,
|
||||
ArrowLeft,
|
||||
CheckCheck,
|
||||
CornerUpLeft,
|
||||
@ -14,20 +13,28 @@ import {
|
||||
WifiOff,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import { EmptyState, ShareButton } from "./SocialUI";
|
||||
import { DemoBadge, EmptyState, ShareButton } from "./SocialUI";
|
||||
import { SocialMobileDock } from "./SocialNavigation";
|
||||
import { SEED_CHANNELS } from "@social/lib/seed";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { useSocialChat } from "@social/lib/useSocialChat";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { loadJson } from "@social/lib/storage";
|
||||
|
||||
/** 全站唯一聊天室频道(分类页暂时隐藏) */
|
||||
export const SOCIAL_CHAT_ID = "general";
|
||||
|
||||
const EMOJIS = ["👋", "☕", "🌍", "✨", "🙌", "❤️", "💻", "🌴"];
|
||||
const STARTERS = [
|
||||
"大家好,第一次来,我在…",
|
||||
"有人一起找 cowork 吗?",
|
||||
"下一站想去哪座城?",
|
||||
];
|
||||
const STATUS = {
|
||||
connecting: "正在连接",
|
||||
online: "已连接社区",
|
||||
offline: "离线 · 消息仅保存在本机",
|
||||
preview: "示例对话 · 可以开始真实聊天",
|
||||
connecting: "正在连上…",
|
||||
online: "已连上,可以聊天",
|
||||
offline: "网络不太好 · 消息先留在你这边,有网再发",
|
||||
preview: "先看看示例 · 连上后会变成实时聊天",
|
||||
};
|
||||
|
||||
export function Conversation({
|
||||
@ -83,7 +90,7 @@ export function Conversation({
|
||||
? `回复 ${reply.author}:${reply.text.slice(0, 100)}\n${chat.draft}`
|
||||
: chat.draft;
|
||||
if (body.length > 2000) {
|
||||
setComposerError("包含引用的消息最多 2000 字,请缩短正文后重试。");
|
||||
setComposerError("消息过长,请缩短后重试。");
|
||||
return;
|
||||
}
|
||||
setComposerError("");
|
||||
@ -104,13 +111,13 @@ export function Conversation({
|
||||
>
|
||||
<div className="social-conversation-top">
|
||||
<div>
|
||||
<Hash size={21} />
|
||||
<Hash size={18} />
|
||||
<div>
|
||||
<strong>{channel.name.replace("#", "")}</strong>
|
||||
<p>{channel.topic}</p>
|
||||
</div>
|
||||
</div>
|
||||
<ShareButton path={`/social/chat/${channelId}`} title={channel.topic} />
|
||||
<ShareButton path={socialPath("/chat")} title={channel.topic} />
|
||||
</div>
|
||||
<div
|
||||
className={`social-connection-status ${chat.status === "offline" ? "offline" : ""}`}
|
||||
@ -118,7 +125,16 @@ export function Conversation({
|
||||
>
|
||||
{chat.status === "offline" ? <WifiOff size={12} /> : <Wifi size={12} />}
|
||||
{STATUS[chat.status]}
|
||||
<span>公开频道</span>
|
||||
{chat.status === "offline" ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
style={{ minHeight: 32, marginLeft: "auto" }}
|
||||
onClick={() => window.location.reload()}
|
||||
>
|
||||
刷新重连
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="social-thread-wrap">
|
||||
<div
|
||||
@ -137,9 +153,26 @@ export function Conversation({
|
||||
>
|
||||
{!chat.messages.length && (
|
||||
<EmptyState
|
||||
title="从你的一句你好开始"
|
||||
description="说说你在哪座城市,正在做什么,或最近对什么感兴趣。"
|
||||
/>
|
||||
emoji="💬"
|
||||
title="这里还很安静"
|
||||
description="点一句现成的话,或自己写一句打个招呼。网络不好时,话会先留在你这边。"
|
||||
>
|
||||
<div className="social-chat-starters">
|
||||
{STARTERS.map((starter) => (
|
||||
<button
|
||||
key={starter}
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setDraft(starter);
|
||||
composerRef.current?.focus();
|
||||
}}
|
||||
>
|
||||
{starter}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</EmptyState>
|
||||
)}
|
||||
{chat.messages.map((message) => (
|
||||
<article
|
||||
@ -177,7 +210,6 @@ export function Conversation({
|
||||
type="button"
|
||||
className={reactions[message.id] ? "liked" : ""}
|
||||
aria-pressed={Boolean(reactions[message.id])}
|
||||
title="反应保存在当前设备"
|
||||
onClick={() =>
|
||||
setReactions((current) => ({
|
||||
...current,
|
||||
@ -194,39 +226,35 @@ export function Conversation({
|
||||
disabled={chat.sending}
|
||||
onClick={() => void chat.send(message.text, message.id)}
|
||||
>
|
||||
仅本机 · 点击重试
|
||||
重试
|
||||
</button>
|
||||
) : (
|
||||
message.mine && (
|
||||
<span>
|
||||
<CheckCheck size={11} />
|
||||
已发送
|
||||
</span>
|
||||
)
|
||||
)}
|
||||
) : message.mine && message.delivery === "sent" ? (
|
||||
<span className="social-msg-sent">
|
||||
<CheckCheck size={12} />
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
{chat.sending && (
|
||||
<div className="social-chat-typing" role="status">
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<span>正在发送…</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
className="social-new-messages"
|
||||
type="button"
|
||||
className="social-jump-latest"
|
||||
onClick={() => {
|
||||
const thread = threadRef.current!;
|
||||
thread.scrollTo({ top: thread.scrollHeight, behavior: "smooth" });
|
||||
const thread = threadRef.current;
|
||||
if (!thread) return;
|
||||
atBottom.current = true;
|
||||
thread.dataset.unread = "false";
|
||||
thread.scrollTo({
|
||||
top: thread.scrollHeight,
|
||||
behavior: matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
? "instant"
|
||||
: "smooth",
|
||||
});
|
||||
}}
|
||||
>
|
||||
<ArrowDown size={13} />
|
||||
查看新消息
|
||||
最新消息 ↓
|
||||
</button>
|
||||
</div>
|
||||
<form
|
||||
@ -234,15 +262,14 @@ export function Conversation({
|
||||
onSubmit={(event) => void submit(event)}
|
||||
>
|
||||
{composerError && (
|
||||
<p className="social-status error" role="alert">
|
||||
<p className="social-status warn" role="alert">
|
||||
{composerError}
|
||||
</p>
|
||||
)}
|
||||
{reply && (
|
||||
<div className="social-reply-preview">
|
||||
<CornerUpLeft size={13} />
|
||||
<div className="social-reply-chip">
|
||||
<span>
|
||||
回复 {reply.author} · {reply.text.slice(0, 50)}
|
||||
回复 {reply.author}:{reply.text.slice(0, 48)}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
@ -256,7 +283,7 @@ export function Conversation({
|
||||
<textarea
|
||||
ref={composerRef}
|
||||
aria-label="消息内容"
|
||||
placeholder="你在哪座城市?今天有什么新发现?"
|
||||
placeholder="报到 / 找 cowork / 下一站去哪…"
|
||||
rows={2}
|
||||
maxLength={2000}
|
||||
value={chat.draft}
|
||||
@ -323,54 +350,38 @@ export function Conversation({
|
||||
发送
|
||||
</button>
|
||||
</div>
|
||||
<p className="social-composer-note">
|
||||
Enter 发送 · Shift + Enter 换行 · 草稿保存在当前设备
|
||||
</p>
|
||||
</form>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ChatWorkspace({ channelId }: { channelId: string }) {
|
||||
const channel = SEED_CHANNELS.find((item) => item.id === channelId);
|
||||
export default function ChatWorkspace() {
|
||||
const channel =
|
||||
SEED_CHANNELS.find((item) => item.id === SOCIAL_CHAT_ID) ||
|
||||
SEED_CHANNELS[0];
|
||||
const id = channel?.id || SOCIAL_CHAT_ID;
|
||||
return (
|
||||
<SiteShell title={channel?.name || "聊天室"}>
|
||||
{channel ? (
|
||||
<>
|
||||
<div className="social-room-heading">
|
||||
<Link href={socialPath("/chat")}>
|
||||
<ArrowLeft size={14} />
|
||||
所有频道
|
||||
</Link>
|
||||
<span>GOOD CONVERSATIONS START HERE</span>
|
||||
</div>
|
||||
<div className="social-chat-layout">
|
||||
<nav className="social-room-channels">
|
||||
<span>选择话题</span>
|
||||
{SEED_CHANNELS.map((item) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
href={socialPath(`/chat/${item.id}`)}
|
||||
aria-current={item.id === channelId ? "page" : undefined}
|
||||
>
|
||||
<Hash size={14} />
|
||||
{item.name.replace("#", "")}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<Conversation key={channelId} channelId={channelId} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<EmptyState
|
||||
title="这个频道还不存在"
|
||||
description="回到话题广场,找一个感兴趣的频道开始。"
|
||||
>
|
||||
<Link className="social-btn primary" href={socialPath("/chat")}>
|
||||
浏览所有频道
|
||||
<div className="social-root social-live-root social-skin social-chat-live social-chat-solo">
|
||||
<header className="social-live-bar social-chat-live-bar">
|
||||
<div className="social-live-bar-main">
|
||||
<Link href={socialPath("/")} className="social-nav-back">
|
||||
<ArrowLeft size={14} />
|
||||
首页
|
||||
</Link>
|
||||
</EmptyState>
|
||||
)}
|
||||
</SiteShell>
|
||||
<div>
|
||||
<strong>大家聊天</strong>
|
||||
<p className="social-muted">
|
||||
{channel?.topic || "游民闲聊"} · 打个招呼就好
|
||||
</p>
|
||||
</div>
|
||||
<DemoBadge>能连上就实时聊 · 不行就先留在你这边</DemoBadge>
|
||||
</div>
|
||||
<ShareButton path={socialPath("/chat")} title="游民社区聊天室" />
|
||||
</header>
|
||||
<div className="social-live-stage layout-chat">
|
||||
<Conversation key={id} channelId={id} />
|
||||
</div>
|
||||
<SocialMobileDock />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
104
src/modules/social/components/CityDirectory.tsx
Normal file
104
src/modules/social/components/CityDirectory.tsx
Normal file
@ -0,0 +1,104 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { MapPin, Users, Wifi } from "lucide-react";
|
||||
import {
|
||||
CITY_FILTER_TAGS,
|
||||
SOCIAL_CITIES,
|
||||
type SocialCity,
|
||||
} from "@social/lib/cities";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
export default function CityDirectory({
|
||||
compact = false,
|
||||
limit,
|
||||
}: {
|
||||
compact?: boolean;
|
||||
limit?: number;
|
||||
}) {
|
||||
const [tag, setTag] = useState<(typeof CITY_FILTER_TAGS)[number]>("全部");
|
||||
const list = useMemo(() => {
|
||||
const filtered =
|
||||
tag === "全部"
|
||||
? SOCIAL_CITIES
|
||||
: SOCIAL_CITIES.filter((c) => c.tags.includes(tag));
|
||||
return typeof limit === "number" ? filtered.slice(0, limit) : filtered;
|
||||
}, [tag, limit]);
|
||||
|
||||
return (
|
||||
<div className={`social-city-dir${compact ? " is-compact" : ""}`}>
|
||||
<div
|
||||
className="social-city-filters"
|
||||
role="tablist"
|
||||
aria-label="城市筛选"
|
||||
>
|
||||
{CITY_FILTER_TAGS.map((t) => (
|
||||
<button
|
||||
key={t}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tag === t}
|
||||
className={`social-city-filter${tag === t ? " is-active" : ""}`}
|
||||
onClick={() => setTag(t)}
|
||||
>
|
||||
{t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-city-grid">
|
||||
{list.map((city, i) => (
|
||||
<CityCard key={city.id} city={city} index={i} />
|
||||
))}
|
||||
</div>
|
||||
{!list.length ? (
|
||||
<p className="social-muted social-city-empty">
|
||||
该标签暂无城市 · 换一个试试
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CityCard({ city, index }: { city: SocialCity; index: number }) {
|
||||
return (
|
||||
<Link
|
||||
href={socialPath(`/people?city=${encodeURIComponent(city.name)}`)}
|
||||
className={`social-city-card reveal${city.hot ? " is-hot" : ""}`}
|
||||
style={{ ["--stagger" as string]: `${Math.min(index, 10) * 50}ms` }}
|
||||
>
|
||||
<div className="social-city-card-top">
|
||||
<span className="social-city-emoji" aria-hidden>
|
||||
{city.emoji}
|
||||
</span>
|
||||
<div>
|
||||
<h3>
|
||||
{city.name}
|
||||
{city.hot ? <em>HOT</em> : null}
|
||||
</h3>
|
||||
<p>{city.country}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p className="social-city-vibe">{city.vibe}</p>
|
||||
<div className="social-city-stats">
|
||||
<span>
|
||||
<Users size={12} aria-hidden />
|
||||
{city.members}+
|
||||
</span>
|
||||
<span>
|
||||
<Wifi size={12} aria-hidden />
|
||||
{city.wifiMbps}M
|
||||
</span>
|
||||
<span>
|
||||
<MapPin size={12} aria-hidden />
|
||||
{city.costHint}
|
||||
</span>
|
||||
</div>
|
||||
<div className="social-city-tags">
|
||||
{city.tags.slice(0, 3).map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@ -6,17 +6,21 @@ import {
|
||||
ArrowUpRight,
|
||||
Check,
|
||||
Heart,
|
||||
LockKeyhole,
|
||||
MessageCircle,
|
||||
Radio,
|
||||
Send,
|
||||
Sparkles,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
import { WechatOaModal } from "~/components/social-follow";
|
||||
import SiteShell from "./SiteShell";
|
||||
import JoinPayModal from "./JoinPayModal";
|
||||
import { PageIntro } from "./SocialUI";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import { socialApi } from "@social/lib/api";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { resolveSocialLandingCopy } from "@social/lib/landing";
|
||||
|
||||
export function CommunityFeedback() {
|
||||
const [draft, setDraft] = useLocalState<{
|
||||
@ -33,6 +37,11 @@ export function CommunityFeedback() {
|
||||
setDelivery("draft");
|
||||
setStatus("");
|
||||
};
|
||||
const reset = () => {
|
||||
setDraft({ kind: "建议", text: "", contact: "" });
|
||||
setDelivery("draft");
|
||||
setStatus("");
|
||||
};
|
||||
const submit = async (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
if (!draft.text.trim() || lock.current || delivery === "sent") return;
|
||||
@ -45,176 +54,213 @@ export function CommunityFeedback() {
|
||||
contact: draft.contact.trim(),
|
||||
});
|
||||
setDelivery("sent");
|
||||
setStatus("你的想法已提交,谢谢你一起把社区变得更好。");
|
||||
setStatus("已提交,感谢反馈。");
|
||||
} catch {
|
||||
setDelivery("local");
|
||||
setStatus("内容已保存在本机,尚未送达社区。联网后可以在这里重试。");
|
||||
setStatus("先留在你这边了,有网后再试一次");
|
||||
} finally {
|
||||
lock.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<SiteShell title="共建社区">
|
||||
<PageIntro
|
||||
eyebrow="A COMMUNITY BUILT WITH YOU"
|
||||
title="你的一点想法,"
|
||||
accent="可能改变很多人的相遇。"
|
||||
description="想要什么新功能?哪一步不够顺手?或者,你有一个想和大家一起实现的点子。我们想听见。"
|
||||
/>
|
||||
<section className="social-panel social-feedback-panel">
|
||||
<div className="social-feedback-heading">
|
||||
<span className="social-feedback-heart">
|
||||
<Heart size={32} />
|
||||
</span>
|
||||
<div>
|
||||
<h2>下一次更新,从这里开始。</h2>
|
||||
<p>具体的场景、期待的体验,都值得被认真写下来。</p>
|
||||
</div>
|
||||
<SiteShell title="说说想法">
|
||||
<PageIntro title="意见反馈" accent="我们在听" />
|
||||
<section className="social-panel social-feedback-panel reveal">
|
||||
<div className="social-page-kicker">
|
||||
<span />
|
||||
说说你的想法
|
||||
</div>
|
||||
<form className="social-form" onSubmit={(event) => void submit(event)}>
|
||||
<fieldset disabled={busy} className="social-fieldset">
|
||||
<div className="social-filters">
|
||||
{(["建议", "反馈"] as const).map((kind) => (
|
||||
<button
|
||||
type="button"
|
||||
key={kind}
|
||||
className={draft.kind === kind ? "active" : ""}
|
||||
aria-pressed={draft.kind === kind}
|
||||
onClick={() => update("kind", kind)}
|
||||
>
|
||||
{kind === "建议" ? "✦ 我有一个点子" : "↗ 这里可以更好"}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<label>
|
||||
说说你的想法
|
||||
<textarea
|
||||
rows={6}
|
||||
required
|
||||
maxLength={3000}
|
||||
value={draft.text}
|
||||
onChange={(event) => update("text", event.target.value)}
|
||||
placeholder="比如:我想在新城市快速找到一起办公的人,希望能按工作时间和兴趣找伙伴…"
|
||||
/>
|
||||
<small>{draft.text.length}/3000</small>
|
||||
</label>
|
||||
<label>
|
||||
方便继续交流的联系方式(选填)
|
||||
<input
|
||||
maxLength={120}
|
||||
value={draft.contact}
|
||||
onChange={(event) => update("contact", event.target.value)}
|
||||
placeholder="邮箱 / 微信 / 其他"
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<button
|
||||
type="submit"
|
||||
className="social-btn primary"
|
||||
disabled={busy || delivery === "sent" || !draft.text.trim()}
|
||||
>
|
||||
<Send size={15} />
|
||||
{busy
|
||||
? "提交中…"
|
||||
: delivery === "sent"
|
||||
? "已收到你的想法"
|
||||
: delivery === "local"
|
||||
? "重试提交"
|
||||
: "让这个想法被看见"}
|
||||
</button>
|
||||
{status && (
|
||||
<p
|
||||
role="status"
|
||||
className={`social-status${delivery === "local" ? " warn" : ""}`}
|
||||
>
|
||||
{status}
|
||||
<h2 className="social-feedback-title">哪里用得不顺手?告诉我们</h2>
|
||||
<p className="social-muted">
|
||||
发不出去也没关系,会先留在你这边,有网后再试。我们会看,但不保证马上回复。
|
||||
</p>
|
||||
{delivery === "sent" ? (
|
||||
<div className="social-join-success">
|
||||
<p className="social-status" role="status">
|
||||
{status || "已提交"}
|
||||
</p>
|
||||
)}
|
||||
<p className="social-muted">
|
||||
草稿保存在当前设备,提交成功后才会送达社区。
|
||||
</p>
|
||||
</form>
|
||||
<div className="social-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={reset}
|
||||
>
|
||||
再提一条
|
||||
</button>
|
||||
<Link className="social-btn" href={socialPath("/")}>
|
||||
回社区首页
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<form className="social-form" onSubmit={(event) => void submit(event)}>
|
||||
<fieldset disabled={busy} className="social-fieldset">
|
||||
<div className="social-filters">
|
||||
{(["建议", "反馈"] as const).map((kind) => (
|
||||
<button
|
||||
type="button"
|
||||
key={kind}
|
||||
className={draft.kind === kind ? "active" : ""}
|
||||
aria-pressed={draft.kind === kind}
|
||||
onClick={() => update("kind", kind)}
|
||||
>
|
||||
{kind}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<label>
|
||||
内容
|
||||
<textarea
|
||||
rows={6}
|
||||
required
|
||||
maxLength={3000}
|
||||
value={draft.text}
|
||||
onChange={(event) => update("text", event.target.value)}
|
||||
placeholder="具体页面 / 操作 / 期望…"
|
||||
/>
|
||||
<small>{draft.text.length}/3000</small>
|
||||
</label>
|
||||
<label>
|
||||
联系方式(选填)
|
||||
<input
|
||||
maxLength={120}
|
||||
value={draft.contact}
|
||||
onChange={(event) => update("contact", event.target.value)}
|
||||
placeholder="邮箱 / 微信"
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<button
|
||||
type="submit"
|
||||
className="social-btn primary"
|
||||
disabled={busy || !draft.text.trim()}
|
||||
>
|
||||
<Send size={15} />
|
||||
{busy ? "提交中…" : delivery === "local" ? "重试" : "提交"}
|
||||
</button>
|
||||
{status && (
|
||||
<p
|
||||
role="status"
|
||||
className={`social-status${delivery === "local" ? " warn" : ""}`}
|
||||
>
|
||||
{status}
|
||||
</p>
|
||||
)}
|
||||
</form>
|
||||
)}
|
||||
</section>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
export function CommunityJoin() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const config = useSocialConfig();
|
||||
const copy = resolveSocialLandingCopy(config.copy);
|
||||
const [payOpen, setPayOpen] = useState(false);
|
||||
const [oaOpen, setOaOpen] = useState(false);
|
||||
return (
|
||||
<SiteShell title="加入社区">
|
||||
<PageIntro
|
||||
eyebrow="YOUR PEOPLE ARE OUT THERE"
|
||||
title="世界很大,"
|
||||
accent="总有人和你同频。"
|
||||
description="不需要一个完美的开场。从一句你好、一张名片、一杯咖啡开始,在新的城市找到熟悉感。"
|
||||
/>
|
||||
<div className="social-welcome-banner">
|
||||
<div className="social-welcome-faces" aria-hidden="true">
|
||||
<span>👋</span>
|
||||
<span>🌍</span>
|
||||
<span>☕</span>
|
||||
<span>💻</span>
|
||||
</div>
|
||||
<div>
|
||||
<h2>来这里,做真实的自己。</h2>
|
||||
<p>分享经验,保持好奇,尊重每个人的边界。</p>
|
||||
</div>
|
||||
<button
|
||||
className="social-btn primary"
|
||||
type="button"
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
查看社群加入方式 <ArrowUpRight size={15} />
|
||||
</button>
|
||||
<PageIntro title="加入社区" />
|
||||
<div className="social-join-paths">
|
||||
<article className="social-panel social-join-path reveal">
|
||||
<span className="social-page-kicker">
|
||||
<span />
|
||||
方式一
|
||||
</span>
|
||||
<span className="social-join-path-ico" aria-hidden>
|
||||
<LockKeyhole size={24} strokeWidth={1.4} />
|
||||
</span>
|
||||
<h2>{copy.socialPayJoinLabel}</h2>
|
||||
<p>
|
||||
填一下邮箱,按提示完成支付就能加入。电脑、手机浏览器和微信里都会带你走合适的支付方式。
|
||||
</p>
|
||||
{config.flags.payEnabled ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn coral"
|
||||
onClick={() => setPayOpen(true)}
|
||||
>
|
||||
{copy.socialPayJoinLabel}
|
||||
<ArrowUpRight size={15} />
|
||||
</button>
|
||||
) : (
|
||||
<span className="social-status">暂时还不能购买</span>
|
||||
)}
|
||||
</article>
|
||||
<article className="social-panel social-join-path reveal">
|
||||
<span className="social-page-kicker">
|
||||
<span />
|
||||
方式二
|
||||
</span>
|
||||
<span className="social-join-path-ico" aria-hidden>
|
||||
<MessageCircle size={24} strokeWidth={1.4} />
|
||||
</span>
|
||||
<h2>{copy.socialOaJoinLabel}</h2>
|
||||
<p>
|
||||
关注
|
||||
{config.copy.wechatOaName
|
||||
? `「${config.copy.wechatOaName}」`
|
||||
: "公众号"}
|
||||
,先看看社区动态和活动,再决定要不要正式加入。
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={() => setOaOpen(true)}
|
||||
>
|
||||
{copy.socialOaJoinLabel}
|
||||
<ArrowUpRight size={15} />
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
<h3 className="social-onboarding-heading">加入后可以先去这些地方</h3>
|
||||
<div className="social-grid social-onboarding-grid">
|
||||
{[
|
||||
{
|
||||
n: "01",
|
||||
icon: Users,
|
||||
title: "让大家认识你",
|
||||
text: "写下城市、兴趣和正在做的事。好的连接,始于一个具体的你。",
|
||||
href: "/social/roster",
|
||||
cta: "制作我的名片",
|
||||
},
|
||||
{
|
||||
n: "02",
|
||||
icon: MessageCircle,
|
||||
title: "加入一场好对话",
|
||||
text: "打个招呼,交换一条城市经验,问一个你一直想问的问题。",
|
||||
href:
|
||||
"/social/chat/general?intro=" +
|
||||
encodeURIComponent(
|
||||
"大家好,我刚来到这里 👋 很想认识同城或同频的新朋友!",
|
||||
),
|
||||
cta: "去公开频道报到",
|
||||
title: "大家聊天",
|
||||
desc: "跟大家打个招呼",
|
||||
href: socialPath("/chat"),
|
||||
cta: "去聊聊",
|
||||
},
|
||||
{
|
||||
n: "03",
|
||||
icon: Sparkles,
|
||||
title: "把连接带到生活里",
|
||||
text: "看看下一场 Meetup,或挑一家咖啡馆,公开发起一次见面邀约。",
|
||||
href: "/social/meetup",
|
||||
cta: "发现下一次相遇",
|
||||
icon: Heart,
|
||||
title: "认识一下",
|
||||
desc: "左右滑,慢慢认识新朋友",
|
||||
href: socialPath("/date"),
|
||||
cta: "去看看",
|
||||
},
|
||||
{
|
||||
icon: Users,
|
||||
title: "我的介绍",
|
||||
desc: "写几句,让别人认识你",
|
||||
href: socialPath("/roster"),
|
||||
cta: "去写写",
|
||||
},
|
||||
{
|
||||
icon: Radio,
|
||||
title: "开视频聊聊",
|
||||
desc: "开摄像头,面对面认识",
|
||||
href: socialPath("/meetup"),
|
||||
cta: "去开视频",
|
||||
},
|
||||
].map((item) => (
|
||||
<article className="social-card social-onboarding-card" key={item.n}>
|
||||
<article className="social-card social-onboarding-card" key={item.title}>
|
||||
<div className="social-card-top">
|
||||
<item.icon size={27} strokeWidth={1.3} />
|
||||
<span>{item.n}</span>
|
||||
<item.icon size={24} strokeWidth={1.3} />
|
||||
</div>
|
||||
<h2>{item.title}</h2>
|
||||
<p>{item.text}</p>
|
||||
<Link className="social-btn" href={item.href}>
|
||||
<p className="social-muted">{item.desc}</p>
|
||||
<Link className="social-btn primary" href={item.href}>
|
||||
{item.cta}
|
||||
<ArrowUpRight size={14} />
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<WechatOaModal open={open} onClose={() => setOpen(false)} />
|
||||
<JoinPayModal open={payOpen} onClose={() => setPayOpen(false)} />
|
||||
<WechatOaModal open={oaOpen} onClose={() => setOaOpen(false)} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
@ -225,75 +271,62 @@ export function CommunityMembership() {
|
||||
"zh-CN",
|
||||
{ maximumFractionDigits: 2 },
|
||||
);
|
||||
const benefits = [
|
||||
"更好地展示自己的介绍",
|
||||
"更方便认识想见的人",
|
||||
"视频见面与同城活动更新提醒",
|
||||
"找搭子做事时优先沟通",
|
||||
];
|
||||
return (
|
||||
<SiteShell title="会员与连接">
|
||||
<PageIntro
|
||||
eyebrow="MORE CONNECTION. MORE POSSIBILITY."
|
||||
title="连接,从参与开始。"
|
||||
accent="把社区变成生活的一部分。"
|
||||
description="先认识这里的人、加入感兴趣的对话,再选择适合自己的参与方式。会员方案与实际权益可在会员中心查看。"
|
||||
/>
|
||||
<section className="social-membership-banner">
|
||||
<div className="social-membership-emblem" aria-hidden="true">
|
||||
<Sparkles size={51} strokeWidth={1} />
|
||||
<i />
|
||||
<i />
|
||||
<SiteShell title="会员">
|
||||
<PageIntro title="会员" accent={`¥${price}`} />
|
||||
<section className="social-membership-banner reveal">
|
||||
<div className="social-page-kicker">
|
||||
<span />
|
||||
会员通行证
|
||||
</div>
|
||||
<div>
|
||||
<span className="social-page-kicker">NOMADRO MEMBERSHIP</span>
|
||||
<h2>留给更深入探索的你。</h2>
|
||||
<p>
|
||||
当前会员展示价 <strong>¥{price}</strong>
|
||||
,具体有效期、权益与最终价格以会员中心为准。
|
||||
</p>
|
||||
<div className="social-actions">
|
||||
{config.flags.payEnabled ? (
|
||||
<Link className="social-btn primary" href="/vip">
|
||||
{config.copy.vipCta || "查看会员方案"}
|
||||
<ArrowUpRight size={15} />
|
||||
</Link>
|
||||
) : (
|
||||
<span className="social-status">
|
||||
会员购买暂未开放,欢迎先参与社区。
|
||||
</span>
|
||||
)}
|
||||
<Link className="social-btn" href="/social/join">
|
||||
先加入社区
|
||||
<h2 className="social-feedback-title">游民会员</h2>
|
||||
<p className="social-muted">
|
||||
开通后能更方便参与社区。具体权益以支付页说明为准。
|
||||
</p>
|
||||
<ul className="social-benefit-list">
|
||||
{benefits.map((item) => (
|
||||
<li key={item}>
|
||||
<Check size={15} />
|
||||
{item}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="social-actions">
|
||||
{config.flags.payEnabled ? (
|
||||
<Link className="social-btn coral" href="/vip">
|
||||
{config.copy.vipCta || "开通会员"}
|
||||
<ArrowUpRight size={15} />
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<span className="social-status">暂时还不能购买</span>
|
||||
)}
|
||||
<Link className="social-btn" href={socialPath("/join")}>
|
||||
去加入社区
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
<div className="social-section-label">
|
||||
现在就能开始的连接 <span>以下是社区入口,不代表额外付费权益</span>
|
||||
</div>
|
||||
<div className="social-grid">
|
||||
{[
|
||||
{
|
||||
title: "一张有温度的名片",
|
||||
text: "让你的技能、城市与兴趣有一个清晰的介绍。",
|
||||
href: "/social/roster",
|
||||
},
|
||||
{
|
||||
title: "一次公开的 Coffeechat",
|
||||
text: "从一个地方、一杯咖啡和一次公开邀约开始。",
|
||||
href: "/social/coffeechat",
|
||||
},
|
||||
{
|
||||
title: "一场值得参与的对话",
|
||||
text: "走进话题频道和线上活动,与不同城市的人交流。",
|
||||
href: "/social/chat",
|
||||
},
|
||||
{ title: "我的介绍", href: socialPath("/roster") },
|
||||
{ title: "认识一下", href: socialPath("/date") },
|
||||
{ title: "找咖啡馆", href: socialPath("/coffeechat") },
|
||||
{ title: "大家聊天", href: socialPath("/chat") },
|
||||
].map((item) => (
|
||||
<Link
|
||||
className="social-card social-membership-card"
|
||||
href={item.href}
|
||||
key={item.href}
|
||||
>
|
||||
<Check size={21} />
|
||||
<Check size={18} />
|
||||
<h2>{item.title}</h2>
|
||||
<p>{item.text}</p>
|
||||
<span>
|
||||
去看看 <ArrowUpRight size={14} />
|
||||
打开 <ArrowUpRight size={14} />
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
ArrowUpRight,
|
||||
Coffee,
|
||||
Globe2,
|
||||
Heart,
|
||||
MoveUpRight,
|
||||
Play,
|
||||
Radio,
|
||||
@ -70,7 +71,7 @@ export default function ConnectionHero({
|
||||
<div className="container connection-hero-layout">
|
||||
<div className="connection-copy">
|
||||
<div className="connection-eyebrow">
|
||||
<span className="connection-status-dot" /> NOMADRO SOCIAL{" "}
|
||||
<span className="connection-status-dot" /> 游民社区{" "}
|
||||
<span className="connection-eyebrow-divider" /> {copy.socialEyebrow}
|
||||
</div>
|
||||
<h1 id="connection-title">
|
||||
@ -91,6 +92,12 @@ export default function ConnectionHero({
|
||||
>
|
||||
{copy.socialJoinCta} <ArrowUpRight size={19} />
|
||||
</button>
|
||||
<Link className="connection-film" href={socialPath("/date")}>
|
||||
<span>
|
||||
<Heart size={13} />
|
||||
</span>
|
||||
先去认识一下
|
||||
</Link>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
className="connection-film"
|
||||
@ -99,19 +106,19 @@ export default function ConnectionHero({
|
||||
>
|
||||
<span>
|
||||
<Play size={13} fill="currentColor" />
|
||||
</span>{" "}
|
||||
看看社区故事
|
||||
</span>
|
||||
社区故事
|
||||
</button>
|
||||
</div>
|
||||
<div className="connection-proof">
|
||||
<div className="connection-avatar-stack" aria-hidden="true">
|
||||
{MOCK_ROSTER.slice(0, 4).map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={34} />
|
||||
{MOCK_ROSTER.slice(0, 5).map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={36} />
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
<strong>有趣的人,正在这里相遇</strong>
|
||||
<span>自由职业者 · 远程工作者 · 生活探索家</span>
|
||||
<strong>同频的人,正在这里相遇</strong>
|
||||
<span>自由职业 · 远程工作 · 出来见一面</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -235,7 +242,7 @@ export default function ConnectionHero({
|
||||
<Sparkles size={27} strokeWidth={1.3} />
|
||||
</div>
|
||||
<strong>同频,自有引力</strong>
|
||||
<span>FIND YOUR PEOPLE</span>
|
||||
<span>想见的人</span>
|
||||
</div>
|
||||
{NODES.map(({ member, x, y, rotate }, i) => {
|
||||
const m = MOCK_ROSTER[member];
|
||||
@ -292,15 +299,15 @@ export default function ConnectionHero({
|
||||
<span>
|
||||
<span className="connection-status-dot" /> 连接没有边界
|
||||
</span>
|
||||
<span>成员展示 · 演示数据</span>
|
||||
<span>先用示例看看感觉</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="container connection-hero-bottom">
|
||||
<a href="#people">
|
||||
<ArrowDown size={14} /> 向下探索你的下一次相遇
|
||||
<ArrowDown size={14} /> 继续往下看
|
||||
</a>
|
||||
<span>LESS SCROLLING. MORE CONNECTING.</span>
|
||||
<span>认识人 · 开视频 · 见一面</span>
|
||||
</div>
|
||||
|
||||
<dialog
|
||||
@ -347,27 +354,39 @@ export function ConnectionWays({ copy }: { copy: SocialLandingCopy }) {
|
||||
const ways = [
|
||||
{
|
||||
id: "01",
|
||||
href: "/chat",
|
||||
href: "/meetup",
|
||||
icon: Radio,
|
||||
title: copy.socialOnlineTitle,
|
||||
sub: "线上闲聊 · 灵感碰撞",
|
||||
title: copy.socialWayChat,
|
||||
sub: copy.socialOnlineTitle,
|
||||
cta: "去聊聊",
|
||||
className: "mint",
|
||||
},
|
||||
{
|
||||
id: "02",
|
||||
href: "/coffeechat",
|
||||
icon: Coffee,
|
||||
title: copy.socialOfflineTitle,
|
||||
sub: "一杯咖啡 · 真实连接",
|
||||
href: "/date",
|
||||
icon: Heart,
|
||||
title: copy.socialWayDate,
|
||||
sub: "左右滑,慢慢认识",
|
||||
cta: "开始看看",
|
||||
className: "coral",
|
||||
},
|
||||
{
|
||||
id: "03",
|
||||
href: "/coffeechat",
|
||||
icon: Coffee,
|
||||
title: copy.socialWayCafe,
|
||||
sub: copy.socialOfflineTitle,
|
||||
cta: "选城市",
|
||||
className: "yellow",
|
||||
},
|
||||
{
|
||||
id: "04",
|
||||
href: "/team",
|
||||
icon: Users,
|
||||
title: copy.socialTeamTitle,
|
||||
sub: "远程协作 · 共创可能",
|
||||
className: "yellow",
|
||||
title: copy.socialWayTeam,
|
||||
sub: copy.socialTeamTitle,
|
||||
cta: "看看机会",
|
||||
className: "mint",
|
||||
},
|
||||
];
|
||||
return (
|
||||
@ -385,6 +404,7 @@ export function ConnectionWays({ copy }: { copy: SocialLandingCopy }) {
|
||||
<span className="connection-way-copy">
|
||||
<strong>{way.title}</strong>
|
||||
<small>{way.sub}</small>
|
||||
<em>{way.cta}</em>
|
||||
</span>
|
||||
<ArrowUpRight className="connection-way-arrow" size={19} />
|
||||
</Link>
|
||||
|
||||
@ -1,3 +1,570 @@
|
||||
"use client";
|
||||
|
||||
export { StoriesLibrary as default } from "./ResourceLibrary";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type PointerEvent as ReactPointerEvent,
|
||||
} from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Heart,
|
||||
MapPin,
|
||||
MessageCircle,
|
||||
RotateCcw,
|
||||
Undo2,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import SocialAvatar from "./SocialAvatar";
|
||||
import { DemoBadge, ShareButton, SocialDialog } from "./SocialUI";
|
||||
import { SocialMobileDock } from "./SocialNavigation";
|
||||
import type { SocialRosterMember } from "@social/lib/rosterMock";
|
||||
import { useDiscoveryRoster } from "@social/lib/discoveryRoster";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { loadJson, saveJson } from "@social/lib/storage";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
|
||||
type Filter = "all" | "f" | "m";
|
||||
type Decision = "like" | "pass";
|
||||
|
||||
const SWIPE_KEY = "social-date-swipes";
|
||||
const HISTORY_KEY = "social-date-history";
|
||||
const LIKE_KEY = "social-roster-likes";
|
||||
const LIKES_CHANGED = "social-roster-likes-changed";
|
||||
const THRESHOLD = 110;
|
||||
|
||||
type SwipeStore = Record<string, Decision>;
|
||||
type HistoryEntry = { id: string; decision: Decision };
|
||||
|
||||
function shuffle<T>(list: T[]) {
|
||||
const next = [...list];
|
||||
for (let i = next.length - 1; i > 0; i -= 1) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[next[i], next[j]] = [next[j], next[i]];
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
function syncRosterLike(id: string, liked: boolean) {
|
||||
const current = loadJson<Record<string, boolean>>(LIKE_KEY, {});
|
||||
const next = { ...current };
|
||||
if (liked) next[id] = true;
|
||||
else delete next[id];
|
||||
saveJson(LIKE_KEY, next);
|
||||
window.dispatchEvent(new Event(LIKES_CHANGED));
|
||||
}
|
||||
|
||||
export default function DateClient() {
|
||||
const roster = useDiscoveryRoster();
|
||||
const [filter, setFilter] = useState<Filter>("all");
|
||||
const [swipes, setSwipes] = useLocalState<SwipeStore>(SWIPE_KEY, {});
|
||||
const [history, setHistory] = useLocalState<HistoryEntry[]>(HISTORY_KEY, []);
|
||||
const [order, setOrder] = useState<string[]>([]);
|
||||
const [drag, setDrag] = useState({ x: 0, y: 0, active: false });
|
||||
const [fly, setFly] = useState<null | { id: string; dir: Decision }>(null);
|
||||
const [toast, setToast] = useState("");
|
||||
const [matchId, setMatchId] = useState<string | null>(null);
|
||||
const [likesOpen, setLikesOpen] = useState(false);
|
||||
const start = useRef({ x: 0, y: 0 });
|
||||
const dragging = useRef(false);
|
||||
const dragRef = useRef({ x: 0, y: 0 });
|
||||
const busy = useRef(false);
|
||||
const toastTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setOrder((prev) => {
|
||||
const ids = roster.map((m) => m.id);
|
||||
const keep = prev.filter((id) => ids.includes(id));
|
||||
const missing = ids.filter((id) => !keep.includes(id));
|
||||
return keep.length ? [...keep, ...missing] : shuffle(ids);
|
||||
});
|
||||
}, [roster]);
|
||||
|
||||
useEffect(() => {
|
||||
if (history.length) return;
|
||||
const entries = Object.entries(swipes) as [string, Decision][];
|
||||
if (!entries.length) return;
|
||||
setHistory(entries.map(([id, decision]) => ({ id, decision })));
|
||||
}, [swipes, history.length, setHistory]);
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
if (toastTimer.current) clearTimeout(toastTimer.current);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const deck = useMemo(() => {
|
||||
return order
|
||||
.map((id) => roster.find((m) => m.id === id)!)
|
||||
.filter((m) => m && !swipes[m.id])
|
||||
.filter((m) => filter === "all" || m.gender === filter);
|
||||
}, [order, swipes, filter, roster]);
|
||||
|
||||
const current = deck[0] || null;
|
||||
const next = deck[1] || null;
|
||||
const remaining = deck.length;
|
||||
const totalForFilter = roster.filter(
|
||||
(m) => filter === "all" || m.gender === filter,
|
||||
).length;
|
||||
const liked = useMemo(
|
||||
() =>
|
||||
roster
|
||||
.filter((m) => swipes[m.id] === "like")
|
||||
.slice()
|
||||
.reverse(),
|
||||
[swipes, roster],
|
||||
);
|
||||
const matchMember = matchId
|
||||
? roster.find((m) => m.id === matchId) || null
|
||||
: null;
|
||||
|
||||
const flash = useCallback((text: string) => {
|
||||
setToast(text);
|
||||
if (toastTimer.current) clearTimeout(toastTimer.current);
|
||||
toastTimer.current = setTimeout(() => setToast(""), 1600);
|
||||
}, []);
|
||||
|
||||
const commit = useCallback(
|
||||
(member: SocialRosterMember, decision: Decision) => {
|
||||
if (busy.current || fly) return;
|
||||
busy.current = true;
|
||||
setFly({ id: member.id, dir: decision });
|
||||
window.setTimeout(() => {
|
||||
setSwipes((prev) => ({ ...prev, [member.id]: decision }));
|
||||
setHistory((prev) => [...prev, { id: member.id, decision }]);
|
||||
if (decision === "like") {
|
||||
syncRosterLike(member.id, true);
|
||||
setMatchId(member.id);
|
||||
flash(`想认识 ${member.name}`);
|
||||
} else {
|
||||
flash("已跳过");
|
||||
}
|
||||
setFly(null);
|
||||
setDrag({ x: 0, y: 0, active: false });
|
||||
dragRef.current = { x: 0, y: 0 };
|
||||
busy.current = false;
|
||||
}, 280);
|
||||
},
|
||||
[fly, setSwipes, flash],
|
||||
);
|
||||
|
||||
const undo = useCallback(() => {
|
||||
if (busy.current || fly || !history.length) return;
|
||||
const last = history[history.length - 1];
|
||||
setHistory((prev) => prev.slice(0, -1));
|
||||
setSwipes((prev) => {
|
||||
const nextStore = { ...prev };
|
||||
delete nextStore[last.id];
|
||||
return nextStore;
|
||||
});
|
||||
if (last.decision === "like") syncRosterLike(last.id, false);
|
||||
setMatchId(null);
|
||||
setDrag({ x: 0, y: 0, active: false });
|
||||
flash("已撤销");
|
||||
}, [history, fly, setSwipes, flash]);
|
||||
|
||||
const onPointerDown = (event: ReactPointerEvent<HTMLElement>) => {
|
||||
if (!current || fly || busy.current) return;
|
||||
dragging.current = true;
|
||||
start.current = { x: event.clientX, y: event.clientY };
|
||||
event.currentTarget.setPointerCapture(event.pointerId);
|
||||
setDrag({ x: 0, y: 0, active: true });
|
||||
};
|
||||
|
||||
const onPointerMove = (event: ReactPointerEvent<HTMLElement>) => {
|
||||
if (!dragging.current || !current || fly) return;
|
||||
const nextDrag = {
|
||||
x: event.clientX - start.current.x,
|
||||
y: (event.clientY - start.current.y) * 0.35,
|
||||
};
|
||||
dragRef.current = nextDrag;
|
||||
setDrag({ ...nextDrag, active: true });
|
||||
};
|
||||
|
||||
const onPointerUp = () => {
|
||||
if (!dragging.current || !current || fly) return;
|
||||
dragging.current = false;
|
||||
const x = dragRef.current.x;
|
||||
if (x > THRESHOLD) commit(current, "like");
|
||||
else if (x < -THRESHOLD) commit(current, "pass");
|
||||
else {
|
||||
setDrag({ x: 0, y: 0, active: false });
|
||||
dragRef.current = { x: 0, y: 0 };
|
||||
}
|
||||
};
|
||||
|
||||
const resetDeck = () => {
|
||||
setSwipes({});
|
||||
setHistory([]);
|
||||
setOrder(shuffle(roster.map((m) => m.id)));
|
||||
setDrag({ x: 0, y: 0, active: false });
|
||||
dragRef.current = { x: 0, y: 0 };
|
||||
setFly(null);
|
||||
setMatchId(null);
|
||||
setLikesOpen(false);
|
||||
busy.current = false;
|
||||
flash("已重新洗牌");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
const tag = (event.target as HTMLElement | null)?.tagName;
|
||||
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return;
|
||||
if (event.key === "ArrowRight") {
|
||||
event.preventDefault();
|
||||
if (current) commit(current, "like");
|
||||
} else if (event.key === "ArrowLeft") {
|
||||
event.preventDefault();
|
||||
if (current) commit(current, "pass");
|
||||
} else if (
|
||||
(event.key === "z" || event.key === "Z") &&
|
||||
(event.metaKey || event.ctrlKey)
|
||||
) {
|
||||
event.preventDefault();
|
||||
undo();
|
||||
} else if (event.key === "Backspace") {
|
||||
event.preventDefault();
|
||||
undo();
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [current, commit, undo]);
|
||||
|
||||
const rotate = drag.x / 18;
|
||||
const likeOpacity = Math.min(1, Math.max(0, drag.x / THRESHOLD));
|
||||
const passOpacity = Math.min(1, Math.max(0, -drag.x / THRESHOLD));
|
||||
|
||||
return (
|
||||
<div className="social-root social-live-root social-skin social-date-root">
|
||||
<header className="social-live-bar social-date-bar">
|
||||
<div className="social-live-bar-main">
|
||||
<Link href={socialPath("/")} className="social-nav-back">
|
||||
<ArrowLeft size={14} />
|
||||
首页
|
||||
</Link>
|
||||
<div>
|
||||
<strong>认识一下</strong>
|
||||
<p className="social-muted">
|
||||
左滑划走 · 右滑想认识
|
||||
{totalForFilter
|
||||
? ` · 还剩 ${remaining}/${totalForFilter}`
|
||||
: ""}
|
||||
</p>
|
||||
</div>
|
||||
<DemoBadge>示例介绍,方便先逛逛</DemoBadge>
|
||||
</div>
|
||||
<div className="social-date-bar-tools">
|
||||
<div className="social-filters" aria-label="筛选">
|
||||
{(
|
||||
[
|
||||
["all", "全部"],
|
||||
["f", "女生"],
|
||||
["m", "男生"],
|
||||
] as const
|
||||
).map(([id, label]) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
className={filter === id ? "active" : ""}
|
||||
aria-pressed={filter === id}
|
||||
onClick={() => setFilter(id)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{liked.length > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => setLikesOpen(true)}
|
||||
>
|
||||
<Heart size={14} />
|
||||
想认识 {liked.length}
|
||||
</button>
|
||||
) : null}
|
||||
<ShareButton path={socialPath("/date")} title="游民社区 · 认识一下" />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="social-date-stage">
|
||||
{totalForFilter > 0 ? (
|
||||
<div
|
||||
className="social-date-progress"
|
||||
aria-label={`还剩 ${remaining} 人`}
|
||||
>
|
||||
<i
|
||||
style={{
|
||||
width: `${Math.max(4, (remaining / totalForFilter) * 100)}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="social-date-deck" aria-live="polite">
|
||||
{!current && (
|
||||
<div className="social-date-empty">
|
||||
<span aria-hidden style={{ fontSize: 36 }}>
|
||||
✨
|
||||
</span>
|
||||
<strong>这批看完了</strong>
|
||||
<p className="social-muted">
|
||||
想认识的人会先记在你这边。可以再看一轮,或去聊天室打个招呼。
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={resetDeck}
|
||||
>
|
||||
<RotateCcw size={15} />
|
||||
再来一轮
|
||||
</button>
|
||||
{liked.length > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => setLikesOpen(true)}
|
||||
>
|
||||
<Heart size={15} />
|
||||
查看想认识 ({liked.length})
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{next && (
|
||||
<article className="social-date-card is-next" aria-hidden>
|
||||
<DateCardFace member={next} />
|
||||
</article>
|
||||
)}
|
||||
|
||||
{current && (
|
||||
<article
|
||||
className={`social-date-card is-top${drag.active ? " is-dragging" : ""}${fly ? ` is-fly-${fly.dir}` : ""}`}
|
||||
style={
|
||||
fly
|
||||
? undefined
|
||||
: {
|
||||
transform: `translate3d(${drag.x}px, ${drag.y}px, 0) rotate(${rotate}deg)`,
|
||||
}
|
||||
}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
onPointerCancel={onPointerUp}
|
||||
>
|
||||
<span
|
||||
className="social-date-stamp like"
|
||||
style={{ opacity: fly?.dir === "like" ? 1 : likeOpacity }}
|
||||
>
|
||||
想认识
|
||||
</span>
|
||||
<span
|
||||
className="social-date-stamp pass"
|
||||
style={{ opacity: fly?.dir === "pass" ? 1 : passOpacity }}
|
||||
>
|
||||
划走
|
||||
</span>
|
||||
<DateCardFace member={current} />
|
||||
</article>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<p className="social-date-hint" aria-hidden={!current}>
|
||||
拖卡片左右滑 · 或点下面按钮 · 撤销用 ⌘/Ctrl+Z
|
||||
</p>
|
||||
<div className="social-date-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="social-date-act pass"
|
||||
disabled={!current || Boolean(fly)}
|
||||
aria-label="跳过"
|
||||
onClick={() => current && commit(current, "pass")}
|
||||
>
|
||||
<X size={28} strokeWidth={2.4} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="social-date-act reset"
|
||||
disabled={!history.length}
|
||||
aria-label="撤销上一次"
|
||||
onClick={undo}
|
||||
>
|
||||
<Undo2 size={20} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="social-date-act like"
|
||||
disabled={!current || Boolean(fly)}
|
||||
aria-label="想认识"
|
||||
onClick={() => current && commit(current, "like")}
|
||||
>
|
||||
<Heart size={28} strokeWidth={2.2} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{liked.length > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
className="social-date-likes"
|
||||
onClick={() => setLikesOpen(true)}
|
||||
>
|
||||
<span>想认识 · {liked.length}</span>
|
||||
<div>
|
||||
{liked.slice(0, 8).map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={34} lazy />
|
||||
))}
|
||||
</div>
|
||||
<em>查看</em>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{toast ? (
|
||||
<div className="social-date-toast" role="status">
|
||||
{toast}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{matchMember ? (
|
||||
<SocialDialog
|
||||
title={`想认识 ${matchMember.name}`}
|
||||
onClose={() => setMatchId(null)}
|
||||
>
|
||||
<div className="social-member-profile">
|
||||
<SocialAvatar src={matchMember.avatar} size={74} />
|
||||
<div>
|
||||
<strong>{matchMember.name}</strong>
|
||||
<p>{matchMember.title}</p>
|
||||
<span className="social-member-city">
|
||||
<MapPin size={12} />
|
||||
{matchMember.city}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p>{matchMember.lookingFor}</p>
|
||||
<p className="social-muted">
|
||||
「想认识」会先记在你这边。下面可以去聊天室打个招呼——是大家一起聊,不是一对一私信。
|
||||
</p>
|
||||
<div className="social-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/people/${matchMember.id}`)}
|
||||
>
|
||||
看看 TA
|
||||
</Link>
|
||||
<Link
|
||||
className="social-btn"
|
||||
href={socialPath(
|
||||
`/chat?intro=${encodeURIComponent(
|
||||
`嗨 ${matchMember.name}!刚看到你,想聊聊「${matchMember.tags[0] || "远程生活"}」。`,
|
||||
)}`,
|
||||
)}
|
||||
>
|
||||
<MessageCircle size={15} />
|
||||
去打招呼
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => setMatchId(null)}
|
||||
>
|
||||
继续看看
|
||||
</button>
|
||||
</div>
|
||||
</SocialDialog>
|
||||
) : null}
|
||||
|
||||
{likesOpen ? (
|
||||
<SocialDialog title="想认识的人" onClose={() => setLikesOpen(false)}>
|
||||
<div className="social-date-match-list">
|
||||
{liked.map((m) => (
|
||||
<article key={m.id} className="social-date-match-row">
|
||||
<SocialAvatar src={m.avatar} size={48} lazy />
|
||||
<div>
|
||||
<strong>{m.name}</strong>
|
||||
<p>
|
||||
{m.title} · {m.city.split("·")[0].trim()}
|
||||
</p>
|
||||
</div>
|
||||
<Link
|
||||
className="social-btn"
|
||||
href={socialPath(`/people/${m.id}`)}
|
||||
>
|
||||
看看 TA
|
||||
</Link>
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(
|
||||
`/chat?intro=${encodeURIComponent(
|
||||
`嗨 ${m.name}!想认识你,方便聊聊吗?`,
|
||||
)}`,
|
||||
)}
|
||||
title="去聊天室打招呼"
|
||||
>
|
||||
打招呼
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-actions">
|
||||
<Link className="social-btn" href={socialPath("/people")}>
|
||||
回去看看大家
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={resetDeck}
|
||||
>
|
||||
<RotateCcw size={14} />
|
||||
再看一轮
|
||||
</button>
|
||||
</div>
|
||||
</SocialDialog>
|
||||
) : null}
|
||||
<SocialMobileDock />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DateCardFace({ member }: { member: SocialRosterMember }) {
|
||||
const cover = member.gallery?.[0] || member.avatar;
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className="social-date-photo"
|
||||
style={{ backgroundImage: `url(${cover})` }}
|
||||
role="img"
|
||||
aria-label={member.name}
|
||||
/>
|
||||
<div className="social-date-gradient" aria-hidden />
|
||||
{member.online ? (
|
||||
<span className="social-date-online-pill">现在在线</span>
|
||||
) : null}
|
||||
<div className="social-date-meta">
|
||||
<div className="social-date-name">
|
||||
<h2>{member.name}</h2>
|
||||
<p>
|
||||
{member.title}
|
||||
{member.vibe ? ` · ${member.vibe}` : ""}
|
||||
</p>
|
||||
</div>
|
||||
<p className="social-date-city">
|
||||
<MapPin size={14} />
|
||||
{member.city}
|
||||
</p>
|
||||
<p className="social-date-want">{member.lookingFor}</p>
|
||||
<p className="social-date-bio">{member.bio}</p>
|
||||
<div className="social-tags">
|
||||
{member.tags.slice(0, 4).map((tag) => (
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowUpRight,
|
||||
@ -8,26 +8,33 @@ import {
|
||||
Clock3,
|
||||
Globe2,
|
||||
MessageCircle,
|
||||
Radio,
|
||||
Video,
|
||||
} from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
PageIntro,
|
||||
SearchField,
|
||||
ShareButton,
|
||||
} from "./SocialUI";
|
||||
import { SEED_MEETUPS } from "@social/lib/seed";
|
||||
import { eventDate, saveEventCalendar } from "@social/lib/calendar";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { resolveSocialCatalog } from "@social/lib/resolveCatalog";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
|
||||
export default function EventDirectory() {
|
||||
const config = useSocialConfig();
|
||||
const catalog = useMemo(
|
||||
() => resolveSocialCatalog(config.copy.socialCatalogs),
|
||||
[config.copy.socialCatalogs],
|
||||
);
|
||||
const [query, setQuery] = useState("");
|
||||
const [filter, setFilter] = useState("all");
|
||||
const [saved] = useLocalState<string[]>("saved-events", []);
|
||||
const events = SEED_MEETUPS.filter(
|
||||
const events = catalog.meetups.filter(
|
||||
(item) =>
|
||||
`${item.title} ${item.city}`
|
||||
.toLowerCase()
|
||||
@ -35,19 +42,21 @@ export default function EventDirectory() {
|
||||
(filter !== "saved" || saved.includes(item.id)),
|
||||
);
|
||||
return (
|
||||
<SiteShell title="Meetup 活动">
|
||||
<PageIntro
|
||||
eyebrow="SHOW UP. FIND YOUR PEOPLE."
|
||||
title="把下一个晚上,"
|
||||
accent="留给有趣的对话。"
|
||||
description="线上办公室、城市闲聊、主题 AMA。你可以先听听,也可以分享一个正在探索的问题。"
|
||||
/>
|
||||
<div className="social-toolbar">
|
||||
<SiteShell title="开视频聊聊">
|
||||
<PageIntro title="随时,聊得来" accent="开视频">
|
||||
<DemoBadge>
|
||||
{catalog.source === "remote" ? "最新场次" : "先看看有哪些场"}
|
||||
</DemoBadge>
|
||||
</PageIntro>
|
||||
<p className="social-muted social-event-lead reveal">
|
||||
几个人一起开摄像头见面聊天,比只打字更近一点。
|
||||
</p>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label="搜索活动"
|
||||
placeholder="搜索主题或城市…"
|
||||
label="搜索"
|
||||
placeholder="主题 / 城市"
|
||||
/>
|
||||
<div className="social-filters">
|
||||
<button
|
||||
@ -55,124 +64,114 @@ export default function EventDirectory() {
|
||||
className={filter === "all" ? "active" : ""}
|
||||
onClick={() => setFilter("all")}
|
||||
>
|
||||
全部活动
|
||||
全部
|
||||
</button>
|
||||
<button
|
||||
aria-pressed={filter === "saved"}
|
||||
className={filter === "saved" ? "active" : ""}
|
||||
onClick={() => setFilter("saved")}
|
||||
>
|
||||
我的计划
|
||||
我想参加的
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-status">
|
||||
<div className="social-status social-event-banner reveal">
|
||||
<Globe2 size={15} />
|
||||
活动目录预览 · 原始时间默认使用北京时间(UTC+8)·
|
||||
加入计划仅保存在当前设备
|
||||
<span>
|
||||
时间按北京时间显示 · 「想参加」先记在你这边,还不等于已经约好
|
||||
</span>
|
||||
</div>
|
||||
<div className="social-event-grid">
|
||||
{events.map((event, index) => (
|
||||
<article
|
||||
className={`social-card social-event-card event-${index}`}
|
||||
className={`social-card social-event-card social-panel-fx reveal event-${index % 3}`}
|
||||
key={event.id}
|
||||
style={{ ["--stagger" as string]: `${index * 70}ms` }}
|
||||
>
|
||||
<div className="social-event-art" aria-hidden="true">
|
||||
<span>0{index + 1}</span>
|
||||
<div>
|
||||
{Array.from({ length: 24 }, (_, i) => (
|
||||
<i
|
||||
key={i}
|
||||
style={{
|
||||
height: `${14 + ((i * 17) % 56)}px`,
|
||||
animationDelay: `${i * -0.13}s`,
|
||||
}}
|
||||
/>
|
||||
<div className="social-event-art is-video" aria-hidden="true">
|
||||
<span>{String(index + 1).padStart(2, "0")}</span>
|
||||
<div className="social-video-grid social-video-grid-sm">
|
||||
{Array.from({ length: 4 }, (_, i) => (
|
||||
<span key={i} className="social-video-tile is-ghost" />
|
||||
))}
|
||||
</div>
|
||||
<Radio size={28} strokeWidth={1.3} />
|
||||
<Video size={26} strokeWidth={1.3} />
|
||||
</div>
|
||||
<div className="social-card-top">
|
||||
<span className="social-badge live">
|
||||
{event.mode === "hybrid" ? "线上 + 线下" : "线上相聚"}
|
||||
</span>
|
||||
<span className="social-badge">活动预览</span>
|
||||
</div>
|
||||
<h2>{event.title}</h2>
|
||||
<p className="social-event-time">
|
||||
<Clock3 size={14} />
|
||||
{event.date} · {event.time} 北京时间
|
||||
</p>
|
||||
<p className="social-muted" suppressHydrationWarning>
|
||||
你的当地时间:
|
||||
{eventDate(event).toLocaleString([], {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZoneName: "short",
|
||||
})}
|
||||
</p>
|
||||
<div className="social-card-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/meetup/${event.id}`)}
|
||||
>
|
||||
进入活动空间 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
<BookmarkButton
|
||||
id={event.id}
|
||||
collection="saved-events"
|
||||
label="加入计划"
|
||||
/>
|
||||
</div>
|
||||
<div className="social-card-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="social-save"
|
||||
onClick={() => saveEventCalendar(event)}
|
||||
>
|
||||
<CalendarPlus size={14} />
|
||||
添加到日历
|
||||
</button>
|
||||
<ShareButton
|
||||
path={`/social/meetup/${event.id}`}
|
||||
title={event.title}
|
||||
/>
|
||||
<Link
|
||||
className="social-save"
|
||||
href={socialPath(`/chat/${event.channelId}`)}
|
||||
>
|
||||
<MessageCircle size={14} />
|
||||
先去聊聊
|
||||
</Link>
|
||||
<div className="social-event-body">
|
||||
<div className="social-card-top">
|
||||
<span className="social-badge live">
|
||||
{event.mode === "hybrid" ? "线上+线下" : "线上见面"}
|
||||
</span>
|
||||
<span className="social-badge">可以先看看</span>
|
||||
</div>
|
||||
<h2>{event.title}</h2>
|
||||
<p className="social-event-time">
|
||||
<Clock3 size={14} />
|
||||
{event.date} · {event.time} 北京时间
|
||||
</p>
|
||||
<p className="social-muted" suppressHydrationWarning>
|
||||
你那边大约是:
|
||||
{eventDate(event).toLocaleString([], {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZoneName: "short",
|
||||
})}
|
||||
</p>
|
||||
<div className="social-event-cta">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/meetup/${event.id}`)}
|
||||
>
|
||||
去开视频 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
<BookmarkButton
|
||||
id={event.id}
|
||||
collection="saved-events"
|
||||
label="想参加"
|
||||
/>
|
||||
</div>
|
||||
<div className="social-event-tools">
|
||||
<button
|
||||
type="button"
|
||||
className="social-save"
|
||||
onClick={() => saveEventCalendar(event)}
|
||||
>
|
||||
<CalendarPlus size={14} />
|
||||
加到日历
|
||||
</button>
|
||||
<ShareButton
|
||||
path={socialPath(`/meetup/${event.id}`)}
|
||||
title={event.title}
|
||||
/>
|
||||
<Link className="social-save" href={socialPath("/chat")}>
|
||||
<MessageCircle size={14} />
|
||||
去聊天
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
{!events.length && (
|
||||
<EmptyState
|
||||
title="给下一场相遇留个位置"
|
||||
description="收藏感兴趣的活动后,可以在「我的计划」里找到它们。"
|
||||
/>
|
||||
emoji="📡"
|
||||
title="暂时没有合适的场"
|
||||
description="换个词试试,或者看看全部场次。"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setQuery("");
|
||||
setFilter("all");
|
||||
}}
|
||||
>
|
||||
重新看看
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
<section className="social-panel social-event-guide">
|
||||
<h2>第一次参加?轻松一点就好。</h2>
|
||||
<div>
|
||||
<p>
|
||||
<span>01</span>
|
||||
<strong>选一个话题</strong>看看标题,想一个你真的好奇的问题。
|
||||
</p>
|
||||
<p>
|
||||
<span>02</span>
|
||||
<strong>先在文字区打招呼</strong>说说你在哪里,正在做什么。
|
||||
</p>
|
||||
<p>
|
||||
<span>03</span>
|
||||
<strong>准备好了再开麦</strong>视频和麦克风由你自己决定。
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,29 +1,20 @@
|
||||
"use client";
|
||||
|
||||
/** Dense CSS-only floating emoji field — obvious motion, no framer. */
|
||||
/** Soft ambient accents — few, small, low opacity; never steal focus. */
|
||||
const EMOJIS = [
|
||||
{ e: "☕", x: "5%", y: "16%", delay: "0s", dur: "4.8s", size: "2.4rem" },
|
||||
{ e: "🌏", x: "90%", y: "18%", delay: "0.35s", dur: "5.4s", size: "2.6rem" },
|
||||
{ e: "💬", x: "80%", y: "55%", delay: "0.7s", dur: "4.6s", size: "2.1rem" },
|
||||
{ e: "🎒", x: "10%", y: "58%", delay: "1.1s", dur: "5.8s", size: "2.2rem" },
|
||||
{ e: "✨", x: "46%", y: "8%", delay: "0.15s", dur: "4.2s", size: "1.9rem" },
|
||||
{ e: "🤝", x: "60%", y: "72%", delay: "1.4s", dur: "5.2s", size: "2.15rem" },
|
||||
{ e: "🚀", x: "26%", y: "36%", delay: "0.55s", dur: "5.6s", size: "2rem" },
|
||||
{ e: "💚", x: "72%", y: "30%", delay: "0.95s", dur: "4.9s", size: "1.75rem" },
|
||||
{ e: "📡", x: "36%", y: "78%", delay: "1.25s", dur: "6s", size: "2.05rem" },
|
||||
{ e: "🔥", x: "94%", y: "68%", delay: "0.4s", dur: "4.5s", size: "2rem" },
|
||||
{ e: "🌈", x: "18%", y: "28%", delay: "1.6s", dur: "5.3s", size: "1.85rem" },
|
||||
{ e: "🎯", x: "54%", y: "48%", delay: "0.85s", dur: "5.1s", size: "1.7rem" },
|
||||
{ e: "💫", x: "68%", y: "12%", delay: "1.8s", dur: "4.7s", size: "1.8rem" },
|
||||
{ e: "🌊", x: "42%", y: "62%", delay: "0.25s", dur: "5.9s", size: "1.95rem" },
|
||||
{ e: "☕", x: "8%", y: "22%", delay: "0s", dur: "9s", size: "1.1rem" },
|
||||
{ e: "🌏", x: "88%", y: "20%", delay: "1.2s", dur: "11s", size: "1.15rem" },
|
||||
{ e: "✨", x: "78%", y: "62%", delay: "2.4s", dur: "10s", size: "0.95rem" },
|
||||
{ e: "💬", x: "14%", y: "68%", delay: "0.8s", dur: "12s", size: "1rem" },
|
||||
{ e: "🚀", x: "52%", y: "12%", delay: "3s", dur: "10.5s", size: "0.9rem" },
|
||||
];
|
||||
|
||||
export default function FloatingEmojiField() {
|
||||
return (
|
||||
<div className="social-emoji-field" aria-hidden>
|
||||
<div className="social-emoji-field social-emoji-field-soft" aria-hidden>
|
||||
{EMOJIS.map((item) => (
|
||||
<span
|
||||
key={item.e + item.x + item.y}
|
||||
key={item.e + item.x}
|
||||
className="social-emoji-float"
|
||||
style={{
|
||||
left: item.x,
|
||||
|
||||
@ -1,27 +1,10 @@
|
||||
"use client";
|
||||
|
||||
/** Endless emoji marquee between sections — CSS only. */
|
||||
const ROW = [
|
||||
"☕",
|
||||
"🌏",
|
||||
"💬",
|
||||
"🎒",
|
||||
"✨",
|
||||
"🤝",
|
||||
"📡",
|
||||
"🚀",
|
||||
"💚",
|
||||
"🎯",
|
||||
"🔥",
|
||||
"🌈",
|
||||
"💫",
|
||||
"🌊",
|
||||
"👋",
|
||||
"🎤",
|
||||
];
|
||||
/** Quiet section divider — sparse glyphs, low visual weight. */
|
||||
const ROW = ["☕", "🌏", "💬", "✨", "📡", "🚀"];
|
||||
|
||||
export default function FxBelt() {
|
||||
const line = [...ROW, ...ROW, ...ROW].join(" ");
|
||||
const line = [...ROW, ...ROW, ...ROW].join(" ");
|
||||
return (
|
||||
<div className="social-fx-belt" aria-hidden>
|
||||
<div className="social-fx-belt-track">
|
||||
|
||||
@ -1,33 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState, type PointerEvent } from "react";
|
||||
import { useEffect, useMemo, useState, type PointerEvent } from "react";
|
||||
import Link from "next/link";
|
||||
import SiteShell from "./SiteShell";
|
||||
import JoinPayModal from "./JoinPayModal";
|
||||
import AttractiveRoster from "./AttractiveRoster";
|
||||
import WorldConnections from "./WorldConnections";
|
||||
import ConnectionHero, { ConnectionWays } from "./ConnectionHero";
|
||||
import FxBelt from "./FxBelt";
|
||||
import SectionSpark from "./SectionSpark";
|
||||
import { ArrowUpRight, Coffee, Radio, Sparkles } from "lucide-react";
|
||||
import CityDirectory from "./CityDirectory";
|
||||
import SocialBrandLogo from "./SocialBrandLogo";
|
||||
import SocialAvatar from "./SocialAvatar";
|
||||
import {
|
||||
SEED_CAFES,
|
||||
SEED_GIGS,
|
||||
SEED_MEETUPS,
|
||||
TEAM_KIND_LABEL,
|
||||
} from "@social/lib/seed";
|
||||
ArrowUpRight,
|
||||
BookOpen,
|
||||
Heart,
|
||||
Sparkles,
|
||||
Video,
|
||||
} 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 { useRemoteConfig } from "~/lib/use-remote-config";
|
||||
import { resolveSocialLandingCopy } from "@social/lib/landing";
|
||||
import { MOCK_ROSTER } from "@social/lib/rosterMock";
|
||||
|
||||
const DEFAULT_PROMO =
|
||||
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4";
|
||||
|
||||
const PATH = [
|
||||
{ href: "#people", label: "想见的人", emoji: "👋" },
|
||||
{ href: "#meetup", label: "Meetup", emoji: "📡" },
|
||||
{ href: "#coffeechat", label: "Coffeechat", emoji: "☕" },
|
||||
{ href: "#team", label: "远程组队", emoji: "🚀" },
|
||||
{ href: "#date", label: "认识一下", emoji: "💕" },
|
||||
{ href: "#meetup", label: "开视频", emoji: "📹" },
|
||||
{ href: "#cities", label: "见一面", emoji: "🌆" },
|
||||
{ href: "#team", label: "一起做事", emoji: "🚀" },
|
||||
] as const;
|
||||
|
||||
const ROLE_EMOJI: Record<string, string> = {
|
||||
@ -47,6 +53,13 @@ export default function HomeClient() {
|
||||
)?.promoVideoUrl?.trim() ||
|
||||
DEFAULT_PROMO;
|
||||
const landingCopy = resolveSocialLandingCopy(config.copy);
|
||||
const catalog = useMemo(
|
||||
() => resolveSocialCatalog(config.copy.socialCatalogs),
|
||||
[config.copy.socialCatalogs],
|
||||
);
|
||||
const meetups = catalog.meetups;
|
||||
const gigs = catalog.gigs;
|
||||
const datePreview = MOCK_ROSTER.filter((m) => m.online).slice(0, 3);
|
||||
|
||||
useEffect(() => {
|
||||
const root = document.querySelector(".social-home");
|
||||
@ -123,7 +136,6 @@ export default function HomeClient() {
|
||||
copy={landingCopy}
|
||||
/>
|
||||
<ConnectionWays copy={landingCopy} />
|
||||
<WorldConnections />
|
||||
|
||||
<nav className="social-path" aria-label="本页导航">
|
||||
<div className="container">
|
||||
@ -149,91 +161,174 @@ export default function HomeClient() {
|
||||
|
||||
<AttractiveRoster onJoin={() => setJoinOpen(true)} />
|
||||
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="date"
|
||||
aria-label="认识一下"
|
||||
>
|
||||
<div className="container">
|
||||
<div className="social-date-hero reveal">
|
||||
<div className="social-date-hero-copy">
|
||||
<span className="section-tag">
|
||||
<span>认识一下</span>
|
||||
<span>左右滑</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
💕
|
||||
</span>
|
||||
一张一张认识新朋友
|
||||
</h2>
|
||||
<p>
|
||||
像翻相册一样:不感兴趣就划走,想认识就留下。
|
||||
记在你这边,之后再决定要不要打招呼。
|
||||
</p>
|
||||
<ul className="social-date-hero-steps">
|
||||
<li>
|
||||
<em>←</em> 划走
|
||||
</li>
|
||||
<li>
|
||||
<em>→</em> 想认识
|
||||
</li>
|
||||
<li>
|
||||
<em>♥</em> 稍后打招呼
|
||||
</li>
|
||||
</ul>
|
||||
<div className="social-date-stage-acts">
|
||||
<Link
|
||||
className="btn btn-primary"
|
||||
href={socialPath("/date")}
|
||||
>
|
||||
开始认识
|
||||
<ArrowUpRight size={16} />
|
||||
</Link>
|
||||
<Link
|
||||
className="btn btn-ghost"
|
||||
href={socialPath("/people")}
|
||||
>
|
||||
先浏览大家
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Link
|
||||
href={socialPath("/date")}
|
||||
className="social-date-hero-deck"
|
||||
aria-label="开始认识"
|
||||
>
|
||||
{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">在线</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} /> 点这里开始滑
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="meetup"
|
||||
aria-label="Meetup"
|
||||
aria-label="开视频聊聊"
|
||||
>
|
||||
<div className="container">
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="meetup" />
|
||||
<span className="section-tag">
|
||||
<span>02 / MEETUP</span>
|
||||
<span>让想法在对话中发生</span>
|
||||
<span>开视频</span>
|
||||
<span>{meetups.length} 场可看</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
📡
|
||||
📹
|
||||
</span>
|
||||
隔着屏幕,也能聊到同频
|
||||
{landingCopy.socialOnlineTitle}
|
||||
</h2>
|
||||
<p>
|
||||
{SEED_MEETUPS.length} 场活动预览 ·
|
||||
可以先听听,再慢慢打开话匣子
|
||||
几个人一起开摄像头见面,比只打字更近一点。
|
||||
「想参加」会先记在你这边。
|
||||
</p>
|
||||
</div>
|
||||
<div className="social-panel-grid social-panel-grid-2">
|
||||
{SEED_MEETUPS.map((m, i) => (
|
||||
{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" aria-hidden="true">
|
||||
<span className="connection-meetup-number">0{i + 1}</span>
|
||||
<div className="connection-audio-bars">
|
||||
{Array.from({ length: 18 }, (_, n) => (
|
||||
<i
|
||||
key={n}
|
||||
style={{
|
||||
height: `${12 + ((n * 17 + i * 13) % 55)}px`,
|
||||
animationDelay: `${n * -0.15}s`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className="connection-meetup-art is-video"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className="connection-meetup-number">
|
||||
0{i + 1}
|
||||
</span>
|
||||
<div className="social-video-grid">
|
||||
{MOCK_ROSTER.slice(i, i + 4).map((p) => (
|
||||
<span key={p.id} className="social-video-tile">
|
||||
<SocialAvatar src={p.avatar} size={36} lazy />
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<Radio size={26} strokeWidth={1.2} />
|
||||
<Video size={22} strokeWidth={1.3} />
|
||||
</div>
|
||||
<div className="social-panel-meta">
|
||||
<span>{m.city === "Online" ? "线上" : m.city}</span>
|
||||
<span>{m.city === "Online" ? "线上见面" : m.city}</span>
|
||||
<time>
|
||||
{m.date} · {m.time}
|
||||
</time>
|
||||
</div>
|
||||
<h3>{m.title}</h3>
|
||||
<p>文字暖场 → MiroTalk 开麦 → 认识新朋友</p>
|
||||
<p>进来开摄像头,和几位新朋友面对面聊</p>
|
||||
<Link
|
||||
className="btn btn-primary btn-sm"
|
||||
href={socialPath(`/meetup/${m.id}`)}
|
||||
>
|
||||
进房
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
aria-hidden
|
||||
>
|
||||
<path d="M5 12h14M12 5l7 7-7 7" />
|
||||
</svg>
|
||||
去开视频
|
||||
<ArrowUpRight size={14} />
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-section-actions reveal">
|
||||
<Link href={socialPath("/meetup")} className="btn btn-ghost">
|
||||
全部 Meetup
|
||||
看看全部
|
||||
</Link>
|
||||
<Link href={socialPath("/chat")} className="btn btn-ghost">
|
||||
去文字聊天
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost"
|
||||
onClick={() => setJoinOpen(true)}
|
||||
>
|
||||
加群占座
|
||||
加入社区
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -243,72 +338,38 @@ export default function HomeClient() {
|
||||
|
||||
<section
|
||||
className="section section-compact"
|
||||
id="coffeechat"
|
||||
aria-label="Coffeechat"
|
||||
id="cities"
|
||||
aria-label="同城见一面"
|
||||
>
|
||||
<div className="container">
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="coffee" />
|
||||
<SectionSpark label="cities" />
|
||||
<span className="section-tag">
|
||||
<span>03 / COFFEECHAT</span>
|
||||
<span>把线上默契,带到线下</span>
|
||||
<span>挑一座城</span>
|
||||
<span>再出来见面</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
☕
|
||||
🌆
|
||||
</span>
|
||||
咖啡馆里把网友变朋友
|
||||
{landingCopy.socialOfflineTitle}
|
||||
</h2>
|
||||
<p>精选合作店 · 插座够 · 适合 1v1 / 小局</p>
|
||||
</div>
|
||||
<div className="social-panel-grid social-panel-grid-4">
|
||||
{SEED_CAFES.map((c, i) => (
|
||||
<article
|
||||
key={c.id}
|
||||
className={`social-panel social-panel-fx connection-cafe connection-cafe-${i} reveal`}
|
||||
style={{ ["--stagger" as string]: `${i * 70}ms` }}
|
||||
>
|
||||
<div
|
||||
className="social-panel-ico social-panel-ico-bounce"
|
||||
aria-hidden
|
||||
>
|
||||
<Coffee size={27} strokeWidth={1.3} />
|
||||
</div>
|
||||
<div className="social-panel-meta">
|
||||
<span>{c.city}</span>
|
||||
{c.partners ? (
|
||||
<span className="is-warm">合作店</span>
|
||||
) : null}
|
||||
</div>
|
||||
<h3>{c.name}</h3>
|
||||
<p>{c.vibe}</p>
|
||||
<div className="social-panel-foot">
|
||||
<span>⭐ {c.rating}</span>
|
||||
<span>📶 {c.wifiMbps}M</span>
|
||||
</div>
|
||||
<Link
|
||||
className="btn btn-primary btn-sm"
|
||||
href={socialPath("/coffeechat")}
|
||||
>
|
||||
约见
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
<p>
|
||||
认识了、聊过之后,出来见一面会更自然。
|
||||
先挑一座城市,再找适合见面的咖啡馆。
|
||||
</p>
|
||||
</div>
|
||||
<CityDirectory compact limit={8} />
|
||||
<div className="social-section-actions reveal">
|
||||
<Link
|
||||
href={socialPath("/coffeechat")}
|
||||
className="btn btn-ghost"
|
||||
className="btn btn-primary"
|
||||
>
|
||||
全部咖啡馆
|
||||
看看咖啡馆
|
||||
</Link>
|
||||
<Link href={socialPath("/people")} className="btn btn-ghost">
|
||||
找同城的人
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost"
|
||||
onClick={() => setJoinOpen(true)}
|
||||
>
|
||||
加群找同城
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -318,28 +379,38 @@ export default function HomeClient() {
|
||||
<section
|
||||
className="section section-compact social-section-alt"
|
||||
id="team"
|
||||
aria-label="远程团队"
|
||||
aria-label="一起做点事"
|
||||
>
|
||||
<div className="container">
|
||||
<div className="section-header reveal">
|
||||
<SectionSpark label="team" />
|
||||
<span className="section-tag">
|
||||
<span>04 / CO-CREATE</span>
|
||||
<span>好的伙伴,让自由走得更远</span>
|
||||
<span>找搭子</span>
|
||||
<span>共创</span>
|
||||
</span>
|
||||
<h2>
|
||||
<span className="social-title-emoji" aria-hidden>
|
||||
🚀
|
||||
</span>
|
||||
有些可能,适合一起实现
|
||||
{landingCopy.socialTeamTitle}
|
||||
</h2>
|
||||
<p>志愿 / 兼职 / 全职 · 先聊人再投 · 群里可问内推</p>
|
||||
<p>
|
||||
有人在找帮手;也有人一起写小册、拍视频做共创。
|
||||
点卡片看看详情,合适再表达兴趣。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="social-together-tabs reveal" aria-hidden>
|
||||
<span className="is-on">找搭子</span>
|
||||
<span>共创</span>
|
||||
</div>
|
||||
|
||||
<div className="social-panel-grid social-panel-grid-3">
|
||||
{SEED_GIGS.slice(0, 6).map((g, i) => (
|
||||
<article
|
||||
{gigs.slice(0, 3).map((g, i) => (
|
||||
<Link
|
||||
key={g.id}
|
||||
className="social-panel social-panel-fx connection-team reveal"
|
||||
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>
|
||||
@ -347,7 +418,7 @@ export default function HomeClient() {
|
||||
</div>
|
||||
<div className="social-panel-meta">
|
||||
<span>{TEAM_KIND_LABEL[g.kind || "parttime"]}</span>
|
||||
<span>{g.remote ? "远程" : "可线下"}</span>
|
||||
<span>{g.remote ? "线上也能做" : "可以见面做"}</span>
|
||||
</div>
|
||||
<h3>{g.title}</h3>
|
||||
<p>{g.pay}</p>
|
||||
@ -356,25 +427,62 @@ export default function HomeClient() {
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
<Link
|
||||
className="btn btn-primary btn-sm"
|
||||
href={socialPath("/team")}
|
||||
>
|
||||
聊聊
|
||||
</Link>
|
||||
</article>
|
||||
</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>共创 · 小册</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>共创 · 视频</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">
|
||||
全部岗位
|
||||
更多机会
|
||||
</Link>
|
||||
<Link href={socialPath("/ebook")} className="btn btn-ghost">
|
||||
逛共创
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost"
|
||||
onClick={() => setJoinOpen(true)}
|
||||
>
|
||||
加群问内推
|
||||
加入社区
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -390,7 +498,7 @@ export default function HomeClient() {
|
||||
<Sparkles size={52} strokeWidth={1} />
|
||||
</div>
|
||||
<div>
|
||||
<span className="connection-eyebrow">YOUR NEXT CHAPTER</span>
|
||||
<span className="connection-eyebrow">加入社区</span>
|
||||
<h2>{landingCopy.socialInviteTitle}</h2>
|
||||
<p>{landingCopy.socialInviteLead}</p>
|
||||
</div>
|
||||
@ -408,31 +516,29 @@ export default function HomeClient() {
|
||||
<div className="container">
|
||||
<div className="footer-grid footer-grid-rings">
|
||||
<div className="footer-brand">
|
||||
<div className="nav-logo">
|
||||
<span className="logo-icon social-logo-spin">◈</span>
|
||||
<span className="logo-text">游民社区</span>
|
||||
</div>
|
||||
<p>数字游民社交场:加群、Coffeechat、Meetup、远程组队。</p>
|
||||
<SocialBrandLogo />
|
||||
<p>认识同频的人 · 开视频聊聊 · 出来见一面 · 一起做点事</p>
|
||||
</div>
|
||||
<div className="footer-links">
|
||||
<h4>连接</h4>
|
||||
<h4>认识人</h4>
|
||||
<button
|
||||
type="button"
|
||||
className="social-footer-link"
|
||||
onClick={() => setJoinOpen(true)}
|
||||
>
|
||||
加群
|
||||
加入社区
|
||||
</button>
|
||||
<Link href={socialPath("/chat")}>聊天室</Link>
|
||||
<Link href={socialPath("/meetup")}>Meetup</Link>
|
||||
<Link href={socialPath("/coffeechat")}>Coffeechat</Link>
|
||||
<Link href={socialPath("/people")}>想见的人</Link>
|
||||
<Link href={socialPath("/date")}>认识一下</Link>
|
||||
<Link href={socialPath("/meetup")}>开视频聊聊</Link>
|
||||
<Link href={socialPath("/chat")}>大家聊天</Link>
|
||||
</div>
|
||||
<div className="footer-links">
|
||||
<h4>成长</h4>
|
||||
<Link href={socialPath("/roster")}>花名册</Link>
|
||||
<Link href={socialPath("/vip")}>VIP</Link>
|
||||
<Link href={socialPath("/team")}>远程团队</Link>
|
||||
<Link href={socialPath("/feedback")}>反馈</Link>
|
||||
<h4>见面 · 做事</h4>
|
||||
<Link href={socialPath("/coffeechat")}>找城市见面</Link>
|
||||
<Link href={socialPath("/team")}>找搭子做事</Link>
|
||||
<Link href={socialPath("/ebook")}>共创</Link>
|
||||
<Link href={socialPath("/feedback")}>说说想法</Link>
|
||||
</div>
|
||||
<div className="footer-links">
|
||||
<h4>更多</h4>
|
||||
|
||||
@ -111,7 +111,7 @@ function JoinPaySheet({ onClose }: Pick<Props, "onClose">) {
|
||||
<div className="social-join-sheet">
|
||||
<header className="social-join-sheet-head">
|
||||
<span className="social-join-brand">
|
||||
<Sparkles size={17} /> NOMADRO SOCIAL
|
||||
<Sparkles size={17} /> 游民社区
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
@ -124,10 +124,10 @@ function JoinPaySheet({ onClose }: Pick<Props, "onClose">) {
|
||||
</button>
|
||||
</header>
|
||||
<h2 id={titleId} className="social-join-title">
|
||||
加群,遇见你的同类。
|
||||
加入游民社区
|
||||
</h2>
|
||||
<p id={descriptionId} className="social-muted">
|
||||
一起聊天、喝咖啡、做点有趣的事。
|
||||
认识同频的人 · 开视频聊聊 · 出来见一面 · 一起做点事
|
||||
<br />
|
||||
{channelHint}
|
||||
</p>
|
||||
@ -139,7 +139,7 @@ function JoinPaySheet({ onClose }: Pick<Props, "onClose">) {
|
||||
type="email"
|
||||
inputMode="email"
|
||||
autoComplete="email"
|
||||
placeholder="you@example.com"
|
||||
placeholder="你的邮箱"
|
||||
value={email}
|
||||
aria-invalid={Boolean(err)}
|
||||
aria-describedby={err ? errorId : undefined}
|
||||
|
||||
@ -1,3 +1,357 @@
|
||||
"use client";
|
||||
|
||||
export { default } from "./MeetupRoom";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { MIROTALK_URL, SEED_CHANNELS } from "@social/lib/seed";
|
||||
import { loadJson, saveJson } from "@social/lib/storage";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { resolveSocialCatalog } from "@social/lib/resolveCatalog";
|
||||
import { useSocialChat } from "@social/lib/useSocialChat";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import { SocialMobileDock } from "./SocialNavigation";
|
||||
|
||||
type Layout = "split" | "video" | "chat";
|
||||
|
||||
/** Origins allowed by MiroTalk ALLOWED_EMBED_ORIGINS. */
|
||||
const EMBED_OK = new Set([
|
||||
"https://nomadro.cn",
|
||||
"https://www.nomadro.cn",
|
||||
"https://nomadweb.nomadro.com",
|
||||
"https://social.nomadro.cn",
|
||||
"http://localhost:3000",
|
||||
"http://127.0.0.1:3000",
|
||||
"http://localhost:3001",
|
||||
"http://127.0.0.1:3001",
|
||||
]);
|
||||
|
||||
function joinUrl(room: string, name: string) {
|
||||
const q = new URLSearchParams({
|
||||
room,
|
||||
name,
|
||||
notify: "0",
|
||||
chat: "0",
|
||||
audio: "1",
|
||||
video: "1",
|
||||
});
|
||||
return `${MIROTALK_URL.replace(/\/$/, "")}/join?${q.toString()}`;
|
||||
}
|
||||
|
||||
function canEmbedHere() {
|
||||
if (typeof window === "undefined") return true;
|
||||
return EMBED_OK.has(window.location.origin);
|
||||
}
|
||||
|
||||
function warmMirotalkOrigin() {
|
||||
try {
|
||||
const origin = new URL(MIROTALK_URL).origin;
|
||||
for (const rel of ["dns-prefetch", "preconnect"] as const) {
|
||||
if (document.querySelector(`link[rel="${rel}"][href="${origin}"]`))
|
||||
continue;
|
||||
const link = document.createElement("link");
|
||||
link.rel = rel;
|
||||
link.href = origin;
|
||||
if (rel === "preconnect") link.crossOrigin = "anonymous";
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
void fetch(`${origin}/js/nomadro-speed.js`, {
|
||||
mode: "no-cors",
|
||||
credentials: "omit",
|
||||
cache: "force-cache",
|
||||
}).catch(() => undefined);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
function defaultLayout(): Layout {
|
||||
if (
|
||||
typeof window !== "undefined" &&
|
||||
window.matchMedia("(max-width: 768px)").matches
|
||||
) {
|
||||
return "video";
|
||||
}
|
||||
return "split";
|
||||
}
|
||||
|
||||
export default function MeetupLiveClient({ meetupId }: { meetupId: string }) {
|
||||
const config = useSocialConfig();
|
||||
const meetups = useMemo(
|
||||
() => resolveSocialCatalog(config.copy.socialCatalogs).meetups,
|
||||
[config.copy.socialCatalogs],
|
||||
);
|
||||
const meetup =
|
||||
meetups.find((m) => m.id === meetupId) ||
|
||||
meetups[0] || {
|
||||
id: meetupId,
|
||||
title: "开视频见面",
|
||||
city: "Online",
|
||||
date: "",
|
||||
time: "",
|
||||
mode: "online" as const,
|
||||
mirotalkRoom: meetupId,
|
||||
channelId: "meetup-live",
|
||||
};
|
||||
const channel =
|
||||
SEED_CHANNELS.find((c) => c.id === meetup.channelId) || SEED_CHANNELS[0];
|
||||
const chat = useSocialChat(channel.id);
|
||||
|
||||
const [layout, setLayout] = useState<Layout>("split");
|
||||
const [joinName, setJoinName] = useState("");
|
||||
const [videoReady, setVideoReady] = useState(false);
|
||||
const [embedBlocked, setEmbedBlocked] = useState(false);
|
||||
const [iframeLoading, setIframeLoading] = useState(true);
|
||||
const bottomRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const videoSrc = useMemo(
|
||||
() => joinUrl(meetup.mirotalkRoom, joinName || "游民"),
|
||||
[meetup.mirotalkRoom, joinName],
|
||||
);
|
||||
const preferEmbed = canEmbedHere() && !embedBlocked;
|
||||
|
||||
useEffect(() => {
|
||||
setLayout(defaultLayout());
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
warmMirotalkOrigin();
|
||||
const name = (loadJson("nick", "游民") || "游民").trim() || "游民";
|
||||
chat.setNick(name);
|
||||
setJoinName(name);
|
||||
if (canEmbedHere()) {
|
||||
setIframeLoading(true);
|
||||
setVideoReady(true);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- mount once
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
}, [chat.messages]);
|
||||
|
||||
const startVideo = useCallback(
|
||||
(forceReload = false) => {
|
||||
const name = chat.nick.trim() || "游民";
|
||||
saveJson("nick", name);
|
||||
setJoinName(name);
|
||||
if (!preferEmbed) {
|
||||
window.location.assign(joinUrl(meetup.mirotalkRoom, name));
|
||||
return;
|
||||
}
|
||||
setIframeLoading(true);
|
||||
if (forceReload && videoReady) {
|
||||
setVideoReady(false);
|
||||
window.requestAnimationFrame(() => setVideoReady(true));
|
||||
} else {
|
||||
setVideoReady(true);
|
||||
}
|
||||
},
|
||||
[chat.nick, meetup.mirotalkRoom, preferEmbed, videoReady],
|
||||
);
|
||||
|
||||
const send = async () => {
|
||||
if (!chat.draft.trim() || chat.sending) return;
|
||||
await chat.send(chat.draft);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="social-root social-live-root social-skin social-meetup-live">
|
||||
<header className="social-live-bar">
|
||||
<div className="social-live-bar-main">
|
||||
<Link href={socialPath("/meetup")} className="social-nav-back">
|
||||
← 回去看场次
|
||||
</Link>
|
||||
<div>
|
||||
<strong>{meetup.title}</strong>
|
||||
<p className="social-muted">
|
||||
{meetup.date} {meetup.time} · {channel.name}
|
||||
</p>
|
||||
</div>
|
||||
<span
|
||||
className={`social-live-conn ${chat.status === "offline" ? "is-off" : chat.status === "online" ? "is-on" : ""}`}
|
||||
role="status"
|
||||
>
|
||||
{chat.status === "online"
|
||||
? "聊天已接通"
|
||||
: chat.status === "offline"
|
||||
? "聊天暂时断了"
|
||||
: chat.status === "preview"
|
||||
? "先看看示例"
|
||||
: "正在连上…"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="social-live-bar-tools">
|
||||
<label className="social-live-nick">
|
||||
<span className="social-muted">昵称</span>
|
||||
<input
|
||||
value={chat.nick}
|
||||
onChange={(e) => chat.setNick(e.target.value)}
|
||||
onBlur={() => saveJson("nick", chat.nick.trim() || "游民")}
|
||||
maxLength={24}
|
||||
aria-label="显示名"
|
||||
/>
|
||||
</label>
|
||||
{videoReady &&
|
||||
preferEmbed &&
|
||||
chat.nick.trim() &&
|
||||
chat.nick.trim() !== joinName ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => startVideo(true)}
|
||||
title="用新名字重新进入视频"
|
||||
>
|
||||
换名字重进
|
||||
</button>
|
||||
) : null}
|
||||
<div className="social-live-tabs" role="tablist" aria-label="怎么看">
|
||||
{(["split", "video", "chat"] as const).map((m) => (
|
||||
<button
|
||||
key={m}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={layout === m}
|
||||
className={`social-live-tab${layout === m ? " active" : ""}`}
|
||||
onClick={() => setLayout(m)}
|
||||
>
|
||||
{m === "split" ? "一起看" : m === "video" ? "只看视频" : "只看聊天"}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className={`social-live-stage layout-${layout}`}>
|
||||
{(layout === "split" || layout === "video") && (
|
||||
<section className="social-live-video" aria-label="开视频">
|
||||
{!videoReady ? (
|
||||
<div className="social-live-gate">
|
||||
<div className="social-live-radar" aria-hidden>
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<span>LIVE</span>
|
||||
</div>
|
||||
<h2>准备开视频见面</h2>
|
||||
<p>
|
||||
{preferEmbed
|
||||
? "麦克风和摄像头先关着,进去后再打开就好。"
|
||||
: "这里暂时不能直接嵌视频,点下面会跳转到视频页面。"}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={() => startVideo()}
|
||||
>
|
||||
开始见面
|
||||
</button>
|
||||
<p className="social-muted">
|
||||
「想参加」还不等于已经约好 · 随时可以离开回去看别的场
|
||||
</p>
|
||||
</div>
|
||||
) : preferEmbed ? (
|
||||
<div className="social-live-frame-wrap">
|
||||
{iframeLoading && (
|
||||
<div
|
||||
className="social-live-iframe-overlay social-live-iframe-overlay--thin"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="social-live-iframe-mark" aria-hidden>
|
||||
N
|
||||
</div>
|
||||
<p>接通中…</p>
|
||||
</div>
|
||||
)}
|
||||
<iframe
|
||||
title={`${meetup.title} video`}
|
||||
src={videoSrc}
|
||||
className="social-live-iframe"
|
||||
allow="camera; microphone; display-capture; autoplay; fullscreen; clipboard-write"
|
||||
referrerPolicy="no-referrer-when-downgrade"
|
||||
loading="eager"
|
||||
onLoad={() => setIframeLoading(false)}
|
||||
onError={() => {
|
||||
setEmbedBlocked(true);
|
||||
setIframeLoading(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="social-live-gate">
|
||||
<h2>本页跳转进房</h2>
|
||||
<p>不新开标签;浏览器返回即可回到游民社区。</p>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={() => window.location.assign(videoSrc)}
|
||||
>
|
||||
立即进入
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{(layout === "split" || layout === "chat") && (
|
||||
<section className="social-live-chat" aria-label="文字频道">
|
||||
<div className="social-live-chat-head">
|
||||
<strong>{channel.name}</strong>
|
||||
<span className="social-muted">{channel.topic}</span>
|
||||
</div>
|
||||
<div className="social-chat-thread social-live-thread">
|
||||
{!chat.messages.length ? (
|
||||
<div className="social-live-empty">
|
||||
<strong>文字频道还很安静</strong>
|
||||
<p>先打个招呼,或问问今晚谁在听。</p>
|
||||
</div>
|
||||
) : null}
|
||||
{chat.messages.map((m) => (
|
||||
<div
|
||||
key={m.id}
|
||||
className={`social-bubble${m.mine ? " mine" : ""}`}
|
||||
>
|
||||
<header>
|
||||
{m.author}
|
||||
<time suppressHydrationWarning>
|
||||
{new Date(m.at).toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
</time>
|
||||
{m.delivery === "demo" ? <span>示例</span> : null}
|
||||
{m.delivery === "local" ? <span>先留在你这边</span> : null}
|
||||
</header>
|
||||
<p>{m.text}</p>
|
||||
</div>
|
||||
))}
|
||||
<div ref={bottomRef} />
|
||||
</div>
|
||||
<div className="social-compose">
|
||||
<input
|
||||
value={chat.draft}
|
||||
onChange={(e) => chat.setDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
void send();
|
||||
}
|
||||
}}
|
||||
placeholder="发到活动文字频道…"
|
||||
aria-label="消息内容"
|
||||
maxLength={2000}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
disabled={!chat.draft.trim() || chat.sending}
|
||||
onClick={() => void send()}
|
||||
>
|
||||
发送
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
<SocialMobileDock />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,257 +1,4 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowUpRight,
|
||||
Camera,
|
||||
CameraOff,
|
||||
Columns2,
|
||||
ExternalLink,
|
||||
Maximize2,
|
||||
MessageCircle,
|
||||
Mic,
|
||||
MicOff,
|
||||
Radio,
|
||||
RefreshCw,
|
||||
Video,
|
||||
} from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import { Conversation } from "./ChatWorkspace";
|
||||
import { EmptyState, ShareButton } from "./SocialUI";
|
||||
import { MIROTALK_URL, SEED_MEETUPS } from "@social/lib/seed";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
|
||||
type Settings = { name: string; audio: boolean; video: boolean };
|
||||
function videoUrl(room: string, settings: Settings) {
|
||||
const query = new URLSearchParams({
|
||||
room,
|
||||
name: settings.name,
|
||||
notify: "0",
|
||||
chat: "0",
|
||||
audio: settings.audio ? "1" : "0",
|
||||
video: settings.video ? "1" : "0",
|
||||
});
|
||||
return `${MIROTALK_URL.replace(/\/$/, "")}/join?${query}`;
|
||||
}
|
||||
export default function MeetupRoom({ meetupId }: { meetupId: string }) {
|
||||
const meetup = SEED_MEETUPS.find((item) => item.id === meetupId);
|
||||
const [nick, setNick] = useLocalState("nick", "游民");
|
||||
const [audio, setAudio] = useState(false);
|
||||
const [video, setVideo] = useState(false);
|
||||
const [joined, setJoined] = useState<Settings | null>(null);
|
||||
const [layout, setLayout] = useState<"split" | "video" | "chat">("split");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [slow, setSlow] = useState(false);
|
||||
const [reload, setReload] = useState(0);
|
||||
const [fullscreenError, setFullscreenError] = useState("");
|
||||
const stage = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
if (!loading) return;
|
||||
const timer = setTimeout(() => setSlow(true), 15000);
|
||||
return () => clearTimeout(timer);
|
||||
}, [loading, reload]);
|
||||
const start = () => {
|
||||
setJoined({ name: nick.trim() || "游民", audio, video });
|
||||
setLoading(true);
|
||||
setSlow(false);
|
||||
};
|
||||
const leave = () => {
|
||||
setJoined(null);
|
||||
setLoading(false);
|
||||
setSlow(false);
|
||||
};
|
||||
if (!meetup)
|
||||
return (
|
||||
<SiteShell title="活动空间">
|
||||
<EmptyState
|
||||
title="没有找到这场活动"
|
||||
description="回到活动广场,看看其他相遇的可能。"
|
||||
>
|
||||
<Link className="social-btn primary" href={socialPath("/meetup")}>
|
||||
返回活动广场
|
||||
</Link>
|
||||
</EmptyState>
|
||||
</SiteShell>
|
||||
);
|
||||
const href = videoUrl(
|
||||
meetup.mirotalkRoom,
|
||||
joined || { name: nick.trim() || "游民", audio, video },
|
||||
);
|
||||
return (
|
||||
<SiteShell title="活动空间">
|
||||
<div className="social-room-heading">
|
||||
<Link href={socialPath("/meetup")}>
|
||||
<ArrowLeft size={14} />
|
||||
所有活动
|
||||
</Link>
|
||||
<ShareButton
|
||||
path={`/social/meetup/${meetup.id}`}
|
||||
title={meetup.title}
|
||||
/>
|
||||
</div>
|
||||
<header className="social-meetup-heading">
|
||||
<span className="social-page-kicker">
|
||||
<Radio size={13} />
|
||||
MEETUP SPACE
|
||||
</span>
|
||||
<h1>{meetup.title}</h1>
|
||||
<p>
|
||||
{meetup.date} · {meetup.time} 北京时间 · 活动预览
|
||||
</p>
|
||||
</header>
|
||||
<div className="social-live-toolbar">
|
||||
<div className="social-filters" aria-label="活动布局">
|
||||
{[
|
||||
{ key: "split" as const, label: "分屏", icon: Columns2 },
|
||||
{ key: "video" as const, label: "视频", icon: Video },
|
||||
{ key: "chat" as const, label: "聊天", icon: MessageCircle },
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
className={layout === item.key ? "active" : ""}
|
||||
aria-pressed={layout === item.key}
|
||||
onClick={() => setLayout(item.key)}
|
||||
>
|
||||
<item.icon size={14} />
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="social-save"
|
||||
onClick={async () => {
|
||||
try {
|
||||
if (document.fullscreenElement) await document.exitFullscreen();
|
||||
else await stage.current?.requestFullscreen();
|
||||
} catch {
|
||||
setFullscreenError("当前浏览器不支持全屏,可切换到视频布局。");
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Maximize2 size={14} />
|
||||
全屏空间
|
||||
</button>
|
||||
</div>
|
||||
{fullscreenError && (
|
||||
<p className="social-status" role="status">
|
||||
{fullscreenError}
|
||||
</p>
|
||||
)}
|
||||
<div ref={stage} className={`social-meetup-room layout-${layout}`}>
|
||||
<section
|
||||
className="social-meetup-video"
|
||||
hidden={layout === "chat"}
|
||||
aria-label="活动视频区"
|
||||
>
|
||||
{!joined ? (
|
||||
<div className="social-prejoin">
|
||||
<div className="social-prejoin-radar" aria-hidden="true">
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<Video size={34} strokeWidth={1.2} />
|
||||
</div>
|
||||
<span className="social-page-kicker">READY WHEN YOU ARE</span>
|
||||
<h2>准备好了,再打开自己。</h2>
|
||||
<p>
|
||||
先在右侧打个招呼。进入视频前,可以选择是否开启麦克风和摄像头。
|
||||
</p>
|
||||
<label>
|
||||
大家怎么称呼你?
|
||||
<input
|
||||
aria-label="活动昵称"
|
||||
maxLength={24}
|
||||
value={nick}
|
||||
onChange={(event) => setNick(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<div className="social-prejoin-devices">
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={audio}
|
||||
onClick={() => setAudio(!audio)}
|
||||
>
|
||||
{audio ? <Mic size={20} /> : <MicOff size={20} />}麦克风
|
||||
{audio ? "开" : "关"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={video}
|
||||
onClick={() => setVideo(!video)}
|
||||
>
|
||||
{video ? <Camera size={20} /> : <CameraOff size={20} />}摄像头
|
||||
{video ? "开" : "关"}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn primary"
|
||||
onClick={start}
|
||||
>
|
||||
进入视频房间 <ArrowUpRight size={15} />
|
||||
</button>
|
||||
<p className="social-prejoin-note">
|
||||
视频由 MiroTalk 提供 · 进入后按浏览器提示授权
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="social-video-frame">
|
||||
{loading && (
|
||||
<div className="social-video-loading" role="status">
|
||||
<span className="social-loading-orbit" />
|
||||
正在连接视频空间…
|
||||
{slow && (
|
||||
<p>连接需要一点时间,可以先用文字聊天或在新窗口打开。</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<iframe
|
||||
key={reload}
|
||||
src={href}
|
||||
title={`${meetup.title} 视频房间`}
|
||||
allow="camera; microphone; fullscreen; display-capture; autoplay"
|
||||
allowFullScreen
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
onLoad={() => setLoading(false)}
|
||||
/>
|
||||
<div className="social-video-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="social-save"
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
setSlow(false);
|
||||
setReload((value) => value + 1);
|
||||
}}
|
||||
>
|
||||
<RefreshCw size={13} />
|
||||
重新连接
|
||||
</button>
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="social-save"
|
||||
>
|
||||
<ExternalLink size={13} />
|
||||
新窗口
|
||||
</a>
|
||||
<button type="button" className="social-save" onClick={leave}>
|
||||
离开视频
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
<div className="social-meetup-chat" hidden={layout === "video"}>
|
||||
<Conversation channelId={meetup.channelId} compact />
|
||||
</div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
/** Legacy alias — full-screen live room lives in MeetupLiveClient. */
|
||||
export { default } from "./MeetupLiveClient";
|
||||
|
||||
@ -3,30 +3,28 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { ArrowUpRight, MapPin, MessageCircle, Sparkles } from "lucide-react";
|
||||
import { Sparkles } from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import SocialAvatar from "./SocialAvatar";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
PageIntro,
|
||||
SearchField,
|
||||
ShareButton,
|
||||
SocialDialog,
|
||||
} from "./SocialUI";
|
||||
import { MOCK_ROSTER, type SocialRosterMember } from "@social/lib/rosterMock";
|
||||
import { SELF_MEMBER_ID, useDiscoveryRoster } from "@social/lib/discoveryRoster";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
|
||||
export default function PeopleClient() {
|
||||
const params = useSearchParams();
|
||||
const roster = useDiscoveryRoster();
|
||||
const [query, setQuery] = useState(params.get("city") || "");
|
||||
const [filter, setFilter] = useState("all");
|
||||
const [active, setActive] = useState<SocialRosterMember | null>(null);
|
||||
const [saved] = useLocalState<string[]>("saved-people", []);
|
||||
const list = useMemo(
|
||||
() =>
|
||||
MOCK_ROSTER.filter((person) => {
|
||||
roster.filter((person) => {
|
||||
const haystack =
|
||||
`${person.name} ${person.city} ${person.title} ${person.tags.join(" ")} ${person.lookingFor}`.toLowerCase();
|
||||
return (
|
||||
@ -35,28 +33,29 @@ export default function PeopleClient() {
|
||||
(filter !== "online" || person.online)
|
||||
);
|
||||
}),
|
||||
[query, filter, saved],
|
||||
[query, filter, saved, roster],
|
||||
);
|
||||
return (
|
||||
<SiteShell title="发现同类">
|
||||
<PageIntro
|
||||
eyebrow="PEOPLE WITHOUT BORDERS"
|
||||
title="你的下一位朋友,"
|
||||
accent="可能就在下一座城。"
|
||||
description="按城市、技能或兴趣发现同类。先看看彼此的热爱,再让一句你好有一个自然的开始。"
|
||||
/>
|
||||
<div className="social-toolbar">
|
||||
<SiteShell title="想见的人">
|
||||
<PageIntro title="想见的人" accent="认识新朋友">
|
||||
<div className="social-actions">
|
||||
<DemoBadge>
|
||||
{list.length} 位 · 示例介绍,方便先逛逛
|
||||
</DemoBadge>
|
||||
</div>
|
||||
</PageIntro>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label="搜索游民"
|
||||
placeholder="城市、名字、技能、兴趣…"
|
||||
label="搜索"
|
||||
placeholder="城市 / 名字 / 兴趣"
|
||||
/>
|
||||
<div className="social-filters" aria-label="成员筛选">
|
||||
<div className="social-filters" aria-label="筛选">
|
||||
{[
|
||||
{ id: "all", title: "所有游民" },
|
||||
{ id: "online", title: "演示在线" },
|
||||
{ id: "saved", title: "我收藏的人" },
|
||||
{ id: "all", title: "全部" },
|
||||
{ id: "online", title: "现在在线" },
|
||||
{ id: "saved", title: "我关注的" },
|
||||
].map((f) => (
|
||||
<button
|
||||
key={f.id}
|
||||
@ -69,50 +68,40 @@ export default function PeopleClient() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
相遇,不必靠运气{" "}
|
||||
<span>{list.length} 位成员展示 · 演示资料与在线状态</span>
|
||||
</div>
|
||||
<div className="social-member-grid">
|
||||
{list.map((person) => (
|
||||
<article key={person.id} className="social-member-card">
|
||||
<div className="social-member-head">
|
||||
<SocialAvatar src={person.avatar} size={51} lazy />
|
||||
<div>
|
||||
<h2>{person.name}</h2>
|
||||
<p>{person.title}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-member-city">
|
||||
<MapPin size={13} />
|
||||
{person.city}
|
||||
</div>
|
||||
<p>{person.lookingFor}</p>
|
||||
<div className="social-tags">
|
||||
{person.tags.map((tag) => (
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
<div className="social-card-actions">
|
||||
<BookmarkButton
|
||||
id={person.id}
|
||||
collection="saved-people"
|
||||
label="想认识"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="social-save"
|
||||
onClick={() => setActive(person)}
|
||||
>
|
||||
查看名片 <ArrowUpRight size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
<div className="social-people-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 />
|
||||
{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
|
||||
title="同频的人,值得再找找"
|
||||
description="试试「设计」「清迈」「出海」,或者清空筛选看看其他成员。"
|
||||
emoji="🌊"
|
||||
title="暂时没找到"
|
||||
description="换个城市或兴趣关键词试试,也可以清空筛选再看。"
|
||||
>
|
||||
<button
|
||||
className="social-btn"
|
||||
@ -121,74 +110,25 @@ export default function PeopleClient() {
|
||||
setFilter("all");
|
||||
}}
|
||||
>
|
||||
重置筛选
|
||||
重新看看
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
<section className="social-panel social-discover-cta">
|
||||
<Sparkles size={24} />
|
||||
<div>
|
||||
<h2>让别人也能认识你。</h2>
|
||||
<p className="social-muted">
|
||||
用一张游民名片,介绍你的城市、技能与好奇心。
|
||||
</p>
|
||||
</div>
|
||||
<Link className="social-btn primary" href={socialPath("/roster")}>
|
||||
创建我的名片 <ArrowUpRight size={15} />
|
||||
<div className="social-toolbar social-people-cta-bar">
|
||||
<Link className="social-btn coral" href={socialPath("/date")}>
|
||||
去左右滑认识
|
||||
</Link>
|
||||
</section>
|
||||
{active && (
|
||||
<SocialDialog
|
||||
title={`${active.name} 的游民名片`}
|
||||
onClose={() => setActive(null)}
|
||||
>
|
||||
<div className="social-member-profile">
|
||||
<SocialAvatar src={active.avatar} size={74} />
|
||||
<div>
|
||||
<strong>{active.name}</strong>
|
||||
<p>{active.title}</p>
|
||||
<span className="social-member-city">
|
||||
<MapPin size={12} />
|
||||
{active.city}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-tags">
|
||||
{active.tags.map((tag) => (
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
<p>{active.bio}</p>
|
||||
<p>
|
||||
<strong>想认识:</strong>
|
||||
{active.lookingFor}
|
||||
</p>
|
||||
<div className="social-status">
|
||||
这是演示成员资料。可以带着一个破冰话题进入公开频道,认识真正参与聊天的人。
|
||||
</div>
|
||||
<div className="social-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(
|
||||
`/chat/general?intro=${encodeURIComponent(`大家好,我对${active.tags[0]}很感兴趣,有同样兴趣的朋友吗?`)}`,
|
||||
)}
|
||||
>
|
||||
<MessageCircle size={15} />
|
||||
去公开频道聊聊
|
||||
</Link>
|
||||
<BookmarkButton
|
||||
id={active.id}
|
||||
collection="saved-people"
|
||||
label="想认识"
|
||||
/>
|
||||
<ShareButton
|
||||
path={`/social/people?city=${encodeURIComponent(active.city.split("·")[0].trim())}`}
|
||||
title={`在 ${active.city} 发现同类`}
|
||||
/>
|
||||
</div>
|
||||
</SocialDialog>
|
||||
)}
|
||||
<Link className="social-btn primary" href={socialPath("/roster")}>
|
||||
<Sparkles size={15} /> 写写我的介绍
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/chat")}>
|
||||
去大家聊天
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/meetup")}>
|
||||
去开视频
|
||||
</Link>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
266
src/modules/social/components/PeopleProfileClient.tsx
Normal file
266
src/modules/social/components/PeopleProfileClient.tsx
Normal file
@ -0,0 +1,266 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useSyncExternalStore } from "react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Heart,
|
||||
MapPin,
|
||||
MessageCircle,
|
||||
Sparkles,
|
||||
Video,
|
||||
} from "lucide-react";
|
||||
import SiteShell from "./SiteShell";
|
||||
import SocialAvatar from "./SocialAvatar";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
ShareButton,
|
||||
} from "./SocialUI";
|
||||
import {
|
||||
findRosterMember,
|
||||
type SocialRosterMember,
|
||||
} from "@social/lib/rosterMock";
|
||||
import {
|
||||
SELF_MEMBER_ID,
|
||||
useDiscoveryRoster,
|
||||
} from "@social/lib/discoveryRoster";
|
||||
import { loadJson, saveJson } from "@social/lib/storage";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
const LIKE_KEY = "social-roster-likes";
|
||||
const LIKES_CHANGED = "social-roster-likes-changed";
|
||||
|
||||
function subscribeLikes(cb: () => void) {
|
||||
window.addEventListener("storage", cb);
|
||||
window.addEventListener(LIKES_CHANGED, cb);
|
||||
return () => {
|
||||
window.removeEventListener("storage", cb);
|
||||
window.removeEventListener(LIKES_CHANGED, cb);
|
||||
};
|
||||
}
|
||||
|
||||
function getLikesSnapshot() {
|
||||
const stored = loadJson<unknown>(LIKE_KEY, {});
|
||||
return JSON.stringify(
|
||||
stored && typeof stored === "object" && !Array.isArray(stored)
|
||||
? stored
|
||||
: {},
|
||||
);
|
||||
}
|
||||
|
||||
export default function PeopleProfileClient({ id }: { id: string }) {
|
||||
const roster = useDiscoveryRoster();
|
||||
const member =
|
||||
roster.find((m) => m.id === id) || findRosterMember(id);
|
||||
|
||||
const likesSnapshot = useSyncExternalStore(
|
||||
subscribeLikes,
|
||||
getLikesSnapshot,
|
||||
() => "{}",
|
||||
);
|
||||
const likes = useMemo(
|
||||
() => JSON.parse(likesSnapshot) as Record<string, boolean>,
|
||||
[likesSnapshot],
|
||||
);
|
||||
|
||||
if (!member) {
|
||||
return (
|
||||
<SiteShell title="未找到">
|
||||
<EmptyState
|
||||
emoji="🧭"
|
||||
title="没有这位游民"
|
||||
description="这位朋友可能已离开,或者链接有点旧。回去再看看其他人吧。"
|
||||
>
|
||||
<Link className="social-btn primary" href={socialPath("/people")}>
|
||||
回去看看大家
|
||||
</Link>
|
||||
</EmptyState>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
const liked = !!likes[member.id];
|
||||
const cityKey = member.city.split(/[·/]/)[0].trim();
|
||||
const similar = roster
|
||||
.filter(
|
||||
(m) =>
|
||||
m.id !== member.id && m.city.includes(cityKey.slice(0, 2)),
|
||||
)
|
||||
.slice(0, 4);
|
||||
|
||||
const toggleLike = () => {
|
||||
saveJson(LIKE_KEY, { ...likes, [member.id]: !liked });
|
||||
window.dispatchEvent(new Event(LIKES_CHANGED));
|
||||
};
|
||||
|
||||
const intro = encodeURIComponent(
|
||||
`嗨 ${member.name}!看到你在做${member.tags[0] || "远程"},想认识一下。`,
|
||||
);
|
||||
|
||||
return (
|
||||
<SiteShell title={member.name}>
|
||||
<article className="social-profile reveal">
|
||||
<div className="social-profile-nav">
|
||||
<Link href={socialPath("/people")} className="social-btn">
|
||||
<ArrowLeft size={15} /> 回去看看大家
|
||||
</Link>
|
||||
<DemoBadge>示例介绍 · 方便先逛逛</DemoBadge>
|
||||
</div>
|
||||
|
||||
<header className="social-profile-hero">
|
||||
<div
|
||||
className="social-profile-cover"
|
||||
style={
|
||||
member.gallery?.[0]
|
||||
? {
|
||||
backgroundImage: `linear-gradient(180deg, transparent 20%, #0c0c0fcc 92%), url(${member.gallery[0]})`,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
aria-hidden
|
||||
/>
|
||||
<div className="social-profile-identity">
|
||||
<SocialAvatar src={member.avatar} size={96} />
|
||||
<div>
|
||||
<p className="social-profile-kicker">
|
||||
{member.online ? (
|
||||
<span className="is-online">在线</span>
|
||||
) : (
|
||||
<span>离线</span>
|
||||
)}
|
||||
<span>{member.vibe}</span>
|
||||
{member.id === SELF_MEMBER_ID ? <span>这是我</span> : null}
|
||||
</p>
|
||||
<h1>{member.name}</h1>
|
||||
<p className="social-profile-title">{member.title}</p>
|
||||
<p className="social-profile-city">
|
||||
<MapPin size={14} aria-hidden />
|
||||
{member.city}
|
||||
{member.timezone ? ` · ${member.timezone}` : ""}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="social-profile-actions">
|
||||
<button
|
||||
type="button"
|
||||
className={`social-btn${liked ? " coral" : ""}`}
|
||||
onClick={toggleLike}
|
||||
>
|
||||
<Heart size={15} fill={liked ? "currentColor" : "none"} />
|
||||
{liked ? "已关注" : "关注一下"}
|
||||
</button>
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(`/chat?intro=${intro}`)}
|
||||
>
|
||||
<MessageCircle size={15} />
|
||||
去打招呼
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/meetup")}>
|
||||
<Video size={15} />
|
||||
去开视频
|
||||
</Link>
|
||||
<BookmarkButton
|
||||
id={member.id}
|
||||
collection="saved-people"
|
||||
label="想认识"
|
||||
/>
|
||||
<ShareButton
|
||||
path={`/social/people/${member.id}`}
|
||||
title={`${member.name} · nomadro 游民社区`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="social-profile-grid">
|
||||
<section className="social-profile-card">
|
||||
<h2>关于 TA</h2>
|
||||
<p>{member.bio}</p>
|
||||
<p className="social-profile-looking">
|
||||
<Sparkles size={14} aria-hidden />
|
||||
<strong>想认识:</strong>
|
||||
{member.lookingFor}
|
||||
</p>
|
||||
{member.availability ? (
|
||||
<p className="social-muted">什么时候方便 · {member.availability}</p>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
<section className="social-profile-card">
|
||||
<h2>兴趣标签</h2>
|
||||
<div className="social-tags">
|
||||
{member.tags.map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
</div>
|
||||
{member.languages?.length ? (
|
||||
<>
|
||||
<h2>语言</h2>
|
||||
<div className="social-tags is-soft">
|
||||
{member.languages.map((l) => (
|
||||
<span key={l}>{l}</span>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{member.gallery && member.gallery.length > 0 ? (
|
||||
<section className="social-profile-gallery">
|
||||
<h2>生活瞬间</h2>
|
||||
<div className="social-profile-gallery-grid">
|
||||
{member.gallery.map((src) => (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img key={src} src={src} alt="" loading="lazy" />
|
||||
))}
|
||||
<div className="social-profile-gallery-ava">
|
||||
<SocialAvatar src={member.avatar} size={120} />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{similar.length > 0 ? (
|
||||
<section className="social-profile-similar">
|
||||
<h2>附近可能同城的人</h2>
|
||||
<div className="social-people-grid social-profile-similar-grid">
|
||||
{similar.map((m) => (
|
||||
<PersonMini key={m.id} m={m} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<div className="social-profile-footer-cta">
|
||||
<Link className="social-btn coral" href={socialPath("/date")}>
|
||||
去左右滑认识更多人
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/roster")}>
|
||||
写写我的介绍
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
|
||||
function PersonMini({ m }: { m: SocialRosterMember }) {
|
||||
return (
|
||||
<Link
|
||||
href={socialPath(`/people/${m.id}`)}
|
||||
className={`social-people-chip social-chip-pop${m.online ? " is-online" : ""}`}
|
||||
>
|
||||
<span className="social-people-chip-ava">
|
||||
<SocialAvatar src={m.avatar} size={52} lazy />
|
||||
{m.online ? <i aria-hidden /> : null}
|
||||
</span>
|
||||
<strong>{m.name}</strong>
|
||||
<span className="connection-member-role">{m.title}</span>
|
||||
<em>{m.city.split("·")[0].trim()}</em>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@ -8,6 +8,11 @@ import { PageIntro } from "./SocialUI";
|
||||
import { socialApi } from "@social/lib/api";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { loadJson } from "@social/lib/storage";
|
||||
import {
|
||||
ROSTER_PUBLISH_KEY,
|
||||
setRosterPublished,
|
||||
} from "@social/lib/discoveryRoster";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import type { SocialRosterProfile } from "@social/lib/types";
|
||||
|
||||
const EMPTY: SocialRosterProfile = {
|
||||
@ -64,6 +69,10 @@ export default function ProfileStudio() {
|
||||
"roster",
|
||||
EMPTY,
|
||||
);
|
||||
const [published, setPublished] = useLocalState<boolean>(
|
||||
ROSTER_PUBLISH_KEY,
|
||||
false,
|
||||
);
|
||||
const [, setNick] = useLocalState("nick", "游民");
|
||||
const [sync, setSync] = useLocalState("roster-sync", "draft");
|
||||
const [status, setStatus] = useState("");
|
||||
@ -129,28 +138,26 @@ export default function ProfileStudio() {
|
||||
try {
|
||||
await socialApi.saveRoster(payload);
|
||||
setSync("synced");
|
||||
setStatus("名片资料已同步。你可以去公开频道做个自我介绍。");
|
||||
setStatus("介绍已保存。你可以去聊天室跟大家打个招呼。");
|
||||
} catch {
|
||||
setSync("draft");
|
||||
setStatus("资料已存本机,尚未同步。联网后再次点击保存即可重试。");
|
||||
setStatus("先留在你这边了。有网后再点一次保存就行。");
|
||||
} finally {
|
||||
lock.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<SiteShell title="我的游民名片">
|
||||
<PageIntro
|
||||
eyebrow="YOU ARE MORE THAN A JOB TITLE"
|
||||
title="给下一次相遇,"
|
||||
accent="一个认识你的理由。"
|
||||
description="一张有温度的名片,从你正在做的事、喜欢的城市和想遇见的人开始。"
|
||||
/>
|
||||
<SiteShell title="我的介绍">
|
||||
<PageIntro title="我的介绍">
|
||||
<Link className="social-btn" href={socialPath("/people")}>
|
||||
看看大家那边
|
||||
</Link>
|
||||
</PageIntro>
|
||||
<div className="social-profile-studio">
|
||||
<section className="social-panel">
|
||||
<section className="social-panel social-panel-fx reveal">
|
||||
<div className="social-section-label">
|
||||
编辑你的名片{" "}
|
||||
<span>{sync === "synced" ? "已同步" : "本机草稿"}</span>
|
||||
<span>{sync === "synced" ? "已保存" : "草稿还在你这边"}</span>
|
||||
</div>
|
||||
<form
|
||||
className="social-form"
|
||||
@ -175,27 +182,46 @@ export default function ProfileStudio() {
|
||||
</label>
|
||||
))}
|
||||
<label className="full">
|
||||
一段有意思的自我介绍
|
||||
自我介绍
|
||||
<textarea
|
||||
rows={4}
|
||||
maxLength={600}
|
||||
value={profile.bio}
|
||||
onChange={(event) => update("bio", event.target.value)}
|
||||
placeholder="最近在研究什么?想找人一起做什么?你会如何介绍现在的生活?"
|
||||
placeholder="在哪、做什么、想认识谁"
|
||||
/>
|
||||
<small>{profile.bio.length}/600</small>
|
||||
</label>
|
||||
</fieldset>
|
||||
<p className="social-muted">
|
||||
联系方式为选填。提交前请确认你愿意将填写的资料交给社区保存。
|
||||
</p>
|
||||
<label className="social-publish-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={Boolean(published)}
|
||||
onChange={(event) => {
|
||||
const next = event.target.checked;
|
||||
setPublished(next);
|
||||
setRosterPublished(next);
|
||||
setStatus(
|
||||
next
|
||||
? "好的,别人在「想见的人」里能看到你(仅当前这台设备的示例列表)。"
|
||||
: "已先藏起来,别人暂时看不到你。",
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<span>出现在「想见的人 / 认识一下」里,让别人看到我</span>
|
||||
</label>
|
||||
{published && complete < 5 ? (
|
||||
<p className="social-status warn" role="status">
|
||||
介绍还差 {5 - complete} 项,补全后再出现会更完整。
|
||||
</p>
|
||||
) : null}
|
||||
<button
|
||||
type="submit"
|
||||
className="social-btn primary"
|
||||
disabled={busy || !profile.name.trim()}
|
||||
>
|
||||
<Check size={15} />
|
||||
{busy ? "正在同步…" : "保存并同步名片"}
|
||||
{busy ? "保存中…" : "保存介绍"}
|
||||
</button>
|
||||
{status && (
|
||||
<p
|
||||
@ -207,9 +233,9 @@ export default function ProfileStudio() {
|
||||
)}
|
||||
</form>
|
||||
</section>
|
||||
<section className="social-profile-preview">
|
||||
<section className="social-profile-preview reveal">
|
||||
<div className="social-section-label">
|
||||
<span>YOUR NEXT CHAPTER</span>
|
||||
<span>预览</span>
|
||||
<Sparkles size={16} />
|
||||
</div>
|
||||
<div className="social-profile-passport">
|
||||
@ -219,12 +245,12 @@ export default function ProfileStudio() {
|
||||
<div className="social-profile-monogram">
|
||||
{profile.name.trim().slice(0, 1) || "N"}
|
||||
</div>
|
||||
<span className="social-page-kicker">NOMAD ID / 本机预览</span>
|
||||
<span className="social-page-kicker">先看看效果</span>
|
||||
<h2>{profile.name.trim() || "你的名字"}</h2>
|
||||
<p>{profile.title || "让你的好奇心被看见"}</p>
|
||||
<p>{profile.title || "你在做什么"}</p>
|
||||
<span className="social-member-city">
|
||||
<MapPin size={13} />
|
||||
{profile.city || "世界很大,正在探索"}
|
||||
{profile.city || "还没写城市"}
|
||||
</span>
|
||||
<div className="social-tags">
|
||||
{profile.skills
|
||||
@ -236,26 +262,36 @@ export default function ProfileStudio() {
|
||||
))}
|
||||
</div>
|
||||
<p className="social-profile-bio">
|
||||
{profile.bio || "写下你的故事,让下一位同频的人有话可说。"}
|
||||
{profile.bio || "还没写自我介绍"}
|
||||
</p>
|
||||
<footer>
|
||||
NO BORDERS. REAL CONNECTIONS.<span>✦</span>
|
||||
我的介绍<span>✦</span>
|
||||
</footer>
|
||||
</div>
|
||||
<div className="social-profile-progress">
|
||||
<div>
|
||||
<span>让别人更了解你</span>
|
||||
<span>写好了多少</span>
|
||||
<strong>{complete}/5</strong>
|
||||
</div>
|
||||
<progress max={5} value={complete} aria-label="名片完成度" />
|
||||
<p>名字、职业、城市、兴趣和自我介绍。</p>
|
||||
<progress max={5} value={complete} aria-label="介绍完成度" />
|
||||
<p>名字 · 做什么 · 城市 · 兴趣 · 介绍</p>
|
||||
</div>
|
||||
<div className="social-actions">
|
||||
<Link
|
||||
className="social-btn primary"
|
||||
href={socialPath(
|
||||
`/chat?intro=${encodeURIComponent(`大家好,我是${profile.name || "新朋友"},目前在${profile.city || "探索中"}。${profile.bio || "很高兴认识大家!"}`)}`,
|
||||
)}
|
||||
>
|
||||
去聊天室打招呼 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/people")}>
|
||||
看发现页
|
||||
</Link>
|
||||
<Link className="social-btn" href={socialPath("/date")}>
|
||||
去约会
|
||||
</Link>
|
||||
</div>
|
||||
<Link
|
||||
className="social-btn"
|
||||
href={`/social/chat/general?intro=${encodeURIComponent(`大家好,我是${profile.name || "新朋友"},目前在${profile.city || "探索下一座城市"}。${profile.bio || "很高兴认识大家!"}`)}`}
|
||||
>
|
||||
带着名片,打个招呼 <ArrowUpRight size={15} />
|
||||
</Link>
|
||||
</section>
|
||||
</div>
|
||||
</SiteShell>
|
||||
|
||||
@ -12,6 +12,7 @@ import {
|
||||
import SiteShell from "./SiteShell";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
PageIntro,
|
||||
SearchField,
|
||||
@ -21,30 +22,13 @@ import {
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import { SEED_EBOOKS, SEED_VIDEOS } from "@social/lib/seed";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
type Kind = "videos" | "date" | "ebook";
|
||||
const COPY = {
|
||||
videos: {
|
||||
eyebrow: "A WINDOW INTO ANOTHER LIFE",
|
||||
title: "世界那么大,",
|
||||
accent: "借一段影像,遇见另一种生活。",
|
||||
description:
|
||||
"城市切片、游民访谈与真实相遇的记录。从一个故事,找到下一次出发的灵感。",
|
||||
},
|
||||
date: {
|
||||
eyebrow: "EVERY NOMAD HAS A STORY",
|
||||
title: "陌生人的日常,",
|
||||
accent: "可能正是你的下一章。",
|
||||
description:
|
||||
"关于工作、迁徙和相遇的故事目录。看看别人的城市,也把你的好奇带进一场对话。",
|
||||
},
|
||||
ebook: {
|
||||
eyebrow: "LESS SCROLLING. MORE DISCOVERY.",
|
||||
title: "给好奇心,",
|
||||
accent: "留一页慢下来的时间。",
|
||||
description:
|
||||
"关于社区、连接和游民生活的小册目录。收藏一个主题,把阅读变成下一场有内容的聊天。",
|
||||
},
|
||||
videos: { title: "共创 · 视频", accent: "大家拍的" },
|
||||
date: { title: "共创 · 访谈", accent: "听听大家" },
|
||||
ebook: { title: "共创 · 小册", accent: "大家写的" },
|
||||
};
|
||||
|
||||
function safeSource(value?: string) {
|
||||
@ -74,7 +58,7 @@ function ResourcePlayer({ source }: { source: string }) {
|
||||
/>
|
||||
{failed && (
|
||||
<p role="status" className="social-status warn">
|
||||
片源暂时无法播放,请稍后重试。
|
||||
视频暂时播不了,过一会儿再试试。
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
@ -92,7 +76,7 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
? SEED_EBOOKS.map((book) => ({
|
||||
...book,
|
||||
summary: book.blurb,
|
||||
city: "社区小册",
|
||||
city: "共创",
|
||||
coverEmoji: "✦",
|
||||
detail: `${book.chapters} 章 · ${book.minutes} 分钟`,
|
||||
}))
|
||||
@ -112,14 +96,32 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
active && safeSource(config.copy.socialVideoSources?.[active.id]);
|
||||
return (
|
||||
<SiteShell
|
||||
title={books ? "灵感书架" : kind === "date" ? "游民故事" : "影像放映室"}
|
||||
title={books ? "共创 · 小册" : kind === "date" ? "共创 · 访谈" : "共创 · 视频"}
|
||||
>
|
||||
<PageIntro {...COPY[kind]} />
|
||||
<div className="social-toolbar">
|
||||
<PageIntro {...COPY[kind]}>
|
||||
<div className="social-actions social-cocreate-switch">
|
||||
<Link
|
||||
className={`social-btn${books ? " primary" : ""}`}
|
||||
href={socialPath("/ebook")}
|
||||
>
|
||||
小册
|
||||
</Link>
|
||||
<Link
|
||||
className={`social-btn${!books && kind === "videos" ? " primary" : ""}`}
|
||||
href={socialPath("/videos")}
|
||||
>
|
||||
视频
|
||||
</Link>
|
||||
<DemoBadge>
|
||||
{books ? "先看看有哪些" : "有的可以看,有的先看封面"}
|
||||
</DemoBadge>
|
||||
</div>
|
||||
</PageIntro>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder={books ? "找一份想读的小册…" : "搜索城市、故事、关键词…"}
|
||||
placeholder={books ? "书名 / 主题" : "城市 / 关键词"}
|
||||
/>
|
||||
<div className="social-filters">
|
||||
<button
|
||||
@ -128,7 +130,7 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
aria-pressed={!savedOnly}
|
||||
onClick={() => setSavedOnly(false)}
|
||||
>
|
||||
全部{books ? "小册" : "故事"}
|
||||
全部
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@ -136,26 +138,19 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
aria-pressed={savedOnly}
|
||||
onClick={() => setSavedOnly(true)}
|
||||
>
|
||||
我的收藏 · {saved.length}
|
||||
收藏 · {saved.length}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
{books ? "把灵感带走" : "遇见别人的世界"}
|
||||
<span>
|
||||
{books
|
||||
? "小册主题预览 · 完整内容以阅读书库为准"
|
||||
: "种子内容目录 · 片源发布后可播放"}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className={`social-grid social-library-grid ${books ? "is-books" : ""}`}
|
||||
>
|
||||
{shown.map((item, index) => (
|
||||
<article
|
||||
id={item.id}
|
||||
className="social-card social-library-card"
|
||||
className="social-card social-library-card social-panel-fx reveal"
|
||||
key={item.id}
|
||||
style={{ ["--stagger" as string]: `${index * 70}ms` }}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
@ -169,10 +164,10 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
</span>
|
||||
{books ? (
|
||||
<div className="social-book-cover">
|
||||
<small>NOMADRO FIELD NOTES</small>
|
||||
<small>共创</small>
|
||||
<BookOpen size={27} strokeWidth={1} />
|
||||
<strong>{item.title}</strong>
|
||||
<span>READ. CONNECT. REPEAT.</span>
|
||||
<span>阅读</span>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@ -187,8 +182,8 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
</span>
|
||||
<small>
|
||||
{safeSource(config.copy.socialVideoSources?.[item.id])
|
||||
? "播放影像"
|
||||
: "目录预览"}
|
||||
? "可以看"
|
||||
: "先看封面"}
|
||||
</small>
|
||||
</>
|
||||
)}
|
||||
@ -205,7 +200,7 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
className="social-btn"
|
||||
onClick={() => setSelected(item.id)}
|
||||
>
|
||||
展开{books ? "小册" : "故事"}
|
||||
打开
|
||||
<ArrowUpRight size={14} />
|
||||
</button>
|
||||
<ShareButton
|
||||
@ -215,46 +210,49 @@ export default function ResourceLibrary({ kind }: { kind: Kind }) {
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
{!shown.length && <EmptyState />}
|
||||
{!shown.length && (
|
||||
<EmptyState title="没有内容" description="换关键词或看全部。">
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setQuery("");
|
||||
setSavedOnly(false);
|
||||
}}
|
||||
>
|
||||
重置筛选
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
{active && (
|
||||
<SocialDialog title={active.title} onClose={() => setSelected(null)}>
|
||||
<div className="social-tags">
|
||||
<span>{active.detail}</span>
|
||||
<span>{books ? "小册目录" : source ? "影像" : "内容预览"}</span>
|
||||
<span>{books ? "共创小册" : source ? "可播放" : "先看封面"}</span>
|
||||
</div>
|
||||
{!books && source && <ResourcePlayer key={source} source={source} />}
|
||||
<p>{active.summary}</p>
|
||||
{!books && !source && (
|
||||
<p className="social-status warn">
|
||||
这是一条内容目录,完整片源尚未发布。你可以先收藏,或围绕这个主题展开聊天。
|
||||
视频还没放出来,可以先收藏,或去聊天室聊聊。
|
||||
</p>
|
||||
)}
|
||||
{books && (
|
||||
<p>
|
||||
这里展示小册主题简介。点击下方入口浏览完整阅读书库,实际可读书目以书库内展示为准。
|
||||
</p>
|
||||
)}
|
||||
<div className="social-library-prompt">
|
||||
<span>聊聊这个话题</span>
|
||||
<strong>
|
||||
{books
|
||||
? "刚到一座新城市,你通常怎么认识新朋友?"
|
||||
: `如果下一站是${active.city},你最想和当地游民聊什么?`}
|
||||
</strong>
|
||||
</div>
|
||||
{books && <p>先看看简介;想读全文可以去书库。</p>}
|
||||
<div className="social-actions">
|
||||
{books && (
|
||||
<Link className="social-btn primary" href="/book">
|
||||
浏览阅读书库 <BookOpen size={15} />
|
||||
打开书库 <BookOpen size={15} />
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
className={`social-btn${books ? "" : " primary"}`}
|
||||
href={`/social/chat/general?intro=${encodeURIComponent(`看到「${active.title}」这个主题,想和大家聊聊:${books ? "你在新城市是怎样认识新朋友的?" : `在${active.city}生活最吸引你的是什么?`}`)}`}
|
||||
href={socialPath(
|
||||
`/chat?intro=${encodeURIComponent(`看到「${active.title}」,想聊聊。`)}`,
|
||||
)}
|
||||
>
|
||||
<MessageCircle size={15} />
|
||||
带着话题去聊天
|
||||
去聊天室聊聊
|
||||
</Link>
|
||||
<BookmarkButton id={active.id} collection={`saved-${kind}`} />
|
||||
</div>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, useState, type FormEvent } from "react";
|
||||
import { useMemo, useRef, useState, type FormEvent } from "react";
|
||||
import {
|
||||
ArrowUpRight,
|
||||
BriefcaseBusiness,
|
||||
@ -11,14 +11,17 @@ import {
|
||||
import SiteShell from "./SiteShell";
|
||||
import {
|
||||
BookmarkButton,
|
||||
DemoBadge,
|
||||
EmptyState,
|
||||
PageIntro,
|
||||
SearchField,
|
||||
SocialDialog,
|
||||
} from "./SocialUI";
|
||||
import { SEED_GIGS, TEAM_KIND_LABEL } from "@social/lib/seed";
|
||||
import { TEAM_KIND_LABEL } from "@social/lib/seed";
|
||||
import { socialApi } from "@social/lib/api";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { resolveSocialCatalog } from "@social/lib/resolveCatalog";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import type { SocialGig, SocialTeamKind } from "@social/lib/types";
|
||||
|
||||
function ApplicationForm({ gig }: { gig: SocialGig }) {
|
||||
@ -71,7 +74,16 @@ function ApplicationForm({ gig }: { gig: SocialGig }) {
|
||||
<div className="social-tags">
|
||||
<span>{TEAM_KIND_LABEL[gig.kind || "parttime"]}</span>
|
||||
<span>{gig.pay}</span>
|
||||
<span>{gig.remote ? "线上也能做" : "可以见面做"}</span>
|
||||
</div>
|
||||
<p className="social-role-brief">{gig.role}</p>
|
||||
{gig.tags.length ? (
|
||||
<div className="social-tags">
|
||||
{gig.tags.map((tag) => (
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
<p>介绍一下你想参与的原因,附上作品或经验,让对方更容易了解你。</p>
|
||||
<form className="social-form" onSubmit={(event) => void submit(event)}>
|
||||
<fieldset disabled={busy} className="social-fieldset">
|
||||
@ -105,20 +117,39 @@ function ApplicationForm({ gig }: { gig: SocialGig }) {
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<button
|
||||
type="submit"
|
||||
className="social-btn primary"
|
||||
disabled={busy || delivery === "sent"}
|
||||
>
|
||||
<Send size={14} />
|
||||
{busy
|
||||
? "提交中…"
|
||||
: delivery === "sent"
|
||||
? "已提交"
|
||||
: delivery === "local"
|
||||
? "重试提交"
|
||||
: "发送参与申请"}
|
||||
</button>
|
||||
<div className="social-actions">
|
||||
<button
|
||||
type="submit"
|
||||
className="social-btn primary"
|
||||
disabled={
|
||||
busy ||
|
||||
delivery === "sent" ||
|
||||
!draft.name.trim() ||
|
||||
!draft.contact.trim()
|
||||
}
|
||||
>
|
||||
<Send size={14} />
|
||||
{busy
|
||||
? "提交中…"
|
||||
: delivery === "sent"
|
||||
? "已提交"
|
||||
: delivery === "local"
|
||||
? "重试提交"
|
||||
: "发送参与申请"}
|
||||
</button>
|
||||
{delivery === "sent" ? (
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setDelivery("draft");
|
||||
setStatus("可以再投一份,请确认信息后提交。");
|
||||
}}
|
||||
>
|
||||
再投一份
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
{status && (
|
||||
<p
|
||||
role="status"
|
||||
@ -128,7 +159,7 @@ function ApplicationForm({ gig }: { gig: SocialGig }) {
|
||||
</p>
|
||||
)}
|
||||
<small className="social-muted">
|
||||
草稿仅保存在本机。提交不代表录用或确认合作。
|
||||
草稿会先留在你这边。提交只是表达兴趣,不代表已经被录用。
|
||||
</small>
|
||||
</form>
|
||||
</>
|
||||
@ -140,12 +171,17 @@ export default function RoleBoard({
|
||||
}: {
|
||||
initialKind?: SocialTeamKind | "all";
|
||||
}) {
|
||||
const config = useSocialConfig();
|
||||
const catalog = useMemo(
|
||||
() => resolveSocialCatalog(config.copy.socialCatalogs),
|
||||
[config.copy.socialCatalogs],
|
||||
);
|
||||
const [kind, setKind] = useState<string>(initialKind);
|
||||
const [query, setQuery] = useState("");
|
||||
const [savedOnly, setSavedOnly] = useState(false);
|
||||
const [saved] = useLocalState<string[]>("saved-roles", []);
|
||||
const [active, setActive] = useState<SocialGig | null>(null);
|
||||
const roles = SEED_GIGS.filter(
|
||||
const roles = catalog.gigs.filter(
|
||||
(gig) =>
|
||||
(kind === "all" || gig.kind === kind) &&
|
||||
(!savedOnly || saved.includes(gig.id)) &&
|
||||
@ -154,18 +190,20 @@ export default function RoleBoard({
|
||||
.includes(query.toLowerCase()),
|
||||
);
|
||||
return (
|
||||
<SiteShell title="远程组队">
|
||||
<PageIntro
|
||||
eyebrow="BUILD SOMETHING. TOGETHER."
|
||||
title="不只擦肩而过,"
|
||||
accent="一起做点有意思的事。"
|
||||
description="把技能变成连接。寻找远程合作、参与一次活动,或加入一个值得投入的团队。"
|
||||
/>
|
||||
<div className="social-toolbar">
|
||||
<SiteShell title="一起做事">
|
||||
<PageIntro title="一起,做点事" accent="找搭子">
|
||||
<div className="social-actions">
|
||||
<DemoBadge>
|
||||
{catalog.source === "remote" ? "最新机会" : "先看看这些机会"}
|
||||
</DemoBadge>
|
||||
<span className="social-muted">{roles.length} 个机会</span>
|
||||
</div>
|
||||
</PageIntro>
|
||||
<div className="social-toolbar reveal">
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder="搜索角色、技能、兴趣…"
|
||||
placeholder="角色 / 技能"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
@ -173,11 +211,11 @@ export default function RoleBoard({
|
||||
aria-pressed={savedOnly}
|
||||
onClick={() => setSavedOnly(!savedOnly)}
|
||||
>
|
||||
我的收藏 · {saved.length}
|
||||
收藏 · {saved.length}
|
||||
</button>
|
||||
</div>
|
||||
<div className="social-filters">
|
||||
{[["all", "全部机会"], ...Object.entries(TEAM_KIND_LABEL)].map(
|
||||
<div className="social-filters reveal">
|
||||
{[["all", "全部"], ...Object.entries(TEAM_KIND_LABEL)].map(
|
||||
([id, label]) => (
|
||||
<button
|
||||
key={id}
|
||||
@ -191,13 +229,23 @@ export default function RoleBoard({
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div className="social-section-label">
|
||||
找到你的下一位队友{" "}
|
||||
<span>{roles.length} 个目录机会 · 开放情况请以沟通确认为准</span>
|
||||
</div>
|
||||
<div className="social-grid social-role-grid">
|
||||
{roles.map((gig, index) => (
|
||||
<article className="social-card social-role-card" key={gig.id}>
|
||||
<article
|
||||
className="social-card social-role-card social-panel-fx reveal"
|
||||
key={gig.id}
|
||||
style={{ ["--stagger" as string]: `${index * 70}ms` }}
|
||||
>
|
||||
<div className="social-role-art" aria-hidden="true">
|
||||
<span>{String(index + 1).padStart(2, "0")}</span>
|
||||
<i />
|
||||
<i />
|
||||
{gig.kind === "volunteer" ? (
|
||||
<HeartHandshake size={28} strokeWidth={1.2} />
|
||||
) : (
|
||||
<BriefcaseBusiness size={28} strokeWidth={1.2} />
|
||||
)}
|
||||
</div>
|
||||
<div className="social-card-top">
|
||||
<div className={`social-role-symbol tone-${index % 3}`}>
|
||||
{gig.kind === "volunteer" ? (
|
||||
@ -216,7 +264,7 @@ export default function RoleBoard({
|
||||
<div className="social-role-meta">
|
||||
<span>
|
||||
<Globe2 size={13} />
|
||||
{gig.remote ? "可以远程" : "线下 / 混合"}
|
||||
{gig.remote ? "线上也能做" : "可以见面做"}
|
||||
</span>
|
||||
<span>{gig.pay}</span>
|
||||
</div>
|
||||
@ -234,7 +282,24 @@ export default function RoleBoard({
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
{!roles.length && <EmptyState />}
|
||||
{!roles.length && (
|
||||
<EmptyState
|
||||
title="暂时没有合适的机会"
|
||||
description="换个词试试,或者看看全部。"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="social-btn"
|
||||
onClick={() => {
|
||||
setQuery("");
|
||||
setKind("all");
|
||||
setSavedOnly(false);
|
||||
}}
|
||||
>
|
||||
重新看看
|
||||
</button>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
{active && (
|
||||
<SocialDialog title={active.title} onClose={() => setActive(null)}>
|
||||
|
||||
@ -13,7 +13,10 @@ import {
|
||||
} from "react";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
import { applySocialSkin, SOCIAL_SKIN_DEFAULT } from "@social/lib/skin";
|
||||
import { SocialMobileDock, SocialFooter } from "./SocialNavigation";
|
||||
import { useRevealMotion } from "@social/lib/useRevealMotion";
|
||||
import { SocialMobileDock } from "./SocialNavigation";
|
||||
import SocialQuickRail from "./SocialQuickRail";
|
||||
import SocialBrandLogo from "./SocialBrandLogo";
|
||||
|
||||
function readTheme(): "light" | "dark" {
|
||||
try {
|
||||
@ -40,31 +43,29 @@ const serverTheme = () => "dark" as const;
|
||||
const GROUPS = [
|
||||
{
|
||||
id: "online",
|
||||
label: "线上",
|
||||
label: "认识人",
|
||||
items: [
|
||||
{ href: "/people", label: "发现同类" },
|
||||
{ href: "/chat", label: "聊天室" },
|
||||
{ href: "/meetup", label: "Meetup" },
|
||||
{ href: "/people", label: "想见的人" },
|
||||
{ href: "/meetup", label: "开视频聊聊" },
|
||||
{ href: "/chat", label: "大家聊天" },
|
||||
{ href: "/date", label: "认识一下" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "offline",
|
||||
label: "线下",
|
||||
label: "见一面",
|
||||
items: [
|
||||
{ href: "/coffeechat", label: "Coffeechat" },
|
||||
{ href: "/date", label: "访谈" },
|
||||
{ href: "/roster", label: "花名册" },
|
||||
{ href: "/coffeechat", label: "找城市见面" },
|
||||
{ href: "/roster", label: "我的介绍" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "grow",
|
||||
label: "成长",
|
||||
id: "together",
|
||||
label: "一起做事",
|
||||
items: [
|
||||
{ href: "/team", label: "远程团队" },
|
||||
{ href: "/vip", label: "VIP" },
|
||||
{ href: "/ebook", label: "小册" },
|
||||
{ href: "/videos", label: "视频" },
|
||||
{ href: "/feedback", label: "反馈" },
|
||||
{ href: "/team", label: "找搭子做事" },
|
||||
{ href: "/ebook", label: "共创" },
|
||||
{ href: "/feedback", label: "说说想法" },
|
||||
],
|
||||
},
|
||||
];
|
||||
@ -93,6 +94,11 @@ export default function SiteShell({
|
||||
applySocialSkin(SOCIAL_SKIN_DEFAULT);
|
||||
}, []);
|
||||
|
||||
useRevealMotion(home ? ".social-home" : ".social-workspace", [
|
||||
home,
|
||||
pathname,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
document.documentElement.classList.toggle("light", theme === "light");
|
||||
@ -163,21 +169,21 @@ export default function SiteShell({
|
||||
const joinBtn = onJoin ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm"
|
||||
className="social-btn coral social-nav-join"
|
||||
onClick={() => {
|
||||
closeMenus();
|
||||
onJoin();
|
||||
}}
|
||||
>
|
||||
加群
|
||||
加入社区
|
||||
</button>
|
||||
) : (
|
||||
<Link
|
||||
href={socialPath("/join")}
|
||||
className="btn btn-primary btn-sm"
|
||||
className="social-btn coral social-nav-join"
|
||||
onClick={closeMenus}
|
||||
>
|
||||
加群
|
||||
加入社区
|
||||
</Link>
|
||||
);
|
||||
|
||||
@ -188,10 +194,7 @@ export default function SiteShell({
|
||||
aria-label="游民社区"
|
||||
>
|
||||
<div className="nav-container">
|
||||
<Link href={socialPath("/")} className="nav-logo" onClick={closeMenus}>
|
||||
<span className="logo-icon">◈</span>
|
||||
<span className="logo-text">游民社区</span>
|
||||
</Link>
|
||||
<SocialBrandLogo onClick={closeMenus} />
|
||||
|
||||
<div id={menuId} className={`nav-links${menuOpen ? " open" : ""}`}>
|
||||
{GROUPS.map((g) => (
|
||||
@ -307,20 +310,15 @@ export default function SiteShell({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="social-flow social-root social-workspace">
|
||||
<div className="social-flow social-root social-workspace social-workspace-dense">
|
||||
<a className="connection-skip-link" href="#social-main">
|
||||
跳到主要内容
|
||||
</a>
|
||||
{nav}
|
||||
<div className="social-workspace-grid">
|
||||
<main className="social-main" id="social-main">
|
||||
<div className="social-breadcrumb">
|
||||
<Link href={socialPath("/")}>nomadro</Link>
|
||||
<span>/</span>
|
||||
<span>{title || "社区"}</span>
|
||||
</div>
|
||||
<main className="social-main" id="social-main" data-page={title || "社区"}>
|
||||
<SocialQuickRail />
|
||||
{children}
|
||||
<SocialFooter />
|
||||
</main>
|
||||
</div>
|
||||
<SocialMobileDock />
|
||||
|
||||
74
src/modules/social/components/SocialBrandLogo.tsx
Normal file
74
src/modules/social/components/SocialBrandLogo.tsx
Normal file
@ -0,0 +1,74 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useId } from "react";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
/** Align with portal topbar mark on nomadro.cn */
|
||||
export function NomadroMark({ className = "" }: { className?: string }) {
|
||||
const gid = useId().replace(/:/g, "");
|
||||
return (
|
||||
<svg
|
||||
className={className}
|
||||
viewBox="0 0 40 40"
|
||||
fill="none"
|
||||
aria-hidden
|
||||
width={28}
|
||||
height={28}
|
||||
>
|
||||
<circle
|
||||
cx="20"
|
||||
cy="20"
|
||||
r="18"
|
||||
stroke={`url(#${gid})`}
|
||||
strokeWidth="2.5"
|
||||
/>
|
||||
<path
|
||||
d="M12 22c4-8 12-8 16 0"
|
||||
stroke={`url(#${gid})`}
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
<circle cx="28" cy="14" r="3" fill={`url(#${gid})`} />
|
||||
<defs>
|
||||
<linearGradient id={gid} x1="0" y1="0" x2="40" y2="40">
|
||||
<stop offset="0%" stopColor="#FF6B6B" />
|
||||
<stop offset="50%" stopColor="#FFE66D" />
|
||||
<stop offset="100%" stopColor="#4ECDC4" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export default function SocialBrandLogo({
|
||||
href = socialPath("/"),
|
||||
section = "游民社区",
|
||||
onClick,
|
||||
}: {
|
||||
href?: string;
|
||||
section?: string;
|
||||
onClick?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<Link
|
||||
href={href}
|
||||
className="nav-logo social-brand-logo"
|
||||
onClick={onClick}
|
||||
aria-label="nomadro 游民社区"
|
||||
>
|
||||
<NomadroMark className="social-brand-mark" />
|
||||
<span className="logo-text">
|
||||
<span className="social-brand-name">nomadro</span>
|
||||
{section ? (
|
||||
<>
|
||||
<span className="social-brand-sep" aria-hidden>
|
||||
·
|
||||
</span>
|
||||
<span className="social-brand-section">{section}</span>
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@ -42,12 +42,12 @@ function Constellation({ active }: { active: boolean }) {
|
||||
canvas.width = width * ratio;
|
||||
canvas.height = height * ratio;
|
||||
context.setTransform(ratio, 0, 0, ratio, 0, 0);
|
||||
points = Array.from({ length: width < 700 ? 48 : 96 }, (_, i) => ({
|
||||
points = Array.from({ length: width < 700 ? 28 : 52 }, (_, i) => ({
|
||||
x: Math.random() * width,
|
||||
y: Math.random() * height,
|
||||
vx: (Math.random() - 0.5) * 0.48,
|
||||
vy: (Math.random() - 0.5) * 0.48,
|
||||
r: 1.2 + Math.random() * 2.1,
|
||||
vx: (Math.random() - 0.5) * 0.28,
|
||||
vy: (Math.random() - 0.5) * 0.28,
|
||||
r: 0.9 + Math.random() * 1.4,
|
||||
color: ["78,205,196", "255,107,107", "255,230,109"][i % 3],
|
||||
}));
|
||||
};
|
||||
@ -62,22 +62,22 @@ function Constellation({ active }: { active: boolean }) {
|
||||
const near = Math.hypot(pointer.x - p.x, pointer.y - p.y) < 240;
|
||||
context.beginPath();
|
||||
context.arc(p.x, p.y, p.r, 0, Math.PI * 2);
|
||||
context.fillStyle = `rgba(${p.color},${near ? 0.95 : 0.55})`;
|
||||
context.fillStyle = `rgba(${p.color},${near ? 0.55 : 0.28})`;
|
||||
context.fill();
|
||||
if (near) {
|
||||
context.beginPath();
|
||||
context.arc(p.x, p.y, p.r + 6, 0, Math.PI * 2);
|
||||
context.fillStyle = `rgba(${p.color},0.16)`;
|
||||
context.arc(p.x, p.y, p.r + 4, 0, Math.PI * 2);
|
||||
context.fillStyle = `rgba(${p.color},0.1)`;
|
||||
context.fill();
|
||||
}
|
||||
if (width > 700)
|
||||
points.slice(index + 1).forEach((q) => {
|
||||
const distance = Math.hypot(q.x - p.x, q.y - p.y);
|
||||
if (distance > 170) return;
|
||||
if (distance > 140) return;
|
||||
context.beginPath();
|
||||
context.moveTo(p.x, p.y);
|
||||
context.lineTo(q.x, q.y);
|
||||
context.strokeStyle = `rgba(78,205,196,${(1 - distance / 170) * 0.32})`;
|
||||
context.strokeStyle = `rgba(78,205,196,${(1 - distance / 140) * 0.16})`;
|
||||
context.lineWidth = 1.05;
|
||||
context.stroke();
|
||||
});
|
||||
|
||||
@ -5,29 +5,29 @@ import { usePathname } from "next/navigation";
|
||||
import {
|
||||
CircleUserRound,
|
||||
Compass,
|
||||
Heart,
|
||||
House,
|
||||
MessageCircle,
|
||||
Radio,
|
||||
} from "lucide-react";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
const LINKS = [
|
||||
{ href: "/", label: "社区首页", icon: House },
|
||||
{ href: "/people", label: "发现同类", icon: Compass },
|
||||
{ href: "/chat", label: "话题聊天室", icon: MessageCircle },
|
||||
{ href: "/meetup", label: "Meetup 活动", icon: Radio },
|
||||
{ href: "/roster", label: "我的游民名片", icon: CircleUserRound },
|
||||
{ href: "/", label: "首页", short: "首页", icon: House },
|
||||
{ href: "/people", label: "想见的人", short: "看看谁", icon: Compass },
|
||||
{ href: "/date", label: "认识一下", short: "认识", icon: Heart },
|
||||
{ href: "/chat", label: "大家聊天", short: "聊天", icon: MessageCircle },
|
||||
{ href: "/roster", label: "我的介绍", short: "我", icon: CircleUserRound },
|
||||
];
|
||||
|
||||
export function SocialMobileDock() {
|
||||
const pathname = usePathname();
|
||||
const links = LINKS;
|
||||
return (
|
||||
<nav className="social-mobile-dock" aria-label="快捷导航">
|
||||
{links.map((item) => (
|
||||
{LINKS.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={socialPath(item.href)}
|
||||
aria-label={item.label}
|
||||
aria-current={
|
||||
(
|
||||
item.href === "/"
|
||||
@ -38,16 +38,8 @@ export function SocialMobileDock() {
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<item.icon size={19} strokeWidth={1.6} />
|
||||
<span>
|
||||
{item.label === "我的游民名片"
|
||||
? "我的名片"
|
||||
: item.label === "话题聊天室"
|
||||
? "聊天"
|
||||
: item.label === "Meetup 活动"
|
||||
? "活动"
|
||||
: item.label}
|
||||
</span>
|
||||
<item.icon size={20} strokeWidth={1.7} />
|
||||
<span>{item.short}</span>
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
@ -57,11 +49,12 @@ export function SocialMobileDock() {
|
||||
export function SocialFooter() {
|
||||
return (
|
||||
<footer className="social-workspace-footer">
|
||||
<span>nomadro social · Meet beyond borders.</span>
|
||||
<span>游民社区 · 认识同频的人</span>
|
||||
<div>
|
||||
<Link href={socialPath("/feedback")}>反馈与建议</Link>
|
||||
<Link href={socialPath("/date")}>认识一下</Link>
|
||||
<Link href={socialPath("/feedback")}>说说想法</Link>
|
||||
<Link href={socialPath("/join")}>加入社区</Link>
|
||||
<Link href={socialPath("/roster")}>我的名片</Link>
|
||||
<Link href={socialPath("/roster")}>我的介绍</Link>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
|
||||
48
src/modules/social/components/SocialQuickRail.tsx
Normal file
48
src/modules/social/components/SocialQuickRail.tsx
Normal file
@ -0,0 +1,48 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { socialPath } from "@social/lib/socialPath";
|
||||
|
||||
const RAIL = [
|
||||
{ href: "/people", label: "想见的人", emoji: "👋" },
|
||||
{ href: "/date", label: "认识一下", emoji: "💕" },
|
||||
{ href: "/meetup", label: "开视频", emoji: "📹" },
|
||||
{ href: "/chat", label: "聊一聊", emoji: "💬" },
|
||||
{ href: "/coffeechat", label: "见一面", emoji: "🌆" },
|
||||
{ href: "/team", label: "一起做事", emoji: "🚀" },
|
||||
{ href: "/ebook", label: "共创", emoji: "🎨" },
|
||||
{ href: "/roster", label: "我的介绍", emoji: "🪪" },
|
||||
{ href: "/join", label: "加入社区", emoji: "✨" },
|
||||
];
|
||||
|
||||
export default function SocialQuickRail() {
|
||||
const pathname = usePathname();
|
||||
return (
|
||||
<nav className="social-quick-rail" aria-label="社区快捷入口">
|
||||
<div className="social-quick-rail-track">
|
||||
{RAIL.map((item) => {
|
||||
const href = socialPath(item.href);
|
||||
const active =
|
||||
item.href === "/ebook"
|
||||
? pathname.startsWith(socialPath("/ebook")) ||
|
||||
pathname.startsWith(socialPath("/videos"))
|
||||
: item.href === "/"
|
||||
? 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>
|
||||
);
|
||||
}
|
||||
@ -1,64 +1,98 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { ArrowUpRight, Check, Copy, Search, X } from "lucide-react";
|
||||
import { Check, Copy, Search, X } from "lucide-react";
|
||||
import { useLocalState } from "@social/lib/useLocalState";
|
||||
import { useSocialConfig } from "./SocialExperience";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const PAGE_MARK: Record<string, string> = {
|
||||
people: "👋",
|
||||
roster: "🪪",
|
||||
meetup: "📡",
|
||||
coffeechat: "☕",
|
||||
team: "🚀",
|
||||
gigs: "💼",
|
||||
chat: "💬",
|
||||
join: "✨",
|
||||
vip: "✨",
|
||||
ebook: "🎨",
|
||||
videos: "🎨",
|
||||
date: "💕",
|
||||
feedback: "💌",
|
||||
};
|
||||
|
||||
/** Compact page header — remote eyebrow / description when present. */
|
||||
export function PageIntro({
|
||||
eyebrow,
|
||||
title,
|
||||
accent,
|
||||
eyebrow,
|
||||
description,
|
||||
emoji,
|
||||
children,
|
||||
}: {
|
||||
eyebrow: string;
|
||||
eyebrow?: string;
|
||||
title: string;
|
||||
accent: string;
|
||||
description: string;
|
||||
accent?: string;
|
||||
description?: string;
|
||||
emoji?: string;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
const config = useSocialConfig();
|
||||
const key = usePathname().split("/")[2] || "home";
|
||||
const copy = config.copy.socialPages?.[key];
|
||||
eyebrow =
|
||||
typeof copy?.eyebrow === "string" && copy.eyebrow.trim()
|
||||
? copy.eyebrow
|
||||
: eyebrow;
|
||||
title =
|
||||
typeof copy?.title === "string" && copy.title.trim() ? copy.title : title;
|
||||
accent =
|
||||
const resolvedTitle =
|
||||
typeof copy?.title === "string" && copy.title.trim()
|
||||
? copy.title
|
||||
: title;
|
||||
const resolvedAccent =
|
||||
typeof copy?.accent === "string" && copy.accent.trim()
|
||||
? copy.accent
|
||||
: accent;
|
||||
description =
|
||||
: accent || "";
|
||||
const resolvedEyebrow =
|
||||
typeof copy?.eyebrow === "string" && copy.eyebrow.trim()
|
||||
? copy.eyebrow
|
||||
: eyebrow || "";
|
||||
const resolvedDescription =
|
||||
typeof copy?.description === "string" && copy.description.trim()
|
||||
? copy.description
|
||||
: description;
|
||||
: description || "";
|
||||
const mark = emoji || PAGE_MARK[key] || "◈";
|
||||
return (
|
||||
<section className="social-page-intro">
|
||||
<div className="social-page-orbit" aria-hidden="true">
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<span>✦</span>
|
||||
<header className="social-page-head">
|
||||
<div className="social-page-head-copy">
|
||||
{resolvedEyebrow ? (
|
||||
<p className="social-page-head-eyebrow">{resolvedEyebrow}</p>
|
||||
) : null}
|
||||
<h1>
|
||||
<span className="social-page-head-mark" aria-hidden>
|
||||
{mark}
|
||||
</span>
|
||||
<span className="social-page-head-title">
|
||||
{resolvedTitle}
|
||||
{resolvedAccent ? (
|
||||
<span className="social-page-head-accent">{resolvedAccent}</span>
|
||||
) : null}
|
||||
</span>
|
||||
</h1>
|
||||
{resolvedDescription ? (
|
||||
<p className="social-page-head-desc">{resolvedDescription}</p>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="social-page-kicker">
|
||||
<span />
|
||||
{eyebrow}
|
||||
</div>
|
||||
<h1>
|
||||
{title}
|
||||
<br />
|
||||
<span>{accent}</span>
|
||||
</h1>
|
||||
<p>{description}</p>
|
||||
{children}
|
||||
</section>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/** Honest demo / offline chip for mock surfaces. */
|
||||
export function DemoBadge({
|
||||
children = "示例介绍,方便先逛逛",
|
||||
}: {
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
return <span className="social-demo-badge">{children}</span>;
|
||||
}
|
||||
|
||||
export function SearchField({
|
||||
value,
|
||||
onChange,
|
||||
@ -160,20 +194,22 @@ export function ShareButton({ path, title }: { path: string; title: string }) {
|
||||
}
|
||||
|
||||
export function EmptyState({
|
||||
title = "暂时没有找到",
|
||||
description = "换个关键词,或试试其他筛选。",
|
||||
title = "暂时没有",
|
||||
description = "换个关键词,或清空筛选。",
|
||||
children,
|
||||
emoji = "✦",
|
||||
}: {
|
||||
title?: string;
|
||||
description?: string;
|
||||
children?: ReactNode;
|
||||
emoji?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="social-empty">
|
||||
<span aria-hidden>✦</span>
|
||||
<span aria-hidden>{emoji}</span>
|
||||
<h3>{title}</h3>
|
||||
<p>{description}</p>
|
||||
{children}
|
||||
{children ? <div className="social-empty-actions">{children}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -202,28 +238,24 @@ export function SocialDialog({
|
||||
}, []);
|
||||
return (
|
||||
<dialog
|
||||
className="social-detail-dialog"
|
||||
ref={ref}
|
||||
aria-label={title}
|
||||
className="social-dialog"
|
||||
onCancel={(event) => {
|
||||
event.preventDefault();
|
||||
onClose();
|
||||
}}
|
||||
onClick={(event) => {
|
||||
if (event.target === event.currentTarget) onClose();
|
||||
if (event.target === ref.current) onClose();
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div className="social-dialog-sheet">
|
||||
<header>
|
||||
<span>
|
||||
MAKE A CONNECTION <ArrowUpRight size={14} />
|
||||
</span>
|
||||
<button type="button" aria-label="关闭详情" onClick={onClose}>
|
||||
<X size={20} />
|
||||
<h2>{title}</h2>
|
||||
<button type="button" aria-label="关闭" onClick={onClose}>
|
||||
<X size={18} />
|
||||
</button>
|
||||
</header>
|
||||
<h2>{title}</h2>
|
||||
{children}
|
||||
<div className="social-dialog-body">{children}</div>
|
||||
</div>
|
||||
</dialog>
|
||||
);
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { Globe2 } from "lucide-react";
|
||||
|
||||
const CITIES = [
|
||||
{ name: "清迈", zone: "Asia/Bangkok", caption: "CHIANG MAI", emoji: "🌿" },
|
||||
{ name: "大理", zone: "Asia/Shanghai", caption: "DALI", emoji: "🏔️" },
|
||||
{ name: "里斯本", zone: "Europe/Lisbon", caption: "LISBON", emoji: "🌊" },
|
||||
{ name: "巴厘岛", zone: "Asia/Makassar", caption: "BALI", emoji: "🌴" },
|
||||
];
|
||||
export default function WorldConnections() {
|
||||
const [now, setNow] = useState<Date | null>(null);
|
||||
useEffect(() => {
|
||||
const update = () => setNow(new Date());
|
||||
const first = requestAnimationFrame(update);
|
||||
const timer = setInterval(update, 30000);
|
||||
return () => {
|
||||
cancelAnimationFrame(first);
|
||||
clearInterval(timer);
|
||||
};
|
||||
}, []);
|
||||
return (
|
||||
<div className="container social-world-strip">
|
||||
<div>
|
||||
<strong>
|
||||
<Globe2
|
||||
size={14}
|
||||
style={{
|
||||
display: "inline",
|
||||
verticalAlign: "middle",
|
||||
marginRight: 7,
|
||||
}}
|
||||
/>
|
||||
世界在流动,连接在发生
|
||||
</strong>
|
||||
<p>四座城市 · 此刻的当地时间</p>
|
||||
</div>
|
||||
{CITIES.map((city) => (
|
||||
<div className="social-world-city" key={city.zone}>
|
||||
<strong>
|
||||
<span aria-hidden>{city.emoji}</span>
|
||||
{city.name}
|
||||
</strong>
|
||||
<time>
|
||||
{now
|
||||
? new Intl.DateTimeFormat("en-GB", {
|
||||
timeZone: city.zone,
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
}).format(now)
|
||||
: "--:--"}
|
||||
</time>
|
||||
<small>{city.caption}</small>
|
||||
<Link
|
||||
href={`/social/people?city=${encodeURIComponent(city.name)}`}
|
||||
aria-label={`发现${city.name}的游民`}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -19,122 +19,100 @@ export type SocialSection = {
|
||||
export const SOCIAL_SECTIONS: SocialSection[] = [
|
||||
{
|
||||
id: "online",
|
||||
title: "线上社交",
|
||||
subtitle: "加群 · 实时聊天 · Meetup",
|
||||
title: "认识人",
|
||||
subtitle: "看看谁在这儿 · 聊聊 · 开视频",
|
||||
features: [
|
||||
{
|
||||
id: "join",
|
||||
emoji: "🚩",
|
||||
title: "加群",
|
||||
desc: "线上社区入口,找到同频游民",
|
||||
href: "/join",
|
||||
id: "people",
|
||||
emoji: "👋",
|
||||
title: "想见的人",
|
||||
desc: "按城市或兴趣看看大家",
|
||||
href: "/people",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "chat",
|
||||
emoji: "💬",
|
||||
title: "实时聊天室",
|
||||
desc: "自研文字频道,本地可发消息",
|
||||
title: "大家聊天",
|
||||
desc: "打个招呼就好",
|
||||
href: "/chat",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "meetup",
|
||||
emoji: "📹",
|
||||
title: "线上 Meetup",
|
||||
desc: "站内分屏视频房 · 同页文字频道",
|
||||
title: "开视频聊聊",
|
||||
desc: "几个人一起开摄像头见面",
|
||||
href: "/meetup",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "join",
|
||||
emoji: "🚩",
|
||||
title: "加入社区",
|
||||
desc: "付费加入,或先看公众号",
|
||||
href: "/join",
|
||||
status: "live",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "offline",
|
||||
title: "线下连接",
|
||||
subtitle: "Coffeechat · Date",
|
||||
title: "见一面",
|
||||
subtitle: "咖啡馆 · 认识一下 · 我的介绍",
|
||||
features: [
|
||||
{
|
||||
id: "coffeechat",
|
||||
emoji: "☕",
|
||||
title: "Coffeechat",
|
||||
desc: "咖啡馆合作 · 评价 · 合照备注",
|
||||
title: "找城市见面",
|
||||
desc: "选城市,找适合见面的咖啡馆",
|
||||
href: "/coffeechat",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "date",
|
||||
emoji: "🎙",
|
||||
title: "Date / 访谈",
|
||||
desc: "线下访谈视频与故事",
|
||||
emoji: "💕",
|
||||
title: "认识一下",
|
||||
desc: "左滑跳过 · 右滑想认识",
|
||||
href: "/date",
|
||||
status: "live",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "vip",
|
||||
title: "VIP",
|
||||
subtitle: "职业花名册 · 虚拟支付",
|
||||
features: [
|
||||
{
|
||||
id: "roster",
|
||||
emoji: "📇",
|
||||
title: "职业花名册",
|
||||
desc: "资料表单 · Linktree · 手机号",
|
||||
title: "我的介绍",
|
||||
desc: "写几句,让别人认识你",
|
||||
href: "/roster",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "pay",
|
||||
emoji: "💳",
|
||||
title: "会员开通",
|
||||
desc: "虚拟支付 · 对接门户 VIP",
|
||||
href: "/vip",
|
||||
status: "live",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "ugc",
|
||||
title: "UGC",
|
||||
subtitle: "小册 · 视频",
|
||||
features: [
|
||||
{
|
||||
id: "ebook",
|
||||
emoji: "📖",
|
||||
title: "电子书",
|
||||
desc: "游民内容共创与阅读",
|
||||
href: "/ebook",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "video",
|
||||
emoji: "🎬",
|
||||
title: "视频",
|
||||
desc: "UGC 视频与访谈合集",
|
||||
href: "/videos",
|
||||
status: "live",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "ops",
|
||||
title: "远程团队",
|
||||
subtitle: "志愿者 · 兼职 · 全职 · 反馈",
|
||||
id: "grow",
|
||||
title: "一起做事",
|
||||
subtitle: "找搭子 · 共创 · 说说想法",
|
||||
features: [
|
||||
{
|
||||
id: "team",
|
||||
emoji: "🧑💻",
|
||||
title: "远程团队",
|
||||
desc: "招募志愿者 / 兼职 / 全职",
|
||||
title: "找搭子做事",
|
||||
desc: "帮忙、兼职、一起做点事",
|
||||
href: "/team",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "cocreate",
|
||||
emoji: "✨",
|
||||
title: "共创",
|
||||
desc: "大家一起写的小册和拍的视频",
|
||||
href: "/ebook",
|
||||
status: "live",
|
||||
},
|
||||
{
|
||||
id: "feedback",
|
||||
emoji: "💡",
|
||||
title: "反馈建议",
|
||||
desc: "产品反馈与改进建议",
|
||||
title: "说说想法",
|
||||
desc: "哪里不顺手,告诉我们",
|
||||
href: "/feedback",
|
||||
status: "live",
|
||||
},
|
||||
|
||||
168
src/modules/social/lib/cities.ts
Normal file
168
src/modules/social/lib/cities.ts
Normal file
@ -0,0 +1,168 @@
|
||||
/** Offline city catalog — seed inspired by meetup.hackrobot.cn destination list. */
|
||||
|
||||
export type SocialCity = {
|
||||
id: string;
|
||||
name: string;
|
||||
country: string;
|
||||
emoji: string;
|
||||
vibe: string;
|
||||
members: number;
|
||||
costHint: string;
|
||||
wifiMbps: number;
|
||||
tags: string[];
|
||||
hot?: boolean;
|
||||
};
|
||||
|
||||
export const SOCIAL_CITIES: SocialCity[] = [
|
||||
{
|
||||
id: "dali",
|
||||
name: "大理",
|
||||
country: "中国",
|
||||
emoji: "🏔️",
|
||||
vibe: "苍山洱海 · 慢生活",
|
||||
members: 520,
|
||||
costHint: "¥3,000/月起",
|
||||
wifiMbps: 50,
|
||||
tags: ["热门", "便宜", "山城"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "chengdu",
|
||||
name: "成都",
|
||||
country: "中国",
|
||||
emoji: "🌶️",
|
||||
vibe: "天府之国 · 美食慢节奏",
|
||||
members: 680,
|
||||
costHint: "¥4,500/月起",
|
||||
wifiMbps: 80,
|
||||
tags: ["热门", "美食", "宜居"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "hangzhou",
|
||||
name: "杭州",
|
||||
country: "中国",
|
||||
emoji: "🏞️",
|
||||
vibe: "西湖 · 互联网重镇",
|
||||
members: 560,
|
||||
costHint: "¥6,000/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["热门", "高速网络"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "kunming",
|
||||
name: "昆明",
|
||||
country: "中国",
|
||||
emoji: "🌸",
|
||||
vibe: "四季如春 · 通往东南亚",
|
||||
members: 380,
|
||||
costHint: "¥3,500/月起",
|
||||
wifiMbps: 55,
|
||||
tags: ["温暖", "便宜"],
|
||||
},
|
||||
{
|
||||
id: "shenzhen",
|
||||
name: "深圳",
|
||||
country: "中国",
|
||||
emoji: "🚀",
|
||||
vibe: "科技创新 · 创业友好",
|
||||
members: 850,
|
||||
costHint: "¥8,000/月起",
|
||||
wifiMbps: 120,
|
||||
tags: ["热门", "高速网络", "一线城市"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "xiamen",
|
||||
name: "厦门",
|
||||
country: "中国",
|
||||
emoji: "🏝️",
|
||||
vibe: "海滨花园 · 鼓浪屿",
|
||||
members: 320,
|
||||
costHint: "¥5,500/月起",
|
||||
wifiMbps: 70,
|
||||
tags: ["海滨", "温暖"],
|
||||
},
|
||||
{
|
||||
id: "shanghai",
|
||||
name: "上海",
|
||||
country: "中国",
|
||||
emoji: "🌆",
|
||||
vibe: "国际大都市 · 文化交汇",
|
||||
members: 1200,
|
||||
costHint: "¥10,000/月起",
|
||||
wifiMbps: 110,
|
||||
tags: ["一线城市", "热门"],
|
||||
},
|
||||
{
|
||||
id: "lijiang",
|
||||
name: "丽江",
|
||||
country: "中国",
|
||||
emoji: "🏯",
|
||||
vibe: "玉龙雪山 · 古城慢旅",
|
||||
members: 280,
|
||||
costHint: "¥3,200/月起",
|
||||
wifiMbps: 45,
|
||||
tags: ["便宜", "山城"],
|
||||
},
|
||||
{
|
||||
id: "chiangmai",
|
||||
name: "清迈",
|
||||
country: "泰国",
|
||||
emoji: "🌿",
|
||||
vibe: "Nimman · 游民大本营",
|
||||
members: 940,
|
||||
costHint: "฿18,000/月起",
|
||||
wifiMbps: 90,
|
||||
tags: ["热门", "友好社区", "高速网络"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "bali",
|
||||
name: "巴厘岛",
|
||||
country: "印尼",
|
||||
emoji: "🌴",
|
||||
vibe: "Canggu · 冲浪与 cowork",
|
||||
members: 720,
|
||||
costHint: "Rp8jt/月起",
|
||||
wifiMbps: 60,
|
||||
tags: ["海滨", "温暖", "热门"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "lisbon",
|
||||
name: "里斯本",
|
||||
country: "葡萄牙",
|
||||
emoji: "🌊",
|
||||
vibe: "阳光海岸 · 欧洲时区",
|
||||
members: 610,
|
||||
costHint: "€1,200/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["海滨", "友好社区"],
|
||||
},
|
||||
{
|
||||
id: "penang",
|
||||
name: "槟城",
|
||||
country: "马来西亚",
|
||||
emoji: "🍜",
|
||||
vibe: "美食 · 海风开放工位",
|
||||
members: 260,
|
||||
costHint: "RM2,800/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["美食", "便宜"],
|
||||
},
|
||||
];
|
||||
|
||||
export const CITY_FILTER_TAGS = [
|
||||
"全部",
|
||||
"热门",
|
||||
"便宜",
|
||||
"高速网络",
|
||||
"温暖",
|
||||
"海滨",
|
||||
"山城",
|
||||
"一线城市",
|
||||
"友好社区",
|
||||
"美食",
|
||||
] as const;
|
||||
83
src/modules/social/lib/discoveryRoster.ts
Normal file
83
src/modules/social/lib/discoveryRoster.ts
Normal file
@ -0,0 +1,83 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useSyncExternalStore } from "react";
|
||||
import { MOCK_ROSTER, type SocialRosterMember } from "./rosterMock";
|
||||
import { loadJson, saveJson } from "./storage";
|
||||
import type { SocialRosterProfile } from "./types";
|
||||
|
||||
export const ROSTER_PUBLISH_KEY = "roster-publish";
|
||||
export const ROSTER_PUBLISH_CHANGED = "social-roster-publish-changed";
|
||||
export const SELF_MEMBER_ID = "self-local";
|
||||
|
||||
const EMPTY: SocialRosterProfile = {
|
||||
name: "",
|
||||
title: "",
|
||||
city: "",
|
||||
phone: "",
|
||||
linktree: "",
|
||||
skills: "",
|
||||
bio: "",
|
||||
};
|
||||
|
||||
const STORAGE_CHANGE = "nomadro-social-storage";
|
||||
|
||||
function subscribeSocialStorage(cb: () => void) {
|
||||
window.addEventListener("storage", cb);
|
||||
window.addEventListener(STORAGE_CHANGE, cb);
|
||||
window.addEventListener(ROSTER_PUBLISH_CHANGED, cb);
|
||||
return () => {
|
||||
window.removeEventListener("storage", cb);
|
||||
window.removeEventListener(STORAGE_CHANGE, cb);
|
||||
window.removeEventListener(ROSTER_PUBLISH_CHANGED, cb);
|
||||
};
|
||||
}
|
||||
|
||||
export function setRosterPublished(published: boolean) {
|
||||
saveJson(ROSTER_PUBLISH_KEY, published);
|
||||
window.dispatchEvent(new Event(STORAGE_CHANGE));
|
||||
window.dispatchEvent(new Event(ROSTER_PUBLISH_CHANGED));
|
||||
}
|
||||
|
||||
export function profileToMember(
|
||||
profile: SocialRosterProfile,
|
||||
): SocialRosterMember | null {
|
||||
const name = profile.name.trim();
|
||||
if (!name) return null;
|
||||
const tags = profile.skills
|
||||
.split(/[,,、]/)
|
||||
.map((t) => t.trim())
|
||||
.filter(Boolean)
|
||||
.slice(0, 6);
|
||||
return {
|
||||
id: SELF_MEMBER_ID,
|
||||
name,
|
||||
title: profile.title.trim() || "游民",
|
||||
city: profile.city.trim() || "探索中",
|
||||
tags: tags.length ? tags : ["新朋友"],
|
||||
avatar: `https://api.dicebear.com/7.x/initials/svg?seed=${encodeURIComponent(name)}`,
|
||||
bio: profile.bio.trim() || "刚写好介绍,想认识同频的人。",
|
||||
vibe: "刚出现",
|
||||
online: true,
|
||||
lookingFor: "想认识同频游民",
|
||||
gender: "f",
|
||||
};
|
||||
}
|
||||
|
||||
/** Seed roster + optional self card when user opted into discovery. */
|
||||
export function useDiscoveryRoster(): SocialRosterMember[] {
|
||||
const published = useSyncExternalStore(
|
||||
subscribeSocialStorage,
|
||||
() => loadJson<boolean>(ROSTER_PUBLISH_KEY, false),
|
||||
() => false,
|
||||
);
|
||||
const profile = useSyncExternalStore(
|
||||
subscribeSocialStorage,
|
||||
() => loadJson<SocialRosterProfile>("roster", EMPTY),
|
||||
() => EMPTY,
|
||||
);
|
||||
return useMemo(() => {
|
||||
const self = published ? profileToMember(profile) : null;
|
||||
if (!self) return MOCK_ROSTER;
|
||||
return [self, ...MOCK_ROSTER.filter((m) => m.id !== SELF_MEMBER_ID)];
|
||||
}, [published, profile]);
|
||||
}
|
||||
@ -14,6 +14,12 @@ const COPY_KEYS = [
|
||||
"socialOnlineTitle",
|
||||
"socialOfflineTitle",
|
||||
"socialTeamTitle",
|
||||
"socialWayChat",
|
||||
"socialWayDate",
|
||||
"socialWayCafe",
|
||||
"socialWayTeam",
|
||||
"socialPayJoinLabel",
|
||||
"socialOaJoinLabel",
|
||||
] as const;
|
||||
|
||||
export type SocialLandingCopy = Record<(typeof COPY_KEYS)[number], string>;
|
||||
|
||||
139
src/modules/social/lib/resolveCatalog.ts
Normal file
139
src/modules/social/lib/resolveCatalog.ts
Normal file
@ -0,0 +1,139 @@
|
||||
import {
|
||||
SEED_CAFES,
|
||||
SEED_GIGS,
|
||||
SEED_MEETUPS,
|
||||
} from "./seed";
|
||||
import type {
|
||||
SocialCafe,
|
||||
SocialGig,
|
||||
SocialMeetup,
|
||||
SocialTeamKind,
|
||||
} from "./types";
|
||||
|
||||
export type SocialCatalogBundle = {
|
||||
cafes: SocialCafe[];
|
||||
meetups: SocialMeetup[];
|
||||
gigs: SocialGig[];
|
||||
source: "remote" | "seed";
|
||||
};
|
||||
|
||||
type RawCatalog = {
|
||||
cafes?: unknown;
|
||||
meetups?: unknown;
|
||||
gigs?: unknown;
|
||||
};
|
||||
|
||||
function asString(v: unknown, fallback = "") {
|
||||
return typeof v === "string" ? v : fallback;
|
||||
}
|
||||
|
||||
function asNumber(v: unknown, fallback: number) {
|
||||
const n = Number(v);
|
||||
return Number.isFinite(n) ? n : fallback;
|
||||
}
|
||||
|
||||
function asBool(v: unknown, fallback: boolean) {
|
||||
return typeof v === "boolean" ? v : fallback;
|
||||
}
|
||||
|
||||
function normalizeCafe(raw: unknown, i: number, fallback?: SocialCafe): SocialCafe | null {
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const r = raw as Record<string, unknown>;
|
||||
const id = asString(r.id) || fallback?.id || `cafe-${i}`;
|
||||
const name = asString(r.name) || fallback?.name;
|
||||
if (!name) return null;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
city: asString(r.city, fallback?.city || "未标注"),
|
||||
wifiMbps: asNumber(r.wifiMbps, fallback?.wifiMbps ?? 40),
|
||||
power: asString(r.power, fallback?.power || "插座情况待确认"),
|
||||
vibe: asString(r.vibe, fallback?.vibe || ""),
|
||||
partners: asBool(r.partners, fallback?.partners ?? false),
|
||||
rating: asNumber(r.rating, fallback?.rating ?? 4.5),
|
||||
reviews: asNumber(r.reviews, fallback?.reviews ?? 0),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeMeetup(
|
||||
raw: unknown,
|
||||
i: number,
|
||||
fallback?: SocialMeetup,
|
||||
): SocialMeetup | null {
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const r = raw as Record<string, unknown>;
|
||||
const id = asString(r.id) || fallback?.id || `meetup-${i}`;
|
||||
const title = asString(r.title) || fallback?.title;
|
||||
if (!title) return null;
|
||||
const mode = r.mode === "hybrid" ? "hybrid" : "online";
|
||||
return {
|
||||
id,
|
||||
title,
|
||||
city: asString(r.city, fallback?.city || "Online"),
|
||||
date: asString(r.date, fallback?.date || ""),
|
||||
time: asString(r.time, fallback?.time || ""),
|
||||
mode,
|
||||
mirotalkRoom: asString(
|
||||
r.mirotalkRoom,
|
||||
fallback?.mirotalkRoom || id,
|
||||
),
|
||||
timeZone: asString(r.timeZone, fallback?.timeZone || "Asia/Shanghai") || undefined,
|
||||
channelId: asString(r.channelId, fallback?.channelId || "meetup-live"),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeGig(raw: unknown, i: number, fallback?: SocialGig): SocialGig | null {
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const r = raw as Record<string, unknown>;
|
||||
const id = asString(r.id) || fallback?.id || `gig-${i}`;
|
||||
const title = asString(r.title) || fallback?.title;
|
||||
if (!title) return null;
|
||||
const kindRaw = asString(r.kind, fallback?.kind || "parttime");
|
||||
const kind: SocialTeamKind =
|
||||
kindRaw === "volunteer" || kindRaw === "fulltime" || kindRaw === "parttime"
|
||||
? kindRaw
|
||||
: "parttime";
|
||||
const tags = Array.isArray(r.tags)
|
||||
? r.tags.map((t) => String(t)).filter(Boolean)
|
||||
: fallback?.tags || [];
|
||||
return {
|
||||
id,
|
||||
title,
|
||||
role: asString(r.role, fallback?.role || ""),
|
||||
pay: asString(r.pay, fallback?.pay || "面议"),
|
||||
remote: asBool(r.remote, fallback?.remote ?? true),
|
||||
tags,
|
||||
kind,
|
||||
};
|
||||
}
|
||||
|
||||
function pickList<T>(
|
||||
remote: unknown,
|
||||
seed: T[],
|
||||
normalize: (raw: unknown, i: number, fallback?: T) => T | null,
|
||||
): { items: T[]; usedRemote: boolean } {
|
||||
if (!Array.isArray(remote) || remote.length === 0) {
|
||||
return { items: seed, usedRemote: false };
|
||||
}
|
||||
const items = remote
|
||||
.map((row, i) => normalize(row, i, seed[i]))
|
||||
.filter((row): row is T => Boolean(row));
|
||||
if (!items.length) return { items: seed, usedRemote: false };
|
||||
return { items, usedRemote: true };
|
||||
}
|
||||
|
||||
/** Remote catalog overlays seed; empty/invalid remote → package seed offline. */
|
||||
export function resolveSocialCatalog(
|
||||
catalogs: RawCatalog | null | undefined,
|
||||
): SocialCatalogBundle {
|
||||
const cafes = pickList(catalogs?.cafes, SEED_CAFES, normalizeCafe);
|
||||
const meetups = pickList(catalogs?.meetups, SEED_MEETUPS, normalizeMeetup);
|
||||
const gigs = pickList(catalogs?.gigs, SEED_GIGS, normalizeGig);
|
||||
const usedRemote = cafes.usedRemote || meetups.usedRemote || gigs.usedRemote;
|
||||
return {
|
||||
cafes: cafes.items,
|
||||
meetups: meetups.items,
|
||||
gigs: gigs.items,
|
||||
source: usedRemote ? "remote" : "seed",
|
||||
};
|
||||
}
|
||||
@ -12,6 +12,11 @@ export type SocialRosterMember = {
|
||||
online: boolean;
|
||||
lookingFor: string;
|
||||
gender: "f" | "m";
|
||||
languages?: string[];
|
||||
availability?: string;
|
||||
timezone?: string;
|
||||
/** Extra photos for profile wall (nomads-style) */
|
||||
gallery?: string[];
|
||||
};
|
||||
|
||||
export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
@ -22,11 +27,18 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
city: "清迈 · Nimman",
|
||||
tags: ["咖啡局", "设计", "日出"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/65.jpg",
|
||||
bio: "喜欢把 cowork 聊成真实见面。周末常去 Graph Table。",
|
||||
bio: "喜欢把 cowork 聊成真实见面。周末常去 Graph Table,也爱清晨骑车去山上看雾。",
|
||||
vibe: "温柔 · 有品味",
|
||||
online: true,
|
||||
lookingFor: "想认识会拍照的远程伙伴",
|
||||
gender: "f",
|
||||
languages: ["中文", "English"],
|
||||
availability: "本周可 Coffeechat",
|
||||
timezone: "ICT (UTC+7)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1523906834658-6e24ef2386f9?w=640&q=80",
|
||||
"https://images.unsplash.com/photo-1554118811-1e0d58224f24?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m02",
|
||||
@ -35,11 +47,17 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
city: "里斯本",
|
||||
tags: ["Next.js", "夜跑", "冲浪"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/32.jpg",
|
||||
bio: "白天写代码,傍晚海边。欢迎 Coffeechat 聊产品。",
|
||||
bio: "白天写代码,傍晚海边。欢迎 Coffeechat 聊产品与出海。",
|
||||
vibe: "阳光 · 靠谱",
|
||||
online: true,
|
||||
lookingFor: "找联创 / 一起做副业",
|
||||
gender: "m",
|
||||
languages: ["English", "Português", "中文"],
|
||||
availability: "欧洲晚间可视频",
|
||||
timezone: "WET (UTC+0)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1555881403-7463c9aea225?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m03",
|
||||
@ -48,11 +66,14 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
city: "巴厘岛 · Canggu",
|
||||
tags: ["Vlog", "瑜伽", "出海"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/44.jpg",
|
||||
bio: "镜头前很活泼,线下更爱深度聊天。",
|
||||
bio: "镜头前很活泼,线下更爱深度聊天。常在 Canggu cowork。",
|
||||
vibe: "活力",
|
||||
online: false,
|
||||
lookingFor: "想认识同频创作者",
|
||||
gender: "f",
|
||||
languages: ["中文", "English"],
|
||||
availability: "周末可线下局",
|
||||
timezone: "WITA (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m04",
|
||||
@ -61,11 +82,14 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
city: "东京 / 远程",
|
||||
tags: ["B2B", "胶片", "拉面"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/75.jpg",
|
||||
bio: "时差玩家。Meetup 控场很稳,私下爱胶片机。",
|
||||
bio: "时差玩家。开视频见面时很稳,私下爱胶片机。",
|
||||
vibe: "干净 · 有梗",
|
||||
online: true,
|
||||
lookingFor: "想找一起探索城市的人",
|
||||
gender: "m",
|
||||
languages: ["日本語", "English", "中文"],
|
||||
availability: "常来开视频见面",
|
||||
timezone: "JST (UTC+9)",
|
||||
},
|
||||
{
|
||||
id: "m05",
|
||||
@ -79,6 +103,9 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: true,
|
||||
lookingFor: "找一起搞出海的搭档",
|
||||
gender: "f",
|
||||
languages: ["中文", "English", "ไทย"],
|
||||
availability: "今晚可以开视频",
|
||||
timezone: "ICT (UTC+7)",
|
||||
},
|
||||
{
|
||||
id: "m06",
|
||||
@ -92,6 +119,9 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: false,
|
||||
lookingFor: "想找 cowork 搭子",
|
||||
gender: "m",
|
||||
languages: ["中文", "English"],
|
||||
availability: "工作日 cowork",
|
||||
timezone: "ICT (UTC+7)",
|
||||
},
|
||||
{
|
||||
id: "m07",
|
||||
@ -105,6 +135,12 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: true,
|
||||
lookingFor: "想认识爱旅行的你",
|
||||
gender: "f",
|
||||
languages: ["English", "中文"],
|
||||
availability: "可约旅拍",
|
||||
timezone: "ICT (UTC+7)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1492691527719-9d1e07e534b4?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m08",
|
||||
@ -118,6 +154,9 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: true,
|
||||
lookingFor: "找一起搞钱也搞生活的人",
|
||||
gender: "m",
|
||||
languages: ["中文", "English", "Bahasa"],
|
||||
availability: "本周可视频",
|
||||
timezone: "MYT (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m09",
|
||||
@ -131,6 +170,9 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: false,
|
||||
lookingFor: "想认识认真做产品的人",
|
||||
gender: "f",
|
||||
languages: ["Deutsch", "English", "中文"],
|
||||
availability: "周末可聊",
|
||||
timezone: "CET (UTC+1)",
|
||||
},
|
||||
{
|
||||
id: "m10",
|
||||
@ -139,11 +181,14 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
city: "首尔 / 远程",
|
||||
tags: ["Agent", "开源", "咖啡"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/41.jpg",
|
||||
bio: "技术宅但不社恐。Meetup 常客。",
|
||||
bio: "技术宅但不社恐。经常来开视频见面。",
|
||||
vibe: "稳 · 有趣",
|
||||
online: true,
|
||||
lookingFor: "找一起做 AI 副业的人",
|
||||
gender: "m",
|
||||
languages: ["한국어", "English"],
|
||||
availability: "常在视频见面里",
|
||||
timezone: "KST (UTC+9)",
|
||||
},
|
||||
{
|
||||
id: "m11",
|
||||
@ -157,6 +202,9 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: true,
|
||||
lookingFor: "欢迎路过的游民串门",
|
||||
gender: "f",
|
||||
languages: ["中文"],
|
||||
availability: "店里随时欢迎",
|
||||
timezone: "CST (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m12",
|
||||
@ -170,9 +218,21 @@ export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
online: false,
|
||||
lookingFor: "想认识想出发的你",
|
||||
gender: "m",
|
||||
languages: ["English", "Français", "中文"],
|
||||
availability: "可预约 1v1",
|
||||
timezone: "WET (UTC+0)",
|
||||
},
|
||||
];
|
||||
|
||||
export function findRosterMember(
|
||||
id: string,
|
||||
extra: SocialRosterMember[] = [],
|
||||
): SocialRosterMember | undefined {
|
||||
return (
|
||||
extra.find((m) => m.id === id) || MOCK_ROSTER.find((m) => m.id === id)
|
||||
);
|
||||
}
|
||||
|
||||
/** 仅演示用,禁止当作真实运营数据展示 */
|
||||
export const SOCIAL_PROOF = {
|
||||
onlineNow: MOCK_ROSTER.filter((m) => m.online).length,
|
||||
|
||||
@ -42,7 +42,7 @@ export const SEED_MESSAGES: SocialChatMessage[] = [
|
||||
id: "m4",
|
||||
channelId: "meetup-live",
|
||||
author: "Host",
|
||||
text: "今晚 20:00 Meetup,视频走 MiroTalk,文字留在本频道。",
|
||||
text: "今晚 20:00 开视频见面,文字也可以在这儿继续聊。",
|
||||
at: "2026-10-30T08:00:00.000Z",
|
||||
},
|
||||
];
|
||||
@ -147,38 +147,38 @@ export const SEED_VIDEOS: SocialVideo[] = [
|
||||
export const SEED_EBOOKS: SocialEbook[] = [
|
||||
{
|
||||
id: "social-playbook",
|
||||
title: "游民社区玩法手册",
|
||||
title: "游民社区怎么玩",
|
||||
chapters: 6,
|
||||
minutes: 35,
|
||||
blurb: "加群、聊天室、Meetup、Coffeechat 怎么玩。",
|
||||
blurb: "怎么认识人、开视频、约咖啡、一起做事,一篇说清楚。",
|
||||
},
|
||||
{
|
||||
id: "roster-guide",
|
||||
title: "职业花名册指南",
|
||||
title: "怎么写好自我介绍",
|
||||
chapters: 4,
|
||||
minutes: 20,
|
||||
blurb: "如何写资料、挂 Linktree、被同城找到。",
|
||||
blurb: "写几句让同城的人找到你,也不用写得很正式。",
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_GIGS: SocialGig[] = [
|
||||
{
|
||||
id: "vol-welcome",
|
||||
title: "新人接待志愿者",
|
||||
role: "志愿者",
|
||||
title: "欢迎新人的帮手",
|
||||
role: "帮忙志愿",
|
||||
pay: "公益积分 / 社群徽章",
|
||||
remote: true,
|
||||
kind: "volunteer",
|
||||
tags: ["加群引导", "花名册答疑", "周报"],
|
||||
tags: ["带新人", "答疑", "周报"],
|
||||
},
|
||||
{
|
||||
id: "vol-event",
|
||||
title: "线下局志愿者",
|
||||
role: "志愿者",
|
||||
title: "线下见面局帮手",
|
||||
role: "帮忙志愿",
|
||||
pay: "活动席位优先",
|
||||
remote: false,
|
||||
kind: "volunteer",
|
||||
tags: ["Coffeechat", "合照", "场地协调"],
|
||||
tags: ["约咖啡", "合照", "场地协调"],
|
||||
},
|
||||
{
|
||||
id: "ops-assistant",
|
||||
@ -187,21 +187,21 @@ export const SEED_GIGS: SocialGig[] = [
|
||||
pay: "按场次结算",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
tags: ["拍摄", "剪辑素材", "活动跟场"],
|
||||
tags: ["拍摄", "剪辑", "活动跟场"],
|
||||
},
|
||||
{
|
||||
id: "community-mod",
|
||||
title: "社群值班主持人",
|
||||
role: "远程兼职",
|
||||
role: "线上兼职",
|
||||
pay: "月度津贴",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
tags: ["聊天室", "Meetup 控场"],
|
||||
tags: ["聊天室", "视频见面主持"],
|
||||
},
|
||||
{
|
||||
id: "content-pt",
|
||||
title: "内容兼职编辑",
|
||||
role: "远程兼职",
|
||||
role: "线上兼职",
|
||||
pay: "按篇结算",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
@ -210,16 +210,16 @@ export const SEED_GIGS: SocialGig[] = [
|
||||
{
|
||||
id: "ft-community",
|
||||
title: "社群运营负责人",
|
||||
role: "全职 · 远程优先",
|
||||
role: "全职 · 线上优先",
|
||||
pay: "面议 · 季度复盘",
|
||||
remote: true,
|
||||
kind: "fulltime",
|
||||
tags: ["增长", "活动", "花名册"],
|
||||
tags: ["增长", "活动", "认识人"],
|
||||
},
|
||||
{
|
||||
id: "ft-fullstack",
|
||||
title: "全栈工程师",
|
||||
role: "全职 · 远程",
|
||||
role: "全职 · 线上",
|
||||
pay: "面议",
|
||||
remote: true,
|
||||
kind: "fulltime",
|
||||
@ -228,9 +228,9 @@ export const SEED_GIGS: SocialGig[] = [
|
||||
];
|
||||
|
||||
export const TEAM_KIND_LABEL: Record<SocialTeamKind, string> = {
|
||||
volunteer: "志愿者",
|
||||
parttime: "兼职",
|
||||
fulltime: "全职",
|
||||
volunteer: "帮忙志愿",
|
||||
parttime: "兼职机会",
|
||||
fulltime: "全职机会",
|
||||
};
|
||||
|
||||
/** Same box as nomadro.cn (82.x). Prefer .cn — avoid .com→107 hop. */
|
||||
|
||||
32
src/modules/social/lib/useRevealMotion.ts
Normal file
32
src/modules/social/lib/useRevealMotion.ts
Normal file
@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
/** Observe `.reveal` inside a root selector and mark `.visible` once. */
|
||||
export function useRevealMotion(rootSelector: string, deps: unknown[] = []) {
|
||||
useEffect(() => {
|
||||
const root = document.querySelector(rootSelector);
|
||||
if (!root) return;
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) =>
|
||||
entries.forEach((entry) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
entry.target.classList.add("visible");
|
||||
observer.unobserve(entry.target);
|
||||
}),
|
||||
{ threshold: 0.08, rootMargin: "0px 0px -20px 0px" },
|
||||
);
|
||||
const scan = () => {
|
||||
root
|
||||
.querySelectorAll(".reveal:not(.visible)")
|
||||
.forEach((el) => observer.observe(el));
|
||||
};
|
||||
scan();
|
||||
const t = window.setTimeout(scan, 350);
|
||||
return () => {
|
||||
window.clearTimeout(t);
|
||||
observer.disconnect();
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- caller owns deps
|
||||
}, deps);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user