Skip to content

Comments

feat: command palette close with esc and site search#300

Merged
judekim0507 merged 5 commits intonook-browser:devfrom
judekim0507:dev
Feb 17, 2026
Merged

feat: command palette close with esc and site search#300
judekim0507 merged 5 commits intonook-browser:devfrom
judekim0507:dev

Conversation

@judekim0507
Copy link
Member

@judekim0507 judekim0507 commented Feb 17, 2026

Summary by CodeRabbit

  • New Features
    • Added site-scoped search to quickly search within popular websites (YouTube, GitHub, Reddit, X, Wikipedia, Amazon, Twitch, Spotify, Stack Overflow).
    • Search bar displays active site name with color badge when site search is active.
    • New settings section to manage, customize, and reset site search entries.
    • Enhanced keyboard support for navigating site search.

@judekim0507 judekim0507 marked this pull request as ready for review February 17, 2026 08:43
@judekim0507 judekim0507 merged commit 93edd2a into nook-browser:dev Feb 17, 2026
1 check passed
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces site-scoped search functionality to the command palette, enabling users to search within specific websites directly from the search interface. It adds a new SiteSearchEntry data model with preset configurations for popular sites, integrates site search UI and keyboard handling into the command palette, provides settings components for managing site search entries, and persists settings via the NookSettingsService.

Changes

Cohort / File(s) Summary
Site Search Data Model
CommandPalette/SiteSearch.swift
New SiteSearchEntry struct with Codable/Identifiable/Equatable conformance; includes URL generation via searchURL(for:), prefix matching via matches(prefix:), and static defaultSites property with nine popular sites (YouTube, GitHub, Reddit, X, Wikipedia, Amazon, Twitch, Spotify, Stack Overflow).
Command Palette Integration
CommandPalette/CommandPaletteView.swift
Added activeSiteSearch state property; computed properties siteSearchMatch and visibleSuggestions to filter suggestions when site search is active; enhanced keyboard handling for Tab (activate site search), Escape/Delete/Backspace (exit site search); updated icon and placeholder to reflect active site search; modified handleReturn to resolve queries and navigate via site-specific URLs; adjusted suggestion rendering and selection logic.
Settings UI Components
Nook/Components/Settings/SettingsView.swift
Added SiteSearchSettingsCard component for listing, editing, and deleting site search entries with Reset to Defaults action; added SiteSearchEntryEditor for creating/editing entries with name, domain, URL template, and color fields; expanded formatTimeout function implementation.
General Settings
Nook/Components/Settings/Tabs/General.swift
Integrated Site Search section with list of existing entries, add/delete actions, and reset button; wired sheet presentation for SiteSearchEntryEditor to append new entries to nookSettings.siteSearchEntries.
Settings Persistence
Settings/NookSettingsService.swift
Added siteSearchEntries property with JSON encoding/decoding for user defaults; initializes from persisted data or falls back to SiteSearchEntry.defaultSites.

Sequence Diagram

sequenceDiagram
    participant User
    participant CommandPalette as Command Palette
    participant SearchManager as Search Manager
    participant SiteSearch as Site Search
    participant Navigator as Navigator

    User->>CommandPalette: Type search query
    CommandPalette->>SearchManager: Get suggestions
    SearchManager-->>CommandPalette: Return suggestions

    alt Tab key pressed
        User->>CommandPalette: Press Tab
        CommandPalette->>SiteSearch: Find matching site
        SiteSearch-->>CommandPalette: Return SiteSearchEntry
        CommandPalette->>CommandPalette: Set activeSiteSearch
        CommandPalette-->>User: Show site-scoped suggestions
    end

    alt Return key pressed
        User->>CommandPalette: Press Return
        CommandPalette->>SiteSearch: Generate search URL
        SiteSearch-->>CommandPalette: Return site-specific URL
        CommandPalette->>Navigator: Navigate to URL
        Navigator-->>User: Load search results
        CommandPalette->>CommandPalette: Reset activeSiteSearch
    end

    alt Escape key pressed
        User->>CommandPalette: Press Escape
        CommandPalette->>CommandPalette: Clear activeSiteSearch
        CommandPalette-->>User: Return to normal search
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Poem

🐰 Hop, skip, and search through sites so keen,
Site-scoped queries paint the screen,
With YouTube, GitHub, Reddit's glow,
The command palette steals the show!
Tab to leap, Escape to flee,
A search experience wild and free! 🔍✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot mentioned this pull request Feb 20, 2026
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