mirror of https://github.com/usememos/memos.git
This commit refactors MemoView and MemoEditor components for better maintainability, introducing React Context, custom hooks, and improved folder structure. MemoView improvements: - Introduce MemoViewContext to eliminate prop drilling - Reduce MemoHeader props from 18 to 8 - Reduce MemoBody props from 9 to 4 - Extract custom hooks: useMemoViewDerivedState, useMemoEditor, useMemoHandlers for better separation of concerns - Fix React hooks ordering bug in edit mode MemoEditor improvements: - Extract state management into useMemoEditorState hook - Extract keyboard handling into useMemoEditorKeyboard hook - Extract event handlers into useMemoEditorHandlers hook - Extract initialization logic into useMemoEditorInit hook - Reduce main component from 461 to 317 lines (31% reduction) Folder structure cleanup: - Move SortableItem to memo-metadata (correct location) - Move ErrorBoundary to components folder - Flatten Toolbar/InsertMenu structure (remove unnecessary nesting) - Consolidate hooks in main hooks folder - Consolidate types in main types folder Benefits: - Better separation of concerns - Improved testability - Easier maintenance - Cleaner code organization - No functionality changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| components | ||
| helpers | ||
| hooks | ||
| layouts | ||
| lib | ||
| locales | ||
| pages | ||
| router | ||
| store | ||
| themes | ||
| types | ||
| utils | ||
| App.tsx | ||
| grpcweb.ts | ||
| i18n.ts | ||
| index.css | ||
| main.tsx | ||