-
Notifications
You must be signed in to change notification settings - Fork 516
feat(files): add persisted date visibility toggle (calendar icon) in Files sidebar; IPC handlers and preload wiring #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…le) and adjust top padding for alignment
…yy), right-aligned and vertically centered
…Files sidebar; IPC handlers and preload wiring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements a comprehensive date visibility toggle feature throughout the Reor application, allowing users to control when file timestamps are displayed. The implementation spans across multiple architectural layers:
Core Storage & IPC Layer: Added showFileDatesInSidebar boolean field to the electron store schema with corresponding enum key ShowFileDatesInSidebar. New IPC handlers (get-file-index-date-visibility and set-file-index-date-visibility) enable communication between the renderer and main processes, with automatic event emission to keep the UI synchronized when preferences change.
UI Components: The Files sidebar now includes a calendar icon toggle button that controls date visibility with visual feedback (opacity and color changes based on state). File rows conditionally display modification dates in MM-dd-yy format using date-fns for consistent formatting. The layout uses flexbox with space-between justification to accommodate both file names and timestamps without breaking existing drag-and-drop functionality.
Editor Integration: A new NoteTimestamps component was added to the editor interface, displaying creation and modification dates for the currently open file. Users can click to toggle between showing creation vs. modification timestamps, with proper keyboard accessibility support (Enter/Space keys).
State Management: The feature uses React hooks for local state management, electron store for persistence across sessions, and IPC event listeners for real-time synchronization. The default behavior shows dates initially (defaulting to true), giving users immediate access to temporal context while allowing them to hide this information if desired.
This change integrates seamlessly with Reor's existing architecture patterns for UI preferences, following the same approach used for document stats and editor layout settings.
Confidence score: 4/5
- This PR is generally safe to merge with minor concerns about completeness
- Score reflects solid implementation following existing patterns, but missing store schema migration could cause issues for existing users
- Pay close attention to
electron/main/electron-store/storeConfig.ts- the new field needs default value initialization in the schema migrator
7 files reviewed, 1 comment
| init() | ||
|
|
||
| const handler = (_e: any, val: boolean) => setShowDates(val) | ||
| window.ipcRenderer.on('file-index-date-visibility-changed', handler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Missing cleanup for IPC event listener in useEffect - should return a cleanup function to prevent memory leaks
| window.ipcRenderer.on('file-index-date-visibility-changed', handler) | |
| useEffect(() => { | |
| const init = async () => { | |
| const val = await window.electronStore.getFileIndexDateVisibility() | |
| setShowDates(val) | |
| } | |
| init() | |
| const handler = (_e: any, val: boolean) => setShowDates(val) | |
| window.ipcRenderer.on('file-index-date-visibility-changed', handler) | |
| return () => { | |
| window.ipcRenderer.off('file-index-date-visibility-changed', handler) | |
| } | |
| }, []) |
Automated PR from fork branch 'feature/note-timestamps'.