memos/web/src/components
Johnny 1b11e8c841 refactor(editor): complete state machine and services migration
BREAKING CHANGE: MemoEditor internal architecture completely refactored

## Summary

Refactored MemoEditor from hooks-based state management to a three-layer
architecture (Presentation → State → Services) using useReducer pattern.

## Changes

### Architecture
- **State Layer** (5 new files): types, actions, reducer, context, barrel export
- **Service Layer** (6 new files): error, validation, upload, cache, memo services + barrel
- **Component Layer** (3 new files): EditorToolbar, EditorContent, EditorMetadata
- **Simplified Hooks** (3 new files): useMemoInit, useAutoSave, useKeyboard

### Code Reduction
- Main component: ~380 lines → ~140 lines (-63%)
- Hooks removed: 5 old hooks (useMemoEditorState, useMemoSave, etc.)
- Total lines removed: 508 lines of old code
- Utility hooks preserved: 8 hooks still in use (useLocation, useDragAndDrop, etc.)

### Improvements
-  Predictable state transitions with useReducer
-  Testable business logic in pure service functions
-  Cleaner component code (presentation only)
-  Better separation of concerns
-  Type-safe actions with discriminated unions
-  Centralized error handling

## Statistics
- Files changed: 26
- Commits created: 25 (squashed into 1)
- New files: 17
- Removed files: 5
- TypeScript errors: 0
- Lint errors: 0

## Testing
Manual testing required for:
- Editor functionality (create, edit, save)
- Drag and drop
- Focus mode
- Keyboard shortcuts (Cmd/Ctrl + Enter)
- Auto-save to localStorage
2025-12-23 08:38:02 +08:00
..
ActivityCalendar chore: fix linter 2025-12-15 19:58:58 +08:00
ConfirmDialog chore: tweak comments 2025-11-30 13:16:02 +08:00
Inbox fix: eliminate duplicate API requests by deduplicating user fetch calls 2025-12-22 20:12:44 +08:00
MasonryView refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
MemoActionMenu refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
MemoContent style: improve code block styling and formatting 2025-12-22 21:27:50 +08:00
MemoDetailSidebar fix: render dates correctly in memo detail sidebar and link dialog 2025-12-22 20:24:04 +08:00
MemoEditor refactor(editor): complete state machine and services migration 2025-12-23 08:38:02 +08:00
MemoExplorer refactor(web): rename grpcweb.ts to connect.ts and enable binary format 2025-12-16 20:15:16 +08:00
MemoReactionListView fix: eliminate duplicate API requests by deduplicating user fetch calls 2025-12-22 20:12:44 +08:00
MemoRelationForceGraph refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
MemoView refactor(editor): complete state machine and services migration 2025-12-23 08:38:02 +08:00
PagedMemoList fix: eliminate duplicate API requests by deduplicating user fetch calls 2025-12-22 20:12:44 +08:00
Settings refactor: remove deprecated Sessions and AccessTokens settings 2025-12-19 08:35:57 +08:00
StatisticsView refactor(web): improve ActivityCalendar maintainability and add Calendar page 2025-12-15 19:47:46 +08:00
kit chore(web): migrate from ESLint+Prettier to Biome 2025-11-14 23:58:07 +08:00
memo-metadata feat(web): add glassmorphism map controls with Google Maps integration 2025-12-20 00:18:01 +08:00
ui refactor: extract submenu hover delay logic into reusable hook 2025-12-22 21:04:00 +08:00
AttachmentIcon.tsx refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
AuthFooter.tsx refactor: simplify theme/locale to user preferences and improve initialization 2025-12-02 09:08:46 +08:00
ChangeMemberPasswordDialog.tsx refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
CreateAccessTokenDialog.tsx refactor: user auth improvements (#5360) 2025-12-18 18:15:51 +08:00
CreateIdentityProviderDialog.tsx refactor(web): rename grpcweb.ts to connect.ts and enable binary format 2025-12-16 20:15:16 +08:00
CreateShortcutDialog.tsx refactor(web): rename grpcweb.ts to connect.ts and enable binary format 2025-12-16 20:15:16 +08:00
CreateUserDialog.tsx refactor(web): rename grpcweb.ts to connect.ts and enable binary format 2025-12-16 20:15:16 +08:00
CreateWebhookDialog.tsx refactor(web): rename grpcweb.ts to connect.ts and enable binary format 2025-12-16 20:15:16 +08:00
DateTimeInput.tsx chore: use input type `datetime-local` instead of `text` (#5174) 2025-10-22 09:04:37 +08:00
Empty.tsx feat: variant colors (#4816) 2025-07-04 23:03:13 +08:00
LeafletMap.tsx chore: fix linter 2025-12-20 11:55:00 +08:00
LearnMore.tsx feat: variant colors (#4816) 2025-07-04 23:03:13 +08:00
LocaleSelect.tsx feat(web): add quick language and theme switchers to user menu 2025-10-28 22:32:25 +08:00
MemoAttachment.tsx refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
MemoDisplaySettingMenu.tsx chore: move frontend store 2025-07-07 22:44:08 +08:00
MemoFilters.tsx refactor(web): improve ActivityCalendar maintainability and add Calendar page 2025-12-15 19:47:46 +08:00
MemoResource.tsx refactor: attachment service part2 2025-06-18 00:09:19 +08:00
MemoSkeleton.tsx refactor(web): improve memo component skeleton and loading states 2025-10-30 22:25:19 +08:00
MemosLogo.tsx refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
MobileHeader.tsx feat: variant colors (#4816) 2025-07-04 23:03:13 +08:00
Navigation.tsx refactor(web): improve ActivityCalendar maintainability and add Calendar page 2025-12-15 19:47:46 +08:00
NavigationDrawer.tsx refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
PasswordSignInForm.tsx fix(auth): resolve token refresh and persistence issues 2025-12-18 20:56:54 +08:00
PreviewImageDialog.tsx feat: allow closing image preview via backdrop click (#5243) 2025-11-10 19:12:45 +08:00
RequiredBadge.tsx feat: variant colors (#4816) 2025-07-04 23:03:13 +08:00
SearchBar.tsx fix(ui): change focus search bar shortcut overlapping with url shortcut (#5336) 2025-12-11 07:56:20 +08:00
TagTree.tsx fix(web): allow only one active tag filter at a time 2025-12-02 08:40:43 +08:00
ThemeSelect.tsx refactor: simplify theme/locale to user preferences and improve initialization 2025-12-02 09:08:46 +08:00
UpdateAccountDialog.tsx refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00
UpdateCustomizedProfileDialog.tsx fix(web): convert enum values to string names in API resource paths 2025-12-11 20:08:11 +08:00
UserAvatar.tsx chore: unify colors 2025-07-06 13:55:08 +08:00
UserMenu.tsx chore: prevent sensitive data caching 2025-12-20 12:33:16 +08:00
VisibilityIcon.tsx refactor: migrate to connect-rpc (#5338) 2025-12-11 19:49:07 +08:00