Skip to content

feat(welcome): favorite connections from the welcome screen (#1302)#1452

Merged
datlechin merged 6 commits into
mainfrom
feat/1302-favorite-connections
May 28, 2026
Merged

feat(welcome): favorite connections from the welcome screen (#1302)#1452
datlechin merged 6 commits into
mainfrom
feat/1302-favorite-connections

Conversation

@datlechin

Copy link
Copy Markdown
Member

Closes #1302.

What it does

Adds a star/favorite affordance to the connection list on the welcome screen.

  • Hover any connection and a star button appears on the right; click to favorite, click the filled star to unfavorite.
  • Right-click (or use the row's Voice Control / VoiceOver action) for Add to Favorites / Remove from Favorites. Multi-selection adds or removes all at once.
  • Favorited connections appear in a Favorites section at the top of the list, sorted alphabetically.
  • The connection also stays in its group below — same identity, two places (Mail.app pattern). Lets the user keep their group taxonomy intact while pinning the few connections they reach for daily.
  • The Favorites section hides during search and when there are zero favorites.
  • The flag rides the existing iCloud sync layer through SyncRecordMapper.

Design notes

The user cited DBeaver, DataGrip, TablePlus as having this feature. Investigation showed none of them actually does — they organize via folders and colors. The real native pattern lives in Mail, Finder, Reminders, and Notes. We follow Mail's model (duplicate into Favorites, keep in original section) because TablePro already has connection groups and we don't want favoriting to break the group the user built.

Apple switched their own "favorite" icon from heart to star in Sonoma 14.1 (Apple Music). Following suit: star and star.fill, with the menu strings "Add to Favorites" / "Remove from Favorites".

Hover behavior:

Row state Empty star Filled star.fill
Not favorited, not hovered or selected hidden hidden
Not favorited, hovered or selected visible hidden
Favorited (any state) hidden always visible

This keeps the list visually quiet for users with no favorites while still making the affordance discoverable.

Files

  • Model: DatabaseConnection.swiftvar isFavorite: Bool = false (CodingKeys, decode with decodeIfPresent ?? false).
  • Storage: ConnectionStorage.swift — propagated through StoredConnection, decode-with-default for backward compat.
  • Sync: SyncRecordMapper.swiftrecord["isFavorite"] as Int64(0|1), decoded with nil-safe default.
  • ViewModel: WelcomeViewModel.swiftfavoriteConnections computed property and toggleFavorite(_:) method that persists then calls rebuildTree() (respects the WelcomeViewModel tree-rebuild invariant) and emits AppEvents.connectionUpdated.
  • Row: WelcomeConnectionRow.swiftisSelected and onToggleFavorite parameters, hover state, new favoriteButton view, .accessibilityAction(named:) on the row for VoiceOver rotor.
  • Menus: WelcomeContextMenus.swift — favorite/unfavorite items in both single-selection and multi-selection menus, with correct plural strings and icons.
  • List: WelcomeWindowView.swift — new top Favorites section, gated on searchText.isEmpty && !favoriteConnections.isEmpty.

Tests

ConnectionStoragePersistenceTests.swift — two new tests:

  • New connections default to isFavorite == false.
  • Round-trip save + load preserves isFavorite == true.

The lifecycle/UI parts (hover state, context-menu wiring, section rendering) are best validated by manual interaction; no UI test infrastructure exists for the welcome list.

Docs and CHANGELOG

  • docs/databases/overview.mdx — new Favorites subsection under Organizing Connections.
  • CHANGELOG.md — entry under [Unreleased] > Added.

Notes

  • The same connection appears twice in the list when favorited (once in Favorites, once in its group). Arrow-down navigation visits it twice. This is Mail.app's behavior and the cost of the duplication semantic.
  • Manual drag-to-reorder within Favorites is out of scope for v1; sort is alphabetical. If users ask, we can add .onMove and a per-connection favoriteSortIndex later without affecting the data shape.
  • No keyboard shortcut for favorite. Cmd+D is Duplicate, Cmd+F is Find, and Apple Music ships no system standard for this — none of the free shortcuts felt right. Open to adding one if there's a clear precedent we missed.

@datlechin datlechin merged commit 96b2fa1 into main May 28, 2026
1 check passed
@datlechin datlechin deleted the feat/1302-favorite-connections branch May 28, 2026 13:16
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.

Feature Request: Star/Favorite database connections

1 participant