From 99a7e33e776d5ed79d244f46db9e4c8d8130659f Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 6 Nov 2026 08:25:06 +0800 Subject: [PATCH] feat(web): adopt @usememos/ui as the design system (#6528) --- AGENTS.md | 25 +- web/components.json | 21 - web/index.html | 4 +- web/package.json | 5 +- web/pnpm-lock.yaml | 95 ++-- .../ActivityCalendar/CalendarCell.tsx | 12 +- .../ActivityCalendar/MonthCalendar.tsx | 14 +- .../components/ActivityCalendar/cellStyles.ts | 34 +- web/src/components/AppSidebar/AppSidebar.tsx | 99 ++-- .../AppSidebar/CommonSidebarContent.tsx | 3 +- .../components/AppSidebar/QuickFindDialog.tsx | 87 +-- .../AppSidebar/SidebarResizeHandle.tsx | 8 +- web/src/components/AppSidebar/SidebarRow.tsx | 39 +- .../components/AppSidebar/SidebarSection.tsx | 2 - .../AppSidebar/SidebarSectionHeader.tsx | 4 +- .../components/AppSidebar/SpaceSwitcher.tsx | 278 +++++----- web/src/components/AppSidebar/TagsSection.tsx | 58 +- .../components/AppSidebar/ViewsSection.tsx | 50 +- .../components/AppSidebar/sidebar-layout.ts | 24 +- web/src/components/AttachmentIcon.tsx | 116 ---- .../AttachmentLibrary/AttachmentFileRows.tsx | 33 +- .../AttachmentLibraryEmptyState.tsx | 10 +- .../AttachmentLibraryPrimitives.tsx | 42 +- .../AttachmentLibraryStates.tsx | 54 +- .../AttachmentLibraryToolbar.tsx | 38 +- .../AttachmentLibrary/AttachmentMediaGrid.tsx | 24 +- web/src/components/AttachmentLibrary/index.ts | 2 +- web/src/components/AuthPageLayout.tsx | 29 +- .../CalendarView/CalendarDayCell.tsx | 48 +- .../components/CalendarView/CalendarGrid.tsx | 2 +- .../CalendarView/CalendarHeader.tsx | 20 +- .../components/CalendarView/CalendarView.tsx | 6 +- .../components/CalendarView/MonthPicker.tsx | 56 +- .../components/ChangeMemberPasswordDialog.tsx | 57 +- web/src/components/ClampedSection.tsx | 17 +- web/src/components/ConfirmDialog/README.md | 4 +- web/src/components/ConfirmDialog/index.tsx | 28 +- .../components/CreateAccessTokenDialog.tsx | 84 +-- .../CreateIdentityProviderDialog.tsx | 106 ++-- web/src/components/CreateSpaceDialog.tsx | 73 ++- web/src/components/CreateUserDialog.tsx | 110 ++-- web/src/components/CreateWebhookDialog.tsx | 126 +++-- web/src/components/CredentialFields.tsx | 15 +- web/src/components/CustomIcon.tsx | 4 +- web/src/components/CustomIconPicker.tsx | 195 +++---- web/src/components/DateTimeInput.tsx | 12 +- web/src/components/ErrorBoundary.tsx | 49 +- web/src/components/IdentityLabel.tsx | 5 +- .../components/IdentityProviderButtons.tsx | 15 +- .../components/Inbox/MemoCommentMessage.tsx | 80 ++- .../components/Inbox/MemoMentionMessage.tsx | 84 ++- .../Inbox/SpaceInvitationMessage.tsx | 84 ++- web/src/components/LearnMore.tsx | 20 +- web/src/components/LocalePicker.tsx | 150 ++---- web/src/components/MapView/MapCanvas.tsx | 8 +- web/src/components/MapView/MapView.tsx | 66 +-- web/src/components/MediaMetadataDetails.tsx | 85 ++- .../MemoActionMenu/MemoActionMenu.tsx | 111 ++-- .../MemoActionMenu/MemoShareImageDialog.tsx | 82 +-- .../MemoActionMenu/MemoShareImagePreview.tsx | 16 +- web/src/components/MemoActionMenu/hooks.ts | 22 +- web/src/components/MemoCommentSection.tsx | 40 +- .../MemoDetailSidebar/MemoDetailSidebar.tsx | 53 +- .../MemoDetailSidebar/MemoOutline.tsx | 8 +- .../MemoDetailSidebar/MemoSharePanel.tsx | 123 +++-- web/src/components/MemoDisplaySettingMenu.tsx | 236 +++------ web/src/components/MemoEditor/MemoEditor.tsx | 11 +- .../MemoEditor/edit/EditSession.tsx | 30 +- web/src/components/MemoEditor/edit/Editor.tsx | 2 +- .../MemoEditor/edit/Toolbar/AudienceMenu.tsx | 135 +++-- .../MemoEditor/edit/Toolbar/EditorToolbar.tsx | 83 ++- .../MemoEditor/edit/Toolbar/InsertMenu.tsx | 64 ++- .../edit/components/AudioRecorderPanel.tsx | 101 ++-- .../edit/components/EditorSuggestions.tsx | 12 +- .../edit/components/FocusModeOverlay.tsx | 12 +- .../edit/components/TimestampPopover.tsx | 20 +- .../edit/components/VoiceWaveform.tsx | 2 +- .../components/MemoEditor/edit/constants.ts | 4 +- web/src/components/MemoEditor/edit/editor.css | 58 +- .../edit/hooks/useAttachmentTranscription.ts | 8 +- .../MemoEditor/edit/hooks/useAudioRecorder.ts | 8 +- .../edit/hooks/useInlineImageUpload.ts | 4 +- .../MemoEditor/edit/hooks/useMemoSave.ts | 10 +- .../MemoEditor/edit/services/errorService.ts | 7 +- .../MemoEditor/edit/types/components.ts | 3 + .../MemoEditor/view/LinkMetadataCard.tsx | 12 +- .../MemoEditor/view/MemoContentView.tsx | 2 +- web/src/components/MemoFilters.tsx | 20 +- .../Attachment/AttachmentCard.tsx | 6 +- .../Attachment/AttachmentListEditor.tsx | 133 ++--- .../Attachment/AttachmentListView.tsx | 65 ++- .../Attachment/AudioAttachmentItem.tsx | 96 ++-- .../Attachment/attachmentVisualClasses.ts | 16 +- .../MemoMetadata/Location/LocationDialog.tsx | 60 +-- .../Location/LocationDisplayEditor.tsx | 4 +- .../Location/LocationDisplayView.tsx | 28 +- .../MemoMetadata/MetadataSection.tsx | 56 +- .../MemoMetadata/Relation/LinkMemoDialog.tsx | 37 +- .../Relation/RelationListEditor.tsx | 2 +- .../MemoMetadata/Relation/RelationRow.tsx | 30 +- web/src/components/MemoPanel/MemoPanel.tsx | 21 +- .../components/MemoPanel/MemoPanelList.tsx | 22 +- web/src/components/MemoParentPlaceholder.tsx | 4 +- .../components/MemoPreview/MemoPreview.tsx | 29 +- .../MemoReactionListView/ReactionSelector.tsx | 36 +- .../MemoReactionListView/ReactionView.tsx | 43 +- web/src/components/MemoView/MemoView.tsx | 5 +- .../MemoView/components/MemoBody.tsx | 12 +- .../components/MemoCommentListView.tsx | 64 +-- .../MemoView/components/MemoHeader.tsx | 96 ++-- .../MemoView/components/MemoPinnedMark.tsx | 17 +- .../MemoView/components/MemoSpaceBadge.tsx | 16 +- web/src/components/MemoView/constants.ts | 7 +- web/src/components/MemoView/types.ts | 2 + web/src/components/MemosLogo.tsx | 2 +- web/src/components/MotionPhotoPreview.tsx | 8 +- .../components/PagedMemoList/EmptyLine.tsx | 8 +- .../PagedMemoList/MemoListError.tsx | 12 +- .../PagedMemoList/PagedMemoList.tsx | 30 +- web/src/components/PasswordSignInForm.tsx | 12 +- web/src/components/Placeholder/index.tsx | 2 +- web/src/components/PreviewImageDialog.tsx | 435 +++++++-------- web/src/components/RequiredBadge.tsx | 11 - web/src/components/Settings/AISection.tsx | 238 +++++---- .../Settings/AccessTokenSection.tsx | 140 ++--- .../Settings/ConfigurationSection.tsx | 4 +- web/src/components/Settings/EditorSection.tsx | 4 +- web/src/components/Settings/InfoChip.tsx | 27 +- .../components/Settings/InstanceSection.tsx | 42 +- .../Settings/InviteSpaceMemberDialog.tsx | 130 +++-- .../Settings/LinkedIdentitySection.tsx | 36 +- web/src/components/Settings/MemberSection.tsx | 81 +-- .../components/Settings/MemoExportSection.tsx | 64 ++- .../Settings/MemoRelatedSettings.tsx | 64 ++- .../components/Settings/MyAccountSection.tsx | 46 +- .../Settings/NotificationSection.tsx | 30 +- .../Settings/PreferencesSection.tsx | 23 +- .../Settings/ResourceStatsSection.tsx | 21 +- web/src/components/Settings/SSOSection.tsx | 58 +- web/src/components/Settings/SectionChip.tsx | 37 -- .../components/Settings/SectionMenuItem.tsx | 28 - web/src/components/Settings/SettingGroup.tsx | 18 +- web/src/components/Settings/SettingList.tsx | 94 ++-- web/src/components/Settings/SettingRow.tsx | 36 +- .../components/Settings/SettingSection.tsx | 11 +- web/src/components/Settings/SettingTable.tsx | 103 ++-- web/src/components/Settings/SpacesSection.tsx | 499 +++++++++--------- .../components/Settings/StorageSection.tsx | 128 ++--- web/src/components/Settings/TagsSection.tsx | 175 +++--- .../components/Settings/UsageLimitDialog.tsx | 121 ++--- .../Settings/UsageLimitsSection.tsx | 104 ++-- .../components/Settings/UserStatsSection.tsx | 2 +- .../components/Settings/WebhookSection.tsx | 55 +- web/src/components/Settings/useExportMemos.ts | 8 +- .../Settings/useInstanceSettingUpdater.ts | 6 +- web/src/components/SpaceIcon.tsx | 10 +- web/src/components/SpaceMark.tsx | 7 +- web/src/components/SpaceRoleBadge.tsx | 8 +- web/src/components/SpaceSelectItem.tsx | 6 +- .../StatisticsView/MonthNavigator.tsx | 40 +- .../StatisticsView/StatisticsView.tsx | 2 +- web/src/components/TagTree.tsx | 10 +- web/src/components/ThemeSelect.tsx | 41 +- web/src/components/UpdateAccountDialog.tsx | 128 ++--- .../UpdateCustomizedProfileDialog.tsx | 75 ++- web/src/components/UserAvatar.tsx | 6 +- web/src/components/UserMenu.tsx | 142 +++-- web/src/components/VisibilityIcon.tsx | 2 +- .../WelcomeGuide/WelcomeGuideDialog.tsx | 150 +++--- web/src/components/WelcomeGuide/headers.tsx | 70 ++- web/src/components/kit/OverflowTip.tsx | 36 -- web/src/components/map/LazyLocationPicker.tsx | 2 +- web/src/components/map/LocationPicker.tsx | 39 +- web/src/components/map/map-utils.tsx | 4 +- web/src/components/ui/README.md | 58 -- web/src/components/ui/badge.tsx | 35 -- web/src/components/ui/button.tsx | 61 --- web/src/components/ui/checkbox.tsx | 28 - web/src/components/ui/dialog.tsx | 116 ---- web/src/components/ui/dropdown-menu.tsx | 291 ---------- web/src/components/ui/focus.ts | 11 - web/src/components/ui/input.tsx | 20 - web/src/components/ui/label.tsx | 17 - web/src/components/ui/popover.tsx | 48 -- web/src/components/ui/popup.ts | 15 - web/src/components/ui/radio-group.tsx | 30 -- web/src/components/ui/select.tsx | 176 ------ web/src/components/ui/separator.tsx | 18 - web/src/components/ui/sheet.tsx | 114 ---- web/src/components/ui/switch.tsx | 27 - web/src/components/ui/tabs.tsx | 104 ---- web/src/components/ui/textarea.tsx | 19 - web/src/components/ui/tooltip.tsx | 50 -- web/src/components/ui/visually-hidden.tsx | 19 - web/src/contexts/GlobalMemoEditorContext.tsx | 11 +- web/src/hooks/useFieldErrors.ts | 20 + web/src/hooks/useMemoDetailError.ts | 6 +- web/src/hooks/useSourceMode.ts | 4 +- web/src/index.css | 48 +- web/src/layouts/RootLayout.tsx | 15 +- web/src/lib/error.ts | 23 +- web/src/lib/markdownStyles.ts | 33 +- web/src/lib/memo-markdown.ts | 32 +- web/src/lib/sanitized-html.ts | 2 +- web/src/lib/toast.ts | 13 + web/src/locales/ar.json | 245 ++++++++- web/src/locales/az.json | 243 ++++++++- web/src/locales/bg.json | 241 ++++++++- web/src/locales/ca.json | 242 ++++++++- web/src/locales/cs.json | 243 ++++++++- web/src/locales/da.json | 241 ++++++++- web/src/locales/de.json | 241 ++++++++- web/src/locales/el.json | 241 ++++++++- web/src/locales/en-GB.json | 241 ++++++++- web/src/locales/en.json | 243 ++++++++- web/src/locales/es.json | 242 ++++++++- web/src/locales/et.json | 241 ++++++++- web/src/locales/fa.json | 241 ++++++++- web/src/locales/fi.json | 241 ++++++++- web/src/locales/fr.json | 242 ++++++++- web/src/locales/gl.json | 241 ++++++++- web/src/locales/he.json | 241 ++++++++- web/src/locales/hi.json | 241 ++++++++- web/src/locales/hr.json | 242 ++++++++- web/src/locales/hu.json | 241 ++++++++- web/src/locales/id.json | 241 ++++++++- web/src/locales/it.json | 242 ++++++++- web/src/locales/ja.json | 241 ++++++++- web/src/locales/ka-GE.json | 241 ++++++++- web/src/locales/ko.json | 241 ++++++++- web/src/locales/lt.json | 243 ++++++++- web/src/locales/lv.json | 242 ++++++++- web/src/locales/mr.json | 241 ++++++++- web/src/locales/nb.json | 241 ++++++++- web/src/locales/nl.json | 241 ++++++++- web/src/locales/nn.json | 243 ++++++++- web/src/locales/pl.json | 243 ++++++++- web/src/locales/pt-BR.json | 242 ++++++++- web/src/locales/pt-PT.json | 242 ++++++++- web/src/locales/ro.json | 242 ++++++++- web/src/locales/ru.json | 243 ++++++++- web/src/locales/sk.json | 243 ++++++++- web/src/locales/sl.json | 243 ++++++++- web/src/locales/sr.json | 242 ++++++++- web/src/locales/sv.json | 241 ++++++++- web/src/locales/th.json | 241 ++++++++- web/src/locales/tr.json | 243 ++++++++- web/src/locales/uk.json | 243 ++++++++- web/src/locales/vi.json | 241 ++++++++- web/src/locales/zh-Hans.json | 241 ++++++++- web/src/locales/zh-Hant.json | 241 ++++++++- web/src/main.tsx | 30 +- web/src/pages/About.tsx | 53 +- web/src/pages/AdminSignIn.tsx | 8 +- web/src/pages/Archived.tsx | 4 +- web/src/pages/Attachments.tsx | 45 +- web/src/pages/AuthCallback.tsx | 6 +- web/src/pages/Home.tsx | 2 +- web/src/pages/Inboxes.tsx | 12 +- web/src/pages/MemoDetail.tsx | 4 +- web/src/pages/MemoViews.tsx | 335 ++++++------ web/src/pages/NotFound.tsx | 7 +- web/src/pages/PermissionDenied.tsx | 7 +- web/src/pages/SignIn.tsx | 14 +- web/src/pages/SignUp.tsx | 28 +- web/src/router/SpaceRoute.tsx | 11 +- web/src/themes/COLOR_GUIDE.md | 310 ----------- web/src/themes/README.md | 18 + web/src/themes/default-dark.css | 56 -- web/src/themes/default.css | 124 +---- web/src/themes/paper.css | 83 +-- web/src/utils/i18n.ts | 9 +- web/src/utils/theme.ts | 104 ++-- web/tests/app-sidebar-logo.test.tsx | 48 +- .../attachment-gallery-keyboard.test.tsx | 27 + .../attachment-transcription-action.test.tsx | 3 +- web/tests/audience-menu.test.tsx | 10 +- .../calendar-cell-empty-clickable.test.tsx | 15 +- web/tests/calendar-day-snapshot.test.tsx | 29 +- web/tests/create-space-dialog.test.tsx | 11 +- web/tests/create-webhook-dialog.test.tsx | 4 +- web/tests/dropdown-menu-size.test.tsx | 70 --- web/tests/editor-commit-button.test.tsx | 7 +- web/tests/editor.test.tsx | 22 +- web/tests/error-info.test.ts | 6 +- web/tests/icon-sizes.test.ts | 65 +++ web/tests/insert-menu.test.tsx | 8 +- web/tests/instance-section-access.test.tsx | 10 +- web/tests/invite-space-member-dialog.test.tsx | 35 +- web/tests/locale-picker.test.tsx | 24 +- web/tests/location-picker.test.tsx | 1 + web/tests/map-canvas.test.tsx | 2 +- web/tests/map-view.test.tsx | 13 +- web/tests/memo-action-menu.test.tsx | 4 +- web/tests/memo-action-navigation.test.tsx | 4 +- web/tests/memo-body-compact.test.tsx | 1 + web/tests/memo-comment-section.test.tsx | 2 +- web/tests/memo-detail-access.test.tsx | 2 +- web/tests/memo-detail-sidebar.test.tsx | 2 +- web/tests/memo-display-setting-menu.test.tsx | 26 +- web/tests/memo-editor-source-mode.test.tsx | 2 +- web/tests/memo-editor-transcription.test.tsx | 3 +- web/tests/memo-editor-upload-retry.test.tsx | 2 +- web/tests/memo-header-navigation.test.tsx | 29 +- web/tests/memo-related-settings.test.tsx | 7 +- web/tests/memo-space-badge.test.tsx | 2 +- web/tests/memo-view-icons.test.tsx | 40 +- web/tests/paged-memo-list.test.tsx | 7 +- web/tests/paper-theme.test.ts | 96 ++++ web/tests/preview-image-dialog.test.tsx | 29 +- web/tests/quick-find-navigation.test.tsx | 32 +- web/tests/reaction-selector.test.tsx | 2 +- web/tests/select.test.tsx | 36 -- web/tests/setup.ts | 10 + web/tests/sidebar-row-grammar.test.tsx | 6 +- web/tests/sidebar-row-state.test.tsx | 21 +- web/tests/sign-in-page.test.tsx | 2 +- web/tests/space-icon-picker.test.tsx | 59 ++- web/tests/space-invitation-message.test.tsx | 9 +- web/tests/space-switcher.test.tsx | 6 +- web/tests/spaces-section.test.tsx | 6 +- web/tests/sso-auth-pages.test.tsx | 14 +- web/tests/switch.test.tsx | 16 - web/tests/tabs.test.tsx | 73 --- web/tests/tags-section.test.tsx | 5 +- web/tests/theme.test.ts | 12 +- web/tests/type-roles.test.ts | 72 +++ web/tests/usage-limit-errors.test.ts | 6 +- web/tests/usage-limits-settings.test.tsx | 21 +- .../use-attachment-transcription.test.tsx | 12 +- web/tests/use-inline-image-upload.test.tsx | 2 +- web/tests/user-avatar.test.tsx | 2 +- web/tests/user-menu.test.tsx | 66 ++- web/tests/user-theme.test.tsx | 4 +- 334 files changed, 15849 insertions(+), 7925 deletions(-) delete mode 100644 web/components.json delete mode 100644 web/src/components/AttachmentIcon.tsx delete mode 100644 web/src/components/RequiredBadge.tsx delete mode 100644 web/src/components/Settings/SectionChip.tsx delete mode 100644 web/src/components/Settings/SectionMenuItem.tsx delete mode 100644 web/src/components/kit/OverflowTip.tsx delete mode 100644 web/src/components/ui/README.md delete mode 100644 web/src/components/ui/badge.tsx delete mode 100644 web/src/components/ui/button.tsx delete mode 100644 web/src/components/ui/checkbox.tsx delete mode 100644 web/src/components/ui/dialog.tsx delete mode 100644 web/src/components/ui/dropdown-menu.tsx delete mode 100644 web/src/components/ui/focus.ts delete mode 100644 web/src/components/ui/input.tsx delete mode 100644 web/src/components/ui/label.tsx delete mode 100644 web/src/components/ui/popover.tsx delete mode 100644 web/src/components/ui/popup.ts delete mode 100644 web/src/components/ui/radio-group.tsx delete mode 100644 web/src/components/ui/select.tsx delete mode 100644 web/src/components/ui/separator.tsx delete mode 100644 web/src/components/ui/sheet.tsx delete mode 100644 web/src/components/ui/switch.tsx delete mode 100644 web/src/components/ui/tabs.tsx delete mode 100644 web/src/components/ui/textarea.tsx delete mode 100644 web/src/components/ui/tooltip.tsx delete mode 100644 web/src/components/ui/visually-hidden.tsx create mode 100644 web/src/hooks/useFieldErrors.ts create mode 100644 web/src/lib/toast.ts delete mode 100644 web/src/themes/COLOR_GUIDE.md create mode 100644 web/src/themes/README.md delete mode 100644 web/src/themes/default-dark.css create mode 100644 web/tests/attachment-gallery-keyboard.test.tsx delete mode 100644 web/tests/dropdown-menu-size.test.tsx create mode 100644 web/tests/icon-sizes.test.ts create mode 100644 web/tests/paper-theme.test.ts delete mode 100644 web/tests/select.test.tsx delete mode 100644 web/tests/switch.test.tsx delete mode 100644 web/tests/tabs.test.tsx create mode 100644 web/tests/type-roles.test.ts diff --git a/AGENTS.md b/AGENTS.md index 5716713e3..dae4700a5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ repo. If a fact here conflicts with source files or CI config, trust the source Memos is a self-hosted note-taking app. - Backend: Go 1.27.2, net/http, Connect RPC, gRPC-Gateway, Protocol Buffers. -- Frontend: React 19, TypeScript 7, Vite 8, Tailwind CSS v4, React Query v5. +- Frontend: React 19, TypeScript 7, Vite 8, Tailwind CSS v4, `@usememos/ui` on Base UI, React Query v5. - Storage: SQLite, MySQL, PostgreSQL. - Generated API outputs: `proto/gen/` for Go/OpenAPI, `web/src/types/proto/` for TypeScript. @@ -51,7 +51,7 @@ golangci-lint run --fix # Auto-fix lint, including goimports # Frontend cd web && pnpm install # Install dependencies -cd web && pnpm dev # Dev server on :3001, proxying API to :8081 +cd web && pnpm dev # Dev server on :3001, proxying API to :8081 (or $DEV_PROXY_SERVER) cd web && pnpm lint # Type check + Biome lint cd web && pnpm test # Vitest unit tests cd web && pnpm build # Production build @@ -83,7 +83,7 @@ Every root folder is named for what it holds. Read the folder's `doc.go` or `REA | `provider/` | Backends configured by instance settings: `ai`, `idp`, `storage` | proto/gen, internal | | `internal/` | Private plumbing with no memos vocabulary (`identifier`, `email`, `webhook`, `ratelimit`, …) | third party only | | `proto/api/`, `proto/store/` | Public API and internal storage proto sources; `proto/gen/` is generated | | -| `web/src/` | React SPA: `connect.ts` clients, `auth-state.ts`, `hooks/`, `contexts/`, `components/`, `themes/` | | +| `web/src/` | React SPA: `connect.ts` clients, `auth-state.ts`, `hooks/`, `contexts/`, `components/`, `lib/`, `locales/`, `themes/` | | Layering rules, enforced by `depguard` in `.golangci.yaml`: @@ -126,9 +126,24 @@ Black-box service tests live in `server/api/test/`, unit tests next to the code. - Follow Biome formatting: 2-space indent, double quotes, semicolons, 140-character line width. - Put server data in React Query hooks under `web/src/hooks/`; keep UI-only state in contexts or component state. - Show, edit and compose memos through `web/src/components/MemoEditor` (a name or draft seed plus a mode); see its `README.md`. -- Use Tailwind CSS v4 utilities, `cn()` for class merging, and CVA for variants. -- Reuse Base UI primitives and existing components before adding new UI primitives. - Keep generated proto TypeScript under `web/src/types/proto/` out of manual edits and Biome rewrites. +- UI work reads `web/node_modules/@usememos/ui/llms.txt` first: `@usememos/ui` is the design system (tokens, type classes, + components). Controls come from the package; build a part it lacks on Base UI as its `custom-components.md` describes. +- Use a package component when one fits (`Button`, `Link`, `Spinner`, `Badge`). Its class functions (`buttonClasses()`, + `menuClasses()`, `badgeClasses()`) are for elements it can't render, such as a router link or a Base UI trigger. +- Style with Tailwind CSS v4 and the package's `mu-` utilities (`bg-mu-surface`, `text-mu-ink-muted`, `rounded-mu-md`), + text with its type classes (`mu-caption`, `mu-body`, `mu-label`, `mu-title`), and `cn()` for class merging. No Tailwind + text sizes or old color names (`muted-foreground`, `destructive`, `popover`). The exceptions are the brand wordmark and + emoji glyphs, whose font size is their icon box (`SpaceIcon`, `SpaceMark`, `MemoViewIcon`, `CustomIconPicker`). +- Focus shows through `mu-focus`. Never add `ring-*` or `focus-visible:ring-*`, and never pair `mu-focus` with + `outline-none`, which overrides it. Visually hidden text uses `mu-visually-hidden`; a control that appears on focus keeps + Tailwind's `sr-only focus-visible:not-sr-only` pair. +- Report failures with `showErrorToast` from `web/src/lib/toast.ts`. A form's own validation errors go under the field + (`Field.Error`, kept in `useFieldErrors`), not in a toast. +- Every new key in `web/src/locales/en.json` is translated into all locales; `tests/locale-resources.test.ts` fails + otherwise. A plural message is stored as `key_one`, `key_other`, … and looked up by its base key with `count`. +- Lucide icons outside a package control take a size class that sets box and stroke together: `mu-icon-xs` (12px), + `mu-icon-sm` (14px) or `mu-icon` (16px). No Tailwind sizes on 12–16px icons and no `strokeWidth`. ## Database And Proto Rules diff --git a/web/components.json b/web/components.json deleted file mode 100644 index 2082f482a..000000000 --- a/web/components.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "new-york", - "rsc": false, - "tsx": true, - "tailwind": { - "config": "", - "css": "src/index.css", - "baseColor": "zinc", - "cssVariables": true, - "prefix": "" - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", - "lib": "@/lib", - "hooks": "@/hooks" - }, - "iconLibrary": "lucide" -} \ No newline at end of file diff --git a/web/index.html b/web/index.html index 321a36eef..ffe06d8ba 100644 --- a/web/index.html +++ b/web/index.html @@ -9,8 +9,8 @@ - - + + diff --git a/web/package.json b/web/package.json index 8dcd34e53..738cfe612 100644 --- a/web/package.json +++ b/web/package.json @@ -17,7 +17,7 @@ "test:coverage": "vitest run --coverage" }, "dependencies": { - "@base-ui/react": "^1.7.0", + "@base-ui/react": "1.9.0", "@connectrpc/connect": "^2.1.1", "@connectrpc/connect-web": "^2.1.1", "@github/relative-time-element": "^5.0.0", @@ -27,6 +27,7 @@ "@tanstack/react-query": "^5.100.9", "@tanstack/react-query-devtools": "^5.100.9", "@usememos/editor": "26.11.0", + "@usememos/ui": "26.11.7", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "copy-to-clipboard": "^4.0.2", @@ -44,7 +45,6 @@ "pele": "1.13.0", "react": "^19.2.6", "react-dom": "^19.2.6", - "react-hot-toast": "^2.6.0", "react-i18next": "^17.0.11", "react-leaflet": "^5.0.0", "react-leaflet-cluster": "^4.1.3", @@ -69,7 +69,6 @@ "@vitejs/plugin-react": "^6.0.1", "babel-plugin-react-compiler": "1.0.0", "jsdom": "^29.1.1", - "tw-animate-css": "^1.4.0", "typescript": "^7.0.2", "vite": "^8.0.11", "vitest": "^4.1.5" diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index f44b447f9..ce0713234 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: .: dependencies: '@base-ui/react': - specifier: ^1.7.0 - version: 1.7.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: 1.9.0 + version: 1.9.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@connectrpc/connect': specifier: ^2.1.1 version: 2.1.1(@bufbuild/protobuf@2.12.0(patch_hash=9d60cec35402ba36bc21a72fefc68ccef8db0acb883504cc47c05a00a0029f8c)) @@ -41,6 +41,9 @@ importers: '@usememos/editor': specifier: 26.11.0 version: 26.11.0(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + '@usememos/ui': + specifier: 26.11.7 + version: 26.11.7(@base-ui/react@1.9.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(lucide-react@1.34.0(react@19.2.6))(react-dom@19.2.6(react@19.2.6))(react@19.2.6) class-variance-authority: specifier: ^0.7.1 version: 0.7.1 @@ -92,9 +95,6 @@ importers: react-dom: specifier: ^19.2.6 version: 19.2.6(react@19.2.6) - react-hot-toast: - specifier: ^2.6.0 - version: 2.6.0(react-dom@19.2.6(react@19.2.6))(react@19.2.6) react-i18next: specifier: ^17.0.11 version: 17.0.11(i18next@26.3.6(typescript@7.0.2))(react-dom@19.2.6(react@19.2.6))(react@19.2.6)(typescript@7.0.2) @@ -162,9 +162,6 @@ importers: jsdom: specifier: ^29.1.1 version: 29.1.1 - tw-animate-css: - specifier: ^1.4.0 - version: 1.4.0 typescript: specifier: ^7.0.2 version: 7.0.2 @@ -278,8 +275,8 @@ packages: resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==} engines: {node: '>=6.9.0'} - '@base-ui/react@1.7.0': - resolution: {integrity: sha512-j+8QjX44C32jrXD/qyEAGpFr70FRpGL2CY61mQd9nBPWN737CK0xxD1ceJ055rW4RtdvFDT1e7otzdlfxvsYug==} + '@base-ui/react@1.9.0': + resolution: {integrity: sha512-S8CSYosASBKtpL8SWUfS78rFElfLijiCgA7oHOK22jCJ95FULsYyKwBNFOgudt0RA+/7yNc7F81bOvQnRgbBiQ==} engines: {node: '>=14.0.0'} peerDependencies: '@date-fns/tz': ^1.2.0 @@ -295,8 +292,8 @@ packages: date-fns: optional: true - '@base-ui/utils@0.3.2': - resolution: {integrity: sha512-oWy1aq/I2GmYjpl4PhEAhzflF8VPGKgZeq0xAWTbfD5KBWyxcN0ZP2+WHSUm/5Z6lVMBDLReLcoXwSYoRc/zNQ==} + '@base-ui/utils@0.5.0': + resolution: {integrity: sha512-dYGGcEttjkYiMoa5nHm8vLaJ2UcuTWxo3BFAwOYXeRg/q7UVVvA6cacEIXEs3FgBfK1CGtW1ptElqs7wsx+t9A==} peerDependencies: '@types/react': ^17 || ^18 || ^19 react: ^17 || ^18 || ^19 @@ -962,6 +959,14 @@ packages: react-dom: optional: true + '@usememos/ui@26.11.7': + resolution: {integrity: sha512-DwDZMoBSNLuPb841L9E6P9++URgAeoekKIRgqdPzDqZt7/gZsp8TtuaF6pkuQabC4yvXU4VsnPmU4/O0iwrB7g==} + peerDependencies: + '@base-ui/react': 1.9.0 + lucide-react: '>=1.0.0' + react: '>=18' + react-dom: '>=18' + '@vitejs/plugin-react@6.0.1': resolution: {integrity: sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1165,11 +1170,6 @@ packages: gl-matrix@3.4.4: resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==} - goober@2.1.18: - resolution: {integrity: sha512-2vFqsaDVIT9Gz7N6kAL++pLpp41l3PfDuusHcjnGLfR6+huZkl6ziX+zgVC3ZxpqWhzH6pyDdGrCeDhMIvwaxw==} - peerDependencies: - csstype: ^3.0.10 - graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -1416,13 +1416,6 @@ packages: peerDependencies: react: ^19.2.6 - react-hot-toast@2.6.0: - resolution: {integrity: sha512-bH+2EBMZ4sdyou/DPrfgIouFpcRLCJ+HoCA32UoAYHn6T3Ur5yfcDCeSr5mwldl6pFOsiocmrXMuoCJ1vV8bWg==} - engines: {node: '>=10'} - peerDependencies: - react: '>=16' - react-dom: '>=16' - react-i18next@17.0.11: resolution: {integrity: sha512-cDtkXgxjuFTWUH6V+aQn1Ve5vDiUztCNPWW5GtSHDccsgRXO1nE6QFWCEmc1KAutrb3OUv87wFShJL5RhUwPXg==} peerDependencies: @@ -1487,8 +1480,8 @@ packages: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - reselect@5.2.0: - resolution: {integrity: sha512-AgZ3UOZm3YndfrJ4OYjgrT7bmCm/1iqkjvEfH/oYjzh6PD2qw4QuT3jjnXIrpdt4MTpMXclMT3lXbmRY+XRakw==} + reselect@5.3.0: + resolution: {integrity: sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg==} resolve-protobuf-schema@2.1.0: resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==} @@ -1578,9 +1571,6 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tw-animate-css@1.4.0: - resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==} - typescript@7.0.2: resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} engines: {node: '>=16.20.0'} @@ -1604,6 +1594,11 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + use-sync-external-store@1.7.0: + resolution: {integrity: sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + uuid@11.1.0: resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==} hasBin: true @@ -1859,26 +1854,26 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@base-ui/react@1.7.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + '@base-ui/react@1.9.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: - '@babel/runtime': 7.29.2 - '@base-ui/utils': 0.3.2(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + '@babel/runtime': 7.29.7 + '@base-ui/utils': 0.5.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@floating-ui/react-dom': 2.1.9(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@floating-ui/utils': 0.2.12 react: 19.2.6 react-dom: 19.2.6(react@19.2.6) - use-sync-external-store: 1.6.0(react@19.2.6) + use-sync-external-store: 1.7.0(react@19.2.6) optionalDependencies: '@types/react': 19.2.14 - '@base-ui/utils@0.3.2(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + '@base-ui/utils@0.5.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: - '@babel/runtime': 7.29.2 + '@babel/runtime': 7.29.7 '@floating-ui/utils': 0.2.12 react: 19.2.6 react-dom: 19.2.6(react@19.2.6) - reselect: 5.2.0 - use-sync-external-store: 1.6.0(react@19.2.6) + reselect: 5.3.0 + use-sync-external-store: 1.7.0(react@19.2.6) optionalDependencies: '@types/react': 19.2.14 @@ -2378,6 +2373,13 @@ snapshots: react: 19.2.6 react-dom: 19.2.6(react@19.2.6) + '@usememos/ui@26.11.7(@base-ui/react@1.9.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(lucide-react@1.34.0(react@19.2.6))(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + dependencies: + '@base-ui/react': 1.9.0(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + lucide-react: 1.34.0(react@19.2.6) + react: 19.2.6 + react-dom: 19.2.6(react@19.2.6) + '@vitejs/plugin-react@6.0.1(@rolldown/plugin-babel@0.2.3(@babel/core@7.29.0)(@babel/runtime@7.29.7)(rolldown@1.0.0-rc.18)(vite@8.0.11(@types/node@24.12.2)(jiti@2.6.1)))(babel-plugin-react-compiler@1.0.0)(vite@8.0.11(@types/node@24.12.2)(jiti@2.6.1))': dependencies: '@rolldown/pluginutils': 1.0.0-rc.7 @@ -2545,10 +2547,6 @@ snapshots: gl-matrix@3.4.4: {} - goober@2.1.18(csstype@3.2.3): - dependencies: - csstype: 3.2.3 - graceful-fs@4.2.11: {} html-encoding-sniffer@6.0.0: @@ -2761,13 +2759,6 @@ snapshots: react: 19.2.6 scheduler: 0.27.0 - react-hot-toast@2.6.0(react-dom@19.2.6(react@19.2.6))(react@19.2.6): - dependencies: - csstype: 3.2.3 - goober: 2.1.18(csstype@3.2.3) - react: 19.2.6 - react-dom: 19.2.6(react@19.2.6) - react-i18next@17.0.11(i18next@26.3.6(typescript@7.0.2))(react-dom@19.2.6(react@19.2.6))(react@19.2.6)(typescript@7.0.2): dependencies: '@babel/runtime': 7.29.2 @@ -2820,7 +2811,7 @@ snapshots: require-from-string@2.0.2: {} - reselect@5.2.0: {} + reselect@5.3.0: {} resolve-protobuf-schema@2.1.0: dependencies: @@ -2907,8 +2898,6 @@ snapshots: tslib@2.8.1: optional: true - tw-animate-css@1.4.0: {} - typescript@7.0.2: optionalDependencies: '@typescript/typescript-aix-ppc64': 7.0.2 @@ -2946,6 +2935,10 @@ snapshots: dependencies: react: 19.2.6 + use-sync-external-store@1.7.0(react@19.2.6): + dependencies: + react: 19.2.6 + uuid@11.1.0: {} vite@8.0.11(@types/node@24.12.2)(jiti@2.6.1): diff --git a/web/src/components/ActivityCalendar/CalendarCell.tsx b/web/src/components/ActivityCalendar/CalendarCell.tsx index f86093fc0..10ada4a5e 100644 --- a/web/src/components/ActivityCalendar/CalendarCell.tsx +++ b/web/src/components/ActivityCalendar/CalendarCell.tsx @@ -1,5 +1,5 @@ +import { Tooltip } from "@usememos/ui"; import { memo } from "react"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import { getChipClassName } from "./cellStyles"; import type { CalendarDayCell } from "./types"; @@ -52,12 +52,12 @@ export const CalendarCell = memo(({ day, maxCount, tooltipText, onClick }: Calen } return ( - - - + + +

{tooltipText}

-
-
+ + ); }); diff --git a/web/src/components/ActivityCalendar/MonthCalendar.tsx b/web/src/components/ActivityCalendar/MonthCalendar.tsx index fceda818a..2efcb4e9a 100644 --- a/web/src/components/ActivityCalendar/MonthCalendar.tsx +++ b/web/src/components/ActivityCalendar/MonthCalendar.tsx @@ -9,7 +9,13 @@ import type { MonthCalendarProps } from "./types"; import { calculateMaxCount, getTooltipText } from "./utils"; /** The type of a weekday column label, shared by every month grid. */ -export const WEEKDAY_LABEL_CLASSES = "text-2xs font-medium uppercase tracking-[0.04em] text-muted-foreground/50"; +/** + * Seven 28px columns, the sidebar's one control height, so day cells land on whole pixels; the + * leftover width goes into the column gaps, which keeps the first and last columns on the rails. + */ +const CALENDAR_GRID_CLASSES = "grid grid-cols-[repeat(7,28px)] justify-between gap-y-1"; +/** Weekday initials: caption weight in muted ink, so they sit under the day numbers rather than beside them. */ +export const WEEKDAY_LABEL_CLASSES = "mu-caption text-mu-ink-muted"; /** Localized weekday labels starting on the instance's first day of the week. */ export const useWeekdayLabels = (weekStartDayOffset: number) => { @@ -46,9 +52,9 @@ export const MonthCalendar = memo(({ month, data, selectedDate, onClick, timeBas }); return ( -
+
{/* Every day button already announces its full date, so the initials are decoration. */} -