Skip to content

feat: add ability to create new collections directly from popup#141

Open
danilosekulovikj wants to merge 1 commit intolinkwarden:mainfrom
danilosekulovikj:feature/create-collection
Open

feat: add ability to create new collections directly from popup#141
danilosekulovikj wants to merge 1 commit intolinkwarden:mainfrom
danilosekulovikj:feature/create-collection

Conversation

@danilosekulovikj
Copy link

Summary

Allows users to create new collections directly from the extension popup and options page, significantly reducing friction when saving links.

Features and improvements

  • Deferred Creation: Lazily creates the collection upon saving the bookmark to prevent orphaned empty collections if the user cancels.
  • UX Improvements:
    • Implements a pinned footer inside the collection dropdown for creating a new collection based on the search input.
    • Displays a clear, centered 'Create' button in the empty state when no existing collections match the search query.
  • Validation & Safety:
    • Uses trimmed, case-insensitive checks to prevent creating duplicate collections or whitespace-only names.
    • Updated the underlying cmdk filter function to .trim() search input, ensuring that typing trailing spaces (e.g., "Test ") doesn't incorrectly hide existing collections.
  • Error Handling: Adds specific error handling to distinguish between link save failures and collection creation failures.
  • Code Quality: Refactors the dropdown collection list to eliminate ~80 lines of code duplication across rendering paths.
  • Polish: Fixes dark mode styling (bg-neutral-900) for the dropdown overlay and fixed a useEffect linter warning in BookmarkForm.tsx.

How to Test

  1. Open the extension popup.
  2. Open the Collection dropdown and start typing a collection name that doesn't exist.
  3. Click the pinned "Create [name]" footer or the centered empty state button.
  4. Save the link and verify the link appears in the newly created collection in your Linkwarden instance.
  5. Check edge cases: try creating a collection with trailing spaces, or click the "X" close button after preparing a new collection to verify the form state resets safely.

Allows users to create new collections directly from the extension popup and options page, significantly reducing friction when saving links.

Features and improvements:
- Lazily creates the collection upon saving the bookmark to prevent orphaned empty collections if the user cancels.
- Implements a pinned footer inside the collection dropdown for creating a new collection based on the search input.
- Displays a clear, centered 'Create' button in the empty state when no existing collections match the search query.
- Uses trimmed, case-insensitive checks to prevent creating duplicate collections or whitespace-only names.
- Adds specific error handling to distinguish between link save failures and collection creation failures.
- Fixes dark mode styling for the dropdown overlay.
- Refactors the dropdown collection list to eliminate code duplication across rendering paths.
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