Skip to content

feat: add ability to pin recent files - #204

Open
itshakemd wants to merge 3 commits into
Razee4315:mainfrom
itshakemd:main
Open

itshakemd wants to merge 3 commits into
Razee4315:mainfrom
itshakemd:main

Conversation

@itshakemd

Copy link
Copy Markdown

Summary

Currently, recent files on the welcome screen are purely sorted by their last opened time, meaning important files can easily get pushed off the list as new files are opened.

This PR introduces the ability to "pin" recent files. Pinned files float permanently to the top of the recents list.

Recording gif
  • Add an optional pinned?: boolean flag to the RecentFile interface.
  • Implement pinRecentFile(path) and unpinRecentFile(path) methods to persist the pin state in localStorage.
  • Update getRecentFiles() to sort pinned files at the top of the list while maintaining the chronological order within both pinned and unpinned groups.
  • Update addRecentFile() to preserve the pinned state when a file is re-opened, and ensure pinned files are excluded from the 25-entry limit eviction.

src/components/WelcomeScreen.tsx

  • Add right-click (onContextMenu) and touch long-press event handlers to the recent file rows.
  • Render the TabContextMenu to provide "Pin" and "Unpin" actions for the selected file.
  • Add click-suppression logic to prevent the file from accidentally opening right after a mobile long-press.
  • Replace the default description file icon with an accent-colored push_pin icon for pinned files, providing a clean visual indicator without cluttering the row layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant