From e65728601fa8887b3239d8fb556bf48978437886 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 1 Nov 2026 23:19:59 +0800 Subject: [PATCH] Ship /social H5 deep polish on test7 and document release line. Tighten mobile Ways/dock/chat/date sheets, add social loading/error boundaries, and mark test8 as the next branch. Co-authored-by: Cursor --- README.md | 21 +- deploy/social/README.md | 5 +- src/app/social/error.tsx | 18 ++ src/app/social/loading.tsx | 10 + src/app/social/meetup/[id]/page.tsx | 4 +- src/modules/social/README.md | 3 +- src/modules/social/app/h5.css | 306 +++++++++++++++++- src/modules/social/app/vivid.css | 4 +- .../social/components/AttractiveRoster.tsx | 39 +-- .../social/components/CafeDirectory.tsx | 23 +- .../social/components/ChatWorkspace.tsx | 6 +- .../social/components/CityDirectory.tsx | 5 +- src/modules/social/components/DateClient.tsx | 77 ++--- .../social/components/EventDirectory.tsx | 25 +- .../social/components/JoinPayModal.tsx | 2 +- .../social/components/MeetupLiveClient.tsx | 57 +++- .../social/components/PeopleClient.tsx | 21 +- .../social/components/PeopleProfileClient.tsx | 39 +-- .../social/components/ProfileStudio.tsx | 6 +- .../social/components/ResourceLibrary.tsx | 61 +++- src/modules/social/components/RoleBoard.tsx | 4 +- src/modules/social/components/SiteShell.tsx | 64 ++-- .../social/components/SocialNavigation.tsx | 20 +- .../social/components/SocialQuickRail.tsx | 9 +- src/modules/social/components/SocialUI.tsx | 30 +- src/modules/social/lib/calendar.ts | 38 ++- src/modules/social/lib/discoveryRoster.ts | 14 +- src/modules/social/lib/storage.ts | 11 +- src/modules/social/lib/useRevealMotion.ts | 14 +- src/modules/social/lib/useRosterLikes.ts | 39 +++ 30 files changed, 707 insertions(+), 268 deletions(-) create mode 100644 src/app/social/error.tsx create mode 100644 src/app/social/loading.tsx create mode 100644 src/modules/social/lib/useRosterLikes.ts diff --git a/README.md b/README.md index d6b0fa2..ae981b7 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,8 @@ pnpm dev:api - **发布流**:本地调试 → 当前开发分支 commit/push → 部署脚本上线 → 冒烟;配置与发版均以 git 为准 - 审核冻结分支:`pre4`(**微信审核包,勿在本分支继续功能迭代**) - `pre5`:承接 pre4 之后的功能(含游民社区 `/social`) -- **当前开发分支:`test5`**(从 `pre5` 拉出);发版前与 README / 远程对齐 +- `test5` / `test6`:游民社区实时层与 H5 初版(已合入后续分支) +- **当前发版分支:`test7`**(游民社区 H5 深优);下一轮开发切 **`test8`** ### 游民社区(`/social`) @@ -161,17 +162,27 @@ pnpm dev:api - 隔离 API + SQLite;远程配置 `modules.social`;门户 hero 主入口切换为游民社区 - 社区 Settings `extra="ignore"`,避免统一 `.env` 拖垮 community 启动 -## test5(当前开发) +## test5 -从 `pre5` 切出。本轮已落地(细节以 `deploy/social/README.md` 为准): +从 `pre5` 切出。已落地(细节以 `deploy/social/README.md` 为准): - **Social 实时**:Centrifugo + `/api/social/v1/realtime/token`;聊天页优先 WS,失败降级轮询 - **Social API 独立进程**:`nomadro-social` `:8020`,与 ebook/community/pay 隔离 - **MiroTalk**:钉死 82 `.cn`、白标中文、极速进房 - **视觉**:T1 默认;T2 代码保留、切换器隐藏 -- **发版约定**:前端本地 `pnpm dev` 验收通过、**经允许后再部署**门户 `.next` -后续可做:课时资料后台可视化、桥接 UX、真机网络/域名排查。 +## test6 / test7(当前发版) + +游民社区 `/social` 手机端深优(门户 `h5.css` 最后加载): + +- **Ways**:`群组聊天 → 认识一下 → 开视频 → 见面 → 找搭子`;竖列表,勿再做成轮播 +- **底栏**:首页 → 聊天 → 认识 → 看看谁 → 我;聊天/滑卡操作区避开 dock + safe-area +- **首屏**:群组聊天在左、认识一下在右;窄屏收掉宇宙轨道,Ways 进首视口 +- **滑卡 / 群聊**:手机更低滑动阈值、震动反馈;composer / 加入 sheet 全宽底栏 +- **Meetup**:活动卡保留参与者头像 + 声纹条 +- **发版**:`python deploy/social/deploy_82.py`(仅 82);冒烟 `https://nomadro.cn/social` + +下一轮:`test8`(从 `test7` 拉出)。后续还可做:课时资料后台可视化、桥接 UX、真机网络/域名排查。 ## pre3 摘要(已合入) diff --git a/deploy/social/README.md b/deploy/social/README.md index a2445ef..e93c9d0 100644 --- a/deploy/social/README.md +++ b/deploy/social/README.md @@ -54,10 +54,13 @@ python deploy/social/deploy_82.py - `NEXT_PUBLIC_MIROTALK_URL=https://mirotalk.nomadro.cn`(`/etc/nomadro/portal.env`) - Centrifugo:`CENTRIFUGO_*`(见 `/etc/nomadro/centrifugo.env`,可并入 `portal.env`) -**前端发版**:先本地 `pnpm dev` 验收 `/social`;**未经负责人允许不上线**门户 `.next`。 +**前端发版**:先本地 `pnpm dev` 验收 `/social`;**未经负责人允许不上线**门户 `.next`。当前发版线:`test7`(H5 深优见根 `README.md`);下一轮 `test8`。 + +**H5(≤900px)**:`src/modules/social/app/h5.css` 最后加载;Ways 竖列表(群组聊天优先)、底栏聊天在「认识」左侧、滑卡/composer 避开 dock。 冒烟: - `https://nomadro.cn/social` → 200 +- `https://nomadro.cn/social/chat` · `/social/date` → 200(手机视口) - `https://mirotalk.nomadro.cn/join?...` → 200(勿再用 `.com`) - `GET /api/social/v1/health` → `centrifugo: true` - `GET /api/social/v1/realtime/token?channel_id=lobby`(头 `X-Social-Guest-Id`)→ `wsUrl` + JWT diff --git a/src/app/social/error.tsx b/src/app/social/error.tsx new file mode 100644 index 0000000..4d9e832 --- /dev/null +++ b/src/app/social/error.tsx @@ -0,0 +1,18 @@ +"use client"; + +import Link from "next/link"; +import { RefreshCw } from "lucide-react"; + +export default function SocialError({ reset }: { reset: () => void }) { + return ( +
+ +

页面暂时没能打开

+

请重试加载,当前设备中保存的草稿和收藏会继续保留。

+
+ + 返回社区首页 +
+
+ ); +} diff --git a/src/app/social/loading.tsx b/src/app/social/loading.tsx new file mode 100644 index 0000000..7a23b60 --- /dev/null +++ b/src/app/social/loading.tsx @@ -0,0 +1,10 @@ +export default function SocialLoading() { + return ( +
+

正在加载,请稍候…

+ +
+ ); +} diff --git a/src/app/social/meetup/[id]/page.tsx b/src/app/social/meetup/[id]/page.tsx index 7de0061..e51ed41 100644 --- a/src/app/social/meetup/[id]/page.tsx +++ b/src/app/social/meetup/[id]/page.tsx @@ -1,8 +1,6 @@ import MeetupLiveClient from "@social/components/MeetupLiveClient"; -import { SEED_MEETUPS } from "@social/lib/seed"; export default async function Page({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; - const meetupId = SEED_MEETUPS.some((m) => m.id === id) ? id : SEED_MEETUPS[0].id; - return ; + return ; } diff --git a/src/modules/social/README.md b/src/modules/social/README.md index 83c100e..7db48b3 100644 --- a/src/modules/social/README.md +++ b/src/modules/social/README.md @@ -20,7 +20,8 @@ - **交互**:粘性区块导航与当前位置、方向键筛选成员、关注本地保存;原生 `dialog` 管理视频与加群弹窗的焦点、Escape、背景锁定。 - **全站布局**:桌面为宽幅内容 + 顶部分组导航;移动端为顶部菜单 + 底部快捷入口。没有侧栏,聊天室频道也使用横向切换。 - **全站动效**:`SocialExperience` / `experience.css` 提供星点连线、鼠标柔光、漂移光晕、卡片聚光和页面入场;`interaction.css` / `studio.css` 提供声波、会前雷达、名片透视与书封动效。动效可切为轻量,系统减少动态效果设置优先;离开页面或标签页隐藏时清理/暂停动画。 -- **视觉终态层**:`depth.css` + `vivid.css`(最后加载)统一玻璃导航、快捷轨、约会进度、聊天跳转最新、咖啡馆主从、Meetup 雷达、触控 ≥44px;子页 `SocialQuickRail` 横向跳转。 +- **视觉终态层**:`depth.css` + `vivid.css` 统一玻璃导航、快捷轨、约会进度、聊天跳转最新、咖啡馆主从、Meetup 雷达、触控 ≥44px;子页 `SocialQuickRail` 横向跳转。 +- **H5(≤900px)**:`app/h5.css` **最后加载**;Ways 竖列表(群组聊天优先)、底栏「聊天」在「认识」左侧、滑卡/composer/加入 sheet 避开 dock + safe-area。 ## 子页面与交互边界 diff --git a/src/modules/social/app/h5.css b/src/modules/social/app/h5.css index 72861e9..ebf9a9f 100644 --- a/src/modules/social/app/h5.css +++ b/src/modules/social/app/h5.css @@ -491,7 +491,7 @@ /* —— Workspace pages —— */ .social-workspace { - padding: 12px 12px calc(96px + env(safe-area-inset-bottom, 0px)); + padding: 0; } .social-toolbar { display: flex; @@ -564,13 +564,11 @@ justify-content: center; } .social-people-cta-bar { - position: sticky; - bottom: calc(72px + env(safe-area-inset-bottom, 0px)); - z-index: 25; + position: static; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; - margin: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); + margin: 20px 0 0; padding: 10px; border-radius: 16px; background: color-mix(in srgb, var(--bg-card, #fff) 92%, transparent); @@ -610,6 +608,8 @@ .social-dialog[open] { display: flex; align-items: flex-end; + height: 100dvh; + max-height: 100dvh; } .social-dialog-sheet { width: 100%; @@ -1058,7 +1058,7 @@ flex-shrink: 0; } .social-profile-preview { - order: -1; /* preview first on phone so users see result while editing */ + order: 0; } .social-member-grid { grid-template-columns: 1fr; @@ -1072,7 +1072,7 @@ min-height: 40px; } .social-workspace { - padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); + padding-bottom: 0; } .social-page-intro { padding: 12px 14px 8px; @@ -1155,3 +1155,295 @@ margin-bottom: 4px; } } + +/* Shared page system: readable cards, resilient grids and keyboard access. */ +.social-experience :is(a, button, input, textarea, select, summary):focus-visible { + outline: 2px solid var(--sx-mint, #4ecdc4); + outline-offset: 4px; +} +.social-workspace .social-main > :is(section, article, div), +.social-workspace :is(.social-card, .social-panel, .social-profile-grid > *, .social-cafe-layout > *) { + min-width: 0; +} +.social-workspace :is(.social-card, .social-panel, .social-profile-card) { + overflow-wrap: anywhere; +} +.social-workspace :is(.social-grid, .social-event-grid) > .social-empty, +.social-people-grid > .social-empty { + grid-column: 1 / -1; + width: 100%; +} +.social-result-summary { + min-height: 44px; + display: flex; + justify-content: space-between; + align-items: center; + gap: 12px; + margin: 10px 0; + color: var(--text-secondary); + font-size: 13px; +} +.social-result-summary p { margin: 0; } +.social-result-summary button { min-height: 44px; } +.social-route-state { + display: grid; + justify-items: center; + align-content: center; + gap: 20px; + padding: 80px 24px; + min-height: 70dvh; + text-align: center; + color: var(--text-primary); +} +.social-route-state p { margin: 0; color: var(--text-secondary); } +.social-route-state h1 { font-size: clamp(24px, 4vw, 32px); margin: 0; } +.social-route-state-mark { font-size: 40px; } +.social-route-skeleton { width: min(100%, 600px); display: grid; gap: 16px; } +.social-route-skeleton span { min-height: 96px; border-radius: 20px; background: var(--bg-glass); border: 1px solid var(--sx-fog); } +html[data-theme="light"] .social-experience { + --text-muted: #596b80; + --sx-mint: #087f78; +} +html[data-theme="light"] .social-mobile-dock { + background: color-mix(in srgb, #ffffff 94%, transparent); + border-color: #24364b24; + box-shadow: 0 8px 32px #1428371a; +} +html[data-theme="light"] .social-mobile-dock a { color: #536477; } +html[data-theme="light"] .social-mobile-dock a[aria-current="page"] { + color: #08756f; + background: #0f8d8614; +} +.social-discovery-grid { + grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); + gap: 16px; +} +.social-discovery-grid .social-people-chip.is-rich { + grid-template-columns: 52px minmax(0, 1fr); + grid-template-rows: auto auto auto auto; + align-content: start; + justify-items: start; + align-items: center; + gap: 6px 14px; + padding: 20px; + min-height: 174px; + text-align: left; +} +.social-discovery-grid .social-people-chip-ava { grid-row: 1 / 3; } +.social-discovery-grid .social-people-chip strong { + grid-column: 2; + font-size: 16px; + white-space: normal; + overflow-wrap: anywhere; +} +.social-discovery-grid .connection-member-role { + grid-column: 2; + font-size: 12px; + line-height: 1.5; +} +.social-discovery-grid .social-people-chip > em { + grid-column: 1 / -1; + margin-top: 8px; + white-space: normal; + font-size: 12px; + color: var(--text-secondary); +} +.social-discovery-grid .social-people-chip-want { + grid-column: 1 / -1; + font-size: 13px; + line-height: 1.6; + -webkit-line-clamp: 2; + color: var(--text-secondary); +} +.social-dialog { + color: var(--text-primary); + width: min(560px, calc(100% - 40px)); + max-width: 560px; + max-height: min(90dvh, 900px); + margin: auto; + overflow: hidden; +} +.social-dialog-sheet { + display: flex; + flex-direction: column; + max-height: min(90dvh, 900px); + background: var(--bg-secondary, #101925); +} +.social-dialog-sheet > header { + display: flex; + justify-content: space-between; + align-items: center; + flex-shrink: 0; + gap: 16px; +} +.social-dialog-sheet > header h2 { margin: 0; font-size: 20px; } +.social-dialog-sheet > header button { + display: grid; + place-items: center; + flex: 0 0 44px; + width: 44px; + height: 44px; + border: 1px solid var(--sx-fog); + border-radius: 12px; + background: var(--bg-glass); + color: inherit; + cursor: pointer; +} +.social-dialog-body { + overflow-y: auto; + overscroll-behavior: contain; + min-height: 0; +} +.social-experience :is(.social-form, .social-dialog-body) :is(input, textarea, select) { + max-width: 100%; +} +.social-workspace :is(.social-profile, .social-cafe-detail, .social-library-card, .social-role-card) { + scroll-margin-top: calc(var(--nav-height, 72px) + 24px); +} +.social-chat-live .social-thread-wrap { + display: flex; + flex-direction: column; + min-height: 0; + overflow: hidden; + padding: 0; +} +.social-chat-live .social-chat-thread { + min-height: 0; + max-height: none; + height: 100%; + overflow-y: auto; +} +.social-chat-live .social-composer-toolbar { flex-wrap: nowrap; } +.social-chat-live .social-chat-composer textarea { + display: block; + width: 100%; + box-sizing: border-box; + color: var(--text-primary); + font-family: inherit; + line-height: 1.6; + resize: vertical; +} +.social-experience .social-form label.social-publish-toggle { + display: flex; + align-items: center; + min-height: 44px; + cursor: pointer; +} +.social-experience .social-form .social-publish-toggle input[type="checkbox"] { + appearance: auto; + flex: 0 0 20px; + width: 20px; + height: 20px; + min-height: 20px; + padding: 0; + margin: 0; + accent-color: var(--sx-mint); +} +.social-chat-live .social-composer-emoji { order: 0; } +.social-chat-live .social-nick-label { order: 1; white-space: nowrap; } +.social-chat-live .social-nick-label input { + border: 1px solid var(--sx-fog); + border-radius: 10px; + background: var(--sx-glass); + color: var(--text-primary); + padding: 8px; +} +.social-chat-live .social-composer-toolbar button[type="submit"] { order: 2; margin-left: auto; } +.social-date-root { + height: auto; + max-height: none; + overflow-x: clip; + overflow-y: visible; +} +.social-meetup-live .social-live-video { overflow-y: auto; overscroll-behavior: contain; } +.social-meetup-live .social-live-gate { flex: 1 0 auto; min-height: min-content; } +.social-live-iframe-overlay button { pointer-events: auto; } + +@media (min-width: 601px) and (max-width: 900px) { + .social-workspace :is(.social-role-grid, .social-library-grid, .social-event-grid) { + grid-template-columns: repeat(2, minmax(0, 1fr)) !important; + gap: 16px; + } +} +@media (max-width: 900px) { + .social-workspace.social-workspace-dense .social-workspace-grid { + min-height: 100dvh; + padding: calc(80px + env(safe-area-inset-top, 0px)) 16px calc(100px + env(safe-area-inset-bottom, 0px)); + } + .social-workspace .nav-container, .social-home .nav-container { + gap: 8px; + padding-inline: 10px; + min-width: 0; + } + .social-experience .social-brand-logo { min-width: 0; gap: 6px; } + .social-experience .nav-actions { flex-shrink: 0; gap: 4px; } + .social-experience :is(.nav-icon-btn, .mobile-menu-btn) { min-width: 44px; min-height: 44px; } + .social-workspace .nav-links.open, .social-home .nav-links.open { + top: calc(72px + env(safe-area-inset-top, 0px)); + max-height: calc(100dvh - 170px - env(safe-area-inset-top, 0px)); + overscroll-behavior: contain; + } + .social-experience .nav-group-panel a { min-height: 44px; } + .social-workspace .social-toolbar { align-items: stretch; } + .social-workspace .social-toolbar .social-search { width: 100%; max-width: none; } + .social-workspace .social-filters { max-width: 100%; padding: 4px 2px; } + .social-workspace .social-filters button { min-height: 44px; } + .social-workspace .social-grid .social-save { min-height: 44px; } + .social-composer-toolbar .social-nick-label { display: flex; flex: 0 1 130px; min-width: 0; } + .social-chat-live .social-chat-composer textarea { font-size: 16px; } + .social-composer-toolbar .social-nick-label input { min-width: 0; width: 100%; min-height: 44px; font-size: 16px; } + .social-mobile-dock[data-keyboard-open="true"] { display: none; } + .social-discovery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } + .social-discovery-grid .social-people-chip.is-rich { + grid-template-columns: minmax(0, 1fr); + justify-items: center; + text-align: center; + padding: 16px 12px; + gap: 7px; + min-height: 220px; + } + .social-discovery-grid .social-people-chip.is-rich > * { grid-column: 1; grid-row: auto; } + .social-discovery-grid .social-people-chip-ava { width: 52px; height: 52px; } + .social-discovery-grid .social-people-chip > em { margin-top: 2px; } + .social-discovery-grid .social-people-chip-want { font-size: 12px; } + .social-workspace .social-profile-studio { gap: 20px; } + .social-profile-preview { order: 0; } + .social-dialog { width: 100%; max-width: 100%; max-height: 100dvh; margin: 0; } + .social-dialog[open] { height: 100dvh; display: flex; align-items: flex-end; } + .social-dialog-sheet { max-height: 88dvh; border-bottom: 0; } + .social-workspace .social-people-cta-bar { position: static; } +} +@media (max-width: 380px) { + .social-experience .social-brand-section, + .social-experience .social-brand-sep { display: none; } + .social-experience .social-brand-name { font-size: 15px; } + .social-discovery-grid { grid-template-columns: minmax(0, 1fr); } + .social-discovery-grid .social-people-chip.is-rich { + grid-template-columns: 52px minmax(0, 1fr); + justify-items: start; + text-align: left; + min-height: 156px; + gap: 6px 12px; + } + .social-discovery-grid .social-people-chip-ava { grid-row: 1 / 3; } + .social-discovery-grid .social-people-chip :is(strong, .connection-member-role) { grid-column: 2; } + .social-discovery-grid .social-people-chip :is(em, .social-people-chip-want) { grid-column: 1 / -1; } +} +@media (max-height: 500px) { + .social-chat-live, .social-meetup-live { + height: auto; + max-height: none; + overflow: visible; + } + .social-chat-live .social-live-stage { flex: none; height: 420px; } + .social-meetup-live .social-live-stage { flex: none; height: 480px; } +} +@media (prefers-reduced-motion: reduce) { + .social-experience *, .social-experience *::before, .social-experience *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } + .social-experience .reveal { opacity: 1 !important; transform: none !important; } +} diff --git a/src/modules/social/app/vivid.css b/src/modules/social/app/vivid.css index 15ca56d..6236231 100644 --- a/src/modules/social/app/vivid.css +++ b/src/modules/social/app/vivid.css @@ -406,11 +406,11 @@ html[data-theme="light"] .social-workspace .nav-group-panel { .social-people-chip.is-rich { position: relative; + grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; - padding-right: 36px; } .social-people-chip-want { - grid-column: 2; + grid-column: 1 / -1; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; diff --git a/src/modules/social/components/AttractiveRoster.tsx b/src/modules/social/components/AttractiveRoster.tsx index 0cc661d..fd2533c 100644 --- a/src/modules/social/components/AttractiveRoster.tsx +++ b/src/modules/social/components/AttractiveRoster.tsx @@ -6,7 +6,6 @@ import { useMemo, useRef, useState, - useSyncExternalStore, } from "react"; import Link from "next/link"; import type { SocialRosterMember } from "@social/lib/rosterMock"; @@ -14,34 +13,11 @@ import { SELF_MEMBER_ID, useDiscoveryRoster, } from "@social/lib/discoveryRoster"; -import { loadJson, saveJson } from "@social/lib/storage"; +import { useRosterLikes, setRosterLike } from "@social/lib/useRosterLikes"; import { socialPath } from "@social/lib/socialPath"; import SocialAvatar from "./SocialAvatar"; import SectionSpark from "./SectionSpark"; -const LIKE_KEY = "social-roster-likes"; -const LIKES_CHANGED = "social-roster-likes-changed"; - -function subscribeLikes(callback: () => void) { - window.addEventListener("storage", callback); - window.addEventListener(LIKES_CHANGED, callback); - return () => { - window.removeEventListener("storage", callback); - window.removeEventListener(LIKES_CHANGED, callback); - }; -} - -function getLikesSnapshot() { - const stored = loadJson(LIKE_KEY, {}); - return JSON.stringify( - stored && typeof stored === "object" && !Array.isArray(stored) - ? stored - : {}, - ); -} - -const getServerLikes = () => "{}"; - const FILTERS = [ { id: "all" as const, label: "全部", emoji: "✨" }, { id: "online" as const, label: "在线", emoji: "🟢" }, @@ -51,15 +27,7 @@ const FILTERS = [ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) { const roster = useDiscoveryRoster(); - const likesSnapshot = useSyncExternalStore( - subscribeLikes, - getLikesSnapshot, - getServerLikes, - ); - const likes = useMemo( - () => JSON.parse(likesSnapshot) as Record, - [likesSnapshot], - ); + const likes = useRosterLikes(); const [filter, setFilter] = useState<"all" | "online" | "f" | "m">("all"); const [highlightId, setHighlightId] = useState(null); const [burst, setBurst] = useState(false); @@ -105,8 +73,7 @@ export default function AttractiveRoster({ onJoin }: { onJoin: () => void }) { ) => { event.preventDefault(); event.stopPropagation(); - saveJson(LIKE_KEY, { ...likes, [m.id]: !likes[m.id] }); - window.dispatchEvent(new Event(LIKES_CHANGED)); + setRosterLike(m.id, !likes[m.id]); setBurst(true); setHighlightId(m.id); if (burstTimer.current) clearTimeout(burstTimer.current); diff --git a/src/modules/social/components/CafeDirectory.tsx b/src/modules/social/components/CafeDirectory.tsx index 916ecd5..71fb420 100644 --- a/src/modules/social/components/CafeDirectory.tsx +++ b/src/modules/social/components/CafeDirectory.tsx @@ -28,6 +28,7 @@ import { EmptyState, PageIntro, SearchField, + ResultSummary, ShareButton, } from "./SocialUI"; import { socialApi } from "@social/lib/api"; @@ -56,8 +57,8 @@ 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 [text, setText] = useLocalState(`cafe-review-draft:${cafe.id}`, ""); + const [photoNote, setPhotoNote] = useLocalState(`cafe-review-note:${cafe.id}`, ""); const [status, setStatus] = useState(""); const [busy, setBusy] = useState(false); const lock = useRef(false); @@ -227,6 +228,7 @@ function CafeDetail({ cafe, id }: { cafe: SocialCafe; id: string }) {