Skip to content

refactor: downloads history as spatial sidebar destination#239

Merged
yonaries merged 5 commits intomainfrom
refactor/downloads
Mar 14, 2026
Merged

refactor: downloads history as spatial sidebar destination#239
yonaries merged 5 commits intomainfrom
refactor/downloads

Conversation

@yonaries
Copy link
Copy Markdown
Contributor

Summary

  • Downloads history view — a dedicated sidebar destination that slides in with a spatial push-back transition on the spaces content, replacing the old popover
  • Search & date grouping — filter downloads by name/URL, grouped by date (Today, Yesterday, This Week, etc.)
  • Native file icons — uses NSWorkspace icons matching Finder instead of SF Symbols
  • Circular progress indicator — replaces the inline download progress list with a ring around the sidebar icon
  • Unified action menu — single ellipsis button per row with Open, Show in Finder, Copy Path, Move to Trash, Retry, Remove from Ora
  • Smart tab management — auto-closes tabs opened solely for file downloads; navigates back when an existing page triggers a download
  • Interactive gestures — swipe right to dismiss downloads, swipe left from first space to enter
  • Custom Ora icons — DownloadBox and Brush icons for sidebar widget and clear button

Replace the downloads popover with a dedicated downloads history view
that lives as a sibling destination in the sidebar. The transition uses
a horizontal slide with push-back parallax on the spaces content.

- Add DownloadsHistoryView with header, active/history sections, and empty state
- Add DownloadHistoryRow with file icons, source hostname, and rich actions
- Add interactive swipe gesture (right to dismiss, left from first space to enter)
- Add retry, open file, and reveal in Finder actions
- Wire floating sidebar visibility to downloads history state
Add OraInput search bar to filter downloads by file name or URL.
Group history downloads by date buckets (Today, Yesterday, This Week,
Last Week, etc.) for easier navigation.
- Use native macOS file icons (NSWorkspace) instead of SF Symbols
- Replace inline download progress with circular ring on sidebar icon
- Use accent color for progress bar, retry icon, and status text
- Use OraIcons (DownloadBox, Brush1) for sidebar and clear button
- Auto-close tabs opened solely for file downloads (no HTML loaded)
- Navigate back when a page triggers a download from existing content
- Fix active downloads not immediately appearing in the widget
Replace multiple hover action buttons with a single ellipsis menu
containing all actions (open, show in Finder, copy path, retry,
move to trash, remove from Ora). Add moveToTrash to DownloadManager.
Make downloads history view fill sidebar edge to edge.
@yonaries yonaries requested a review from kenenisa as a code owner March 14, 2026 18:21
@tembo tembo bot added the enhancement improvements label Mar 14, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 14, 2026

Greptile Summary

Replaces the downloads popover with a full spatial sidebar destination that slides in with push-back transitions. The new view adds search, date-grouped history, native file icons, a circular progress indicator on the sidebar widget, a unified per-row action menu, and smart tab management that auto-closes download-only tabs.

  • Spatial navigation: SidebarView now wraps spaces content and DownloadsHistoryView in a ZStack with interactive swipe gestures and spring-animated transitions
  • Downloads history: New DownloadsHistoryView with search filtering, date bucketing (Today → Older), and a "Clear" button; new DownloadHistoryRow with native NSWorkspace file icons, context menus, and inline progress
  • DownloadsWidget refactor: Replaced inline download list + popover with a compact icon button featuring a circular progress ring around the download icon
  • Smart tab management: TabBrowserPageDelegate now navigates back or closes tabs that were opened solely for file downloads, using the newly exposed lastCommittedURL and isDownloadNavigation from BrowserPage
  • New manager methods: openFile, moveToTrash, and retryDownload added to DownloadManager; recent downloads limit bumped from 20 to 50
  • Bug: The "Clear" button visibility (hasNonActiveDownloads) includes failed/cancelled downloads, but clearCompletedDownloads() only removes .completed entries — failed/cancelled downloads won't be cleared

Confidence Score: 4/5

  • This PR is safe to merge with one minor logic mismatch in the Clear button behavior that should be addressed.
  • Well-structured refactor with clean separation of concerns. The spatial transition, gesture handling, and smart tab management are all correctly implemented. The only functional issue is the Clear button visibility/action mismatch in DownloadsHistoryView. The icon files are pure geometry with no concerns.
  • ora/Features/Downloads/Views/DownloadsHistoryView.swift and ora/Features/Downloads/Services/DownloadManager.swift — the Clear button appears for failed/cancelled downloads but clearCompletedDownloads() only removes completed ones.

Important Files Changed

Filename Overview
ora/Core/BrowserEngine/BrowserPage.swift Widens access to lastCommittedURL and isDownloadNavigation via private(set) to enable smart tab management in the delegate. Minimal, clean change.
ora/Features/Downloads/Services/DownloadManager.swift Adds openFile, moveToTrash, and retryDownload methods; bumps recent downloads limit to 50; adds objectWillChange dispatch for WKDownload callback timing. clearCompletedDownloads only clears .completed status, which mismatches the UI visibility check.
ora/Features/Downloads/Views/DownloadHistoryRow.swift New file implementing per-download row with native file icons, progress bar, hover menu, and context menu. Well-structured with good separation of concerns.
ora/Features/Downloads/Views/DownloadsHistoryView.swift New downloads history sidebar view with search, date grouping, and clear functionality. Has a logic mismatch between the Clear button visibility and the clear action scope.
ora/Features/Sidebar/Views/DownloadsWidget.swift Major refactor from inline download list + popover to a compact icon button with circular progress ring. Clean replacement of the old approach.
ora/Features/Sidebar/Views/SidebarView.swift Adds spatial transition between spaces and downloads history with interactive swipe gestures. Well-implemented with proper drag threshold and spring animations.
ora/Features/Tabs/Browser/TabBrowserPageDelegate.swift Smart tab management: navigates back on download if page has history, otherwise closes download-only tabs. Timing is correct since delegate runs synchronously before isDownloadNavigation reset.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[DownloadsWidget Button Tap] -->|toggle| B[isShowingDownloadsHistory]
    B -->|true| C[SidebarView Spatial Transition]
    C --> D[DownloadsHistoryView slides in]
    D --> E[spacesContent pushes back + fades]

    F[Swipe Left from Space 0] -->|threshold met| B
    G[Swipe Right on Downloads] -->|threshold met| H[isShowingDownloadsHistory = false]
    H --> I[DownloadsHistoryView slides out]
    I --> J[spacesContent restores]

    K[WKDownload Triggered] --> L[BrowserPage.isDownloadNavigation = true]
    L --> M[TabBrowserPageDelegate.didStartDownload]
    M --> N{lastCommittedURL?}
    N -->|exists| O[tab.goBack]
    N -->|nil| P[tabManager.closeTab]
Loading

Last reviewed commit: b332790

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@yonaries yonaries merged commit 747ab8c into main Mar 14, 2026
2 checks passed
@yonaries yonaries deleted the refactor/downloads branch March 14, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant