This commit introduces a new user setting allowing you to define the
maximum number of lines displayed in the preview for text or code
clipboard history items.
Key changes:
- Added a "History Item Preview Line Limit" setting in
`ClipboardHistorySettings.tsx` (defaulting to 5 lines), stored in
`settingsStore.ts`.
- The `historyPreviewLineLimit` setting is now passed as a prop to
`ClipboardHistoryRow.tsx` and `ClipboardHistoryQuickPasteRow.tsx`
from their parent pages (`ClipboardHistoryPage.tsx` and
`ClipboardHistoryQuickPastePage.tsx` respectively).
- Modified `ClipboardHistoryRow.tsx` and
`ClipboardHistoryQuickPasteRow.tsx` to truncate the displayed text
or code preview based on the `historyPreviewLineLimit` prop when
the item is not expanded.
- The "Show all / Show less" indicators (+X lines / +Y chars) have
been updated to accurately reflect the truncation based on the new
line limit.
- Added comprehensive unit tests for both `ClipboardHistoryRow.tsx`
and `ClipboardHistoryQuickPasteRow.tsx` using Vitest and React
Testing Library to ensure the new functionality works as expected
across various scenarios (different limits, content lengths, text vs.
code, expanded state).
This commit addresses two main pieces of your feedback:
1. **Bug Fix**: I corrected an issue where entering the correct PIN for a
locked collection did not result in switching to the selected collection.
The `onConfirmSuccessCallback` within `useSelectCollectionById` in
`use-collections.ts` now correctly invokes the backend operation
`invoke('select_collection_by_id', ...)` instead of attempting a direct
frontend state update. Explicit UI refresh calls (query invalidations
and `build_system_menu`) are also made within this callback to ensure
the application state updates correctly.
2. **UI Refactor for Protected Collection Selection**:
In `ManageCollections.tsx`, the UI for selecting which collections
are PIN-protected has been changed. The previous list of individual
switches for each collection has been replaced with:
- A `DropdownMenu` allowing you to multi-select collections
using `DropdownMenuCheckboxItem`.
- A list displayed below the dropdown showing the titles of
currently protected collections (using `Badge` components).
This new UI is more user-friendly and scalable for managing
multiple protected collections.
These changes improve the reliability and your experience of the
collection PIN protection feature.