Skip to content

feat: Native macOS inline error banners (replace blocking dialogs)#12

Merged
datlechin merged 7 commits intomainfrom
feat/inline-error-display-native-ui
Dec 28, 2025
Merged

feat: Native macOS inline error banners (replace blocking dialogs)#12
datlechin merged 7 commits intomainfrom
feat/inline-error-display-native-ui

Conversation

@datlechin
Copy link
Copy Markdown
Member

🎯 Overview

Replaces blocking alert dialogs for query errors with native macOS-style inline error banners that follow Apple Human Interface Guidelines.

🔄 Changes

Before ❌

  • Query errors showed as blocking alert dialogs
  • User had to click "OK" to dismiss
  • Interrupted workflow
  • Couldn't see query while error was shown
  • Non-native appearance (triangle icon, red/pink background)

After ✅

  • Errors display as inline banners at top of results area
  • Non-blocking - users can continue working
  • Native macOS appearance (circular icon, system colors)
  • Professional, subtle design
  • Full dark mode support

🎨 Native macOS Design

The error banner now follows Apple's design language:

  • Icon: exclamationmark.circle.fill with multicolor rendering (native macOS style)
  • Background: System controlBackgroundColor (adapts to light/dark mode)
  • Border: 0.5px hairline border using separatorColor
  • Corners: 6px rounded corners (macOS standard)
  • Shadow: Subtle 1px shadow for depth
  • Text: 12pt in .primary color (not red - better readability)
  • Dismiss: Small xmark button with hover effect
  • Spacing: Compact padding (12px/8px) matching native panels

📸 Screenshot

Error Banner

🔧 Technical Details

Files Modified

  • TablePro/Views/Main/Child/MainEditorContentView.swift - Added native error banner
  • TablePro/Views/Main/Child/TableTabContentView.swift - Added error display
  • TablePro/Views/Main/MainContentCoordinator.swift - Removed alert properties
  • TablePro/Views/MainContentView.swift - Removed alert handler
  • TablePro/Views/Main/Child/MainContentAlerts.swift - Removed error alert

Implementation

// Native macOS error banner
private func errorBanner(_ message: String) -> some View {
    HStack(alignment: .top, spacing: 10) {
        Image(systemName: "exclamationmark.circle.fill")
            .foregroundStyle(.red)
            .symbolRenderingMode(.multicolor)
        
        Text(message)
            .font(.system(size: 12))
            .foregroundStyle(.primary)
            .textSelection(.enabled)
        
        // Dismiss button
        Button { /* clear error */ } label: {
            Image(systemName: "xmark")
        }
    }
    .background(RoundedRectangle(cornerRadius: 6)
        .fill(Color(nsColor: .controlBackgroundColor)))
    .overlay(RoundedRectangle(cornerRadius: 6)
        .strokeBorder(Color(nsColor: .separatorColor)))
}

✅ Benefits

  1. Better UX: Non-blocking, users can continue working
  2. Native Look: Matches macOS system apps (Xcode, Mail, Finder)
  3. Accessibility: Selectable text, proper contrast ratios
  4. Professional: Subtle, refined appearance
  5. Dark Mode: Full support via system colors
  6. Consistency: Same banner in both table and query tabs

🧪 Testing

Tested with various error scenarios:

  • ✅ Table not found: SELECT * FROM nonexistent_table
  • ✅ SQL syntax errors: SELECT invalid syntax
  • ✅ Connection errors
  • ✅ Permission errors
  • ✅ Both light and dark mode
  • ✅ Both table tabs and query tabs

📝 Notes

This PR also includes previous session work on:

  • Server-side pagination
  • Create Table UI improvements
  • Template sheet optimizations
  • Duplicate table functionality fixes

All features have been tested and are working correctly.

🔗 Related

Addresses user feedback about disruptive error dialogs breaking workflow.

…anners

## Summary
Replaced blocking alert dialogs for query errors with native macOS-style inline error banners that follow Apple Human Interface Guidelines.

## Changes

### Error Display (UX Improvement)
- **Before**: Query errors showed as blocking alert dialogs that interrupted workflow
- **After**: Errors display as inline banners at top of results area (non-blocking)

### UI Components
- Added native macOS error banner in `MainEditorContentView`
- Added native macOS error banner in `TableTabContentView`
- Removed alert dialog from `MainContentAlerts`

### Native macOS Design
- Uses `exclamationmark.circle.fill` icon with multicolor rendering
- System background color (`controlBackgroundColor`) for dark/light mode support
- 6px rounded corners (macOS standard)
- Subtle shadow and hairline border (0.5px)
- Compact 12pt text in primary color (not red)
- Small dismiss button with hover effect

### Coordinator Updates
- Removed `showErrorAlert` and `errorAlertMessage` properties
- All error flows now set `tab.errorMessage` directly
- Error banner appears automatically when `errorMessage` is set

### Files Modified
- `TablePro/Views/Main/Child/MainEditorContentView.swift` - Added error banner function
- `TablePro/Views/Main/Child/TableTabContentView.swift` - Added error banner display
- `TablePro/Views/Main/MainContentCoordinator.swift` - Removed alert properties, cleaned up error handling
- `TablePro/Views/MainContentView.swift` - Removed error change handler
- `TablePro/Views/Main/Child/MainContentAlerts.swift` - Removed error alert dialog

## Benefits
✅ Non-blocking workflow - users can continue working while error is visible
✅ Native macOS appearance - matches system design language
✅ Better accessibility - selectable error text, proper contrast
✅ Dark mode support - uses system colors
✅ Professional look - subtle, refined, not distracting

## Testing
Tested with various error scenarios:
- Table not found
- SQL syntax errors
- Connection errors
- Permission errors

All display correctly in both table tabs and query tabs.
Copilot AI review requested due to automatic review settings December 28, 2025 05:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces blocking alert dialogs for query errors with native macOS-style inline error banners that follow Apple Human Interface Guidelines. The change improves user experience by making errors non-blocking and more visually integrated with the macOS design language.

Key Changes:

  • Removed blocking error alert dialogs in favor of inline banners
  • Implemented native macOS error banner styling with system colors and icons
  • Enhanced pagination support with server-side controls
  • Added create table UI functionality with comprehensive template support

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
session-ses_4a1b.md Session log documenting UI/UX redesign work
UI_UX_COMPLETE_GUIDE.md Complete user guide for the new Create Table interface
MainContentView.swift Removed error alert handler, added pagination callbacks
MainContentCoordinator.swift Removed error alert properties, added pagination and table creation methods
TableTabContentView.swift Added error banner display and pagination support
QueryTabContentView.swift Added pagination callback parameters
MainStatusBarView.swift Enhanced with pagination controls display
MainEditorContentView.swift Added error banner, create table tab support, pagination callbacks
MainContentAlerts.swift Removed blocking error alert dialog
Multiple Editor Views New table creation UI components (TemplateSheets, DataTypePicker, CreateTableView, etc.)
DesignConstants.swift Added colors, animation durations, corner radius, and column width constants
TableProApp.swift Added "New Table" menu item with keyboard shortcut
TableCreationModels.swift Models for table creation functionality
QueryTab.swift Enhanced pagination state with navigation methods
TableTemplateStorage.swift Storage system for table templates
TableQueryBuilder.swift Added pagination offset support
DDLParser.swift Parser for importing CREATE TABLE statements
CreateTableService.swift Service for generating CREATE TABLE SQL
SQLStatementGenerator.swift Enhanced UPDATE/DELETE safety with LIMIT 1
DataChangeManager.swift Improved error handling for updates without primary keys

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TablePro/Views/Main/Child/MainEditorContentView.swift Outdated
Comment thread TablePro/Views/Main/Child/TableTabContentView.swift Outdated
Comment thread TablePro/Views/Main/Child/MainEditorContentView.swift Outdated
Comment thread TablePro/Views/Main/Child/TableTabContentView.swift Outdated
datlechin and others added 5 commits December 28, 2025 13:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Create Views/Shared/InlineErrorBanner.swift with reusable error banner
- Remove duplicated errorBanner code from MainEditorContentView (~50 lines)
- Remove duplicated errorBanner code from TableTabContentView (~42 lines)
- Add smooth dismiss animation (.easeInOut 0.2s)
- Fix misplaced dismissError() in DiscardAction enum that broke build
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@datlechin datlechin merged commit 1be14ae into main Dec 28, 2025
6 checks passed
@datlechin datlechin deleted the feat/inline-error-display-native-ui branch December 28, 2025 06:32
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.

2 participants