Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- AI Chat views: replace custom pill buttons with native `.borderless` styles, switch hardcoded text colors to semantic system colors, use relative font sizing in Markdown rendering, align spacing to the 8-pt grid, and add accessibility labels to icon-only buttons
- Translucent backgrounds (Welcome sidebar, settings banners, ER diagram toolbar, JSON editor controls, Pro feature scrim) honor the system Reduce Transparency and Increase Contrast accessibility settings, swapping the material for a solid surface color when either is on
- Internal: result-grid sortable header drops the custom resize cursor handling that duplicated AppKit's built-in column-edge resize, and consolidates three sort delegate methods into one that carries the full sort state. No user-facing change; multi-column sort, shift-click cycle, and the column resize cursor still work the same.
- Internal: drop four 1-to-1 PassthroughSubject buses (`saveAsFavoriteRequested`, `focusConnectionFormWindowRequested`, `openSampleDatabaseRequested`, `resetSampleDatabaseRequested`) for direct ownership. The favorite-edit dialog query is now observable state on `MainContentCoordinator`, the connection-form focus lookup is inlined in `WelcomeViewModel`, and the sample-database menu items call `SampleDatabaseLauncher` directly. `AppDelegate` no longer needs `commandCancellables`.
- Internal: Redis sidebar key tree uses SwiftUI `OutlineGroup` instead of recursive `DisclosureGroup` + `ForEach` wrapped in `AnyView`. Expansion state is now managed natively per branch identifier; the explicit `expandedPrefixes` set is gone.
- Result-grid cells render via direct `draw(_:)` on a layer-backed `NSView` instead of an `NSTableCellView` wrapping an `NSTextField` plus an `NSButton` accessory. Per cell during scroll there is no Auto Layout solving, no `NSTextField` re-layout, and no `NSButton` tracking-area work. Editing for plain-text columns now opens the overlay editor (the same surface previously used for multi-line cells) rather than an inline text field.

Expand Down
19 changes: 0 additions & 19 deletions TablePro/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {

private var hasRunPostLaunchActivation = false
private var pluginsRejectedCancellable: AnyCancellable?
private var commandCancellables: Set<AnyCancellable> = []

// MARK: - URL & File Open

Expand Down Expand Up @@ -84,18 +83,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
.sink { [weak self] rejected in
self?.handlePluginsRejected(rejected)
}
AppCommands.shared.focusConnectionFormWindowRequested
.receive(on: RunLoop.main)
.sink { [weak self] _ in self?.handleFocusConnectionForm() }
.store(in: &commandCancellables)
AppCommands.shared.openSampleDatabaseRequested
.receive(on: RunLoop.main)
.sink { _ in SampleDatabaseLauncher.open() }
.store(in: &commandCancellables)
AppCommands.shared.resetSampleDatabaseRequested
.receive(on: RunLoop.main)
.sink { _ in SampleDatabaseLauncher.reset() }
.store(in: &commandCancellables)
}

func applicationDidBecomeActive(_ notification: Notification) {
Expand Down Expand Up @@ -211,12 +198,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}

private func handleFocusConnectionForm() {
if let window = NSApp.windows.first(where: { AppLaunchCoordinator.isConnectionFormWindow($0) }) {
window.makeKeyAndOrderFront(nil)
}
}

// MARK: - Dock Menu

func applicationDockMenu(_ sender: NSApplication) -> NSMenu? {
Expand Down
4 changes: 0 additions & 4 deletions TablePro/Core/Events/AppCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ final class AppCommands {
let importConnections = PassthroughSubject<Void, Never>()
let importConnectionsFromApp = PassthroughSubject<Void, Never>()
let exportQueryResults = PassthroughSubject<Void, Never>()
let saveAsFavoriteRequested = PassthroughSubject<String, Never>()

// MARK: - Window / Sheet Commands

let focusConnectionFormWindowRequested = PassthroughSubject<Void, Never>()
let openSampleDatabaseRequested = PassthroughSubject<Void, Never>()
let resetSampleDatabaseRequested = PassthroughSubject<Void, Never>()
let presentDatabaseTypeChooser = PassthroughSubject<DatabaseTypeChooserPayload, Never>()

private init() {}
Expand Down
4 changes: 2 additions & 2 deletions TablePro/TableProApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ struct AppMenuCommands: Commands {
.optionalKeyboardShortcut(shortcut(for: .manageConnections))

Button(String(localized: "Open Sample Database")) {
AppCommands.shared.openSampleDatabaseRequested.send(())
SampleDatabaseLauncher.open()
}

Button(String(localized: "Reset Sample Database...")) {
AppCommands.shared.resetSampleDatabaseRequested.send(())
SampleDatabaseLauncher.reset()
}
}

Expand Down
4 changes: 3 additions & 1 deletion TablePro/ViewModels/WelcomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ final class WelcomeViewModel {
}

func focusConnectionFormWindow() {
AppCommands.shared.focusConnectionFormWindowRequested.send(())
if let window = NSApp.windows.first(where: { AppLaunchCoordinator.isConnectionFormWindow($0) }) {
window.makeKeyAndOrderFront(nil)
}
}

// MARK: - Private Helpers
Expand Down
11 changes: 5 additions & 6 deletions TablePro/Views/Main/Child/MainEditorContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct MainEditorContentView: View {
@State private var cachedChangeManager: AnyChangeManager?
@State private var erDiagramViewModels: [UUID: ERDiagramViewModel] = [:]
@State private var serverDashboardViewModels: [UUID: ServerDashboardViewModel] = [:]
@State private var favoriteDialogQuery: FavoriteDialogQuery?
@State private var dataTabDelegate = DataTabGridDelegate()

// Native macOS window tabs — no LRU tracking needed (single tab per window)
Expand Down Expand Up @@ -97,7 +96,10 @@ struct MainEditorContentView: View {
}
}
.background(.background)
.sheet(item: $favoriteDialogQuery) { item in
.sheet(item: Binding(
get: { coordinator.favoriteDialogQuery },
set: { coordinator.favoriteDialogQuery = $0 }
)) { item in
FavoriteEditDialog(
connectionId: connectionId,
favorite: nil,
Expand Down Expand Up @@ -130,9 +132,6 @@ struct MainEditorContentView: View {
}
)
}
.onReceive(AppCommands.shared.saveAsFavoriteRequested) { query in
favoriteDialogQuery = FavoriteDialogQuery(query: query)
}
.onChange(of: tabManager.tabStructureVersion) { _, _ in
let openTabIds = Set(tabManager.tabIds)
coordinator.cleanupSortCache(openTabIds: openTabIds)
Expand Down Expand Up @@ -332,7 +331,7 @@ struct MainEditorContentView: View {
},
onSaveAsFavorite: { text in
guard !text.isEmpty else { return }
favoriteDialogQuery = FavoriteDialogQuery(query: text)
coordinator.favoriteDialogQuery = FavoriteDialogQuery(query: text)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension MainContentCoordinator {
tab.tabType == .query else { return }
let query = tab.content.query.trimmingCharacters(in: .whitespacesAndNewlines)
guard !query.isEmpty else { return }
AppCommands.shared.saveAsFavoriteRequested.send(query)
favoriteDialogQuery = FavoriteDialogQuery(query: query)
}

func openLinkedFavorite(_ favorite: LinkedSQLFavorite) {
Expand Down
5 changes: 4 additions & 1 deletion TablePro/Views/Main/MainContentCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ final class MainContentCoordinator {
/// Stable identifier for this coordinator's window (set by MainContentView on appear)
var windowId: UUID?

/// Direct reference to sidebar viewmodel — eliminates global notification broadcasts
/// Setting this presents the favorite-edit dialog sheet from `MainEditorContentView`.
var favoriteDialogQuery: FavoriteDialogQuery?

/// Direct reference to sidebar viewmodel, eliminates global notification broadcasts
weak var sidebarViewModel: SidebarViewModel?

/// Direct reference to structure view actions — eliminates notification broadcasts
Expand Down
Loading