feat(web): add copy path option to content tab context menu#933
feat(web): add copy path option to content tab context menu#933lenisko wants to merge 2 commits intoautobrr:developfrom
Conversation
WalkthroughAdded an optional Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant FileRow as File/Folder Row (UI)
participant Tree as TorrentFileTree / Table
participant Utils as joinPath()
participant Clipboard as copyTextToClipboard()
participant Toast as toast()
rect rgba(40,120,200,0.06)
User->>FileRow: Right-click -> Select "Copy Path"
FileRow->>Tree: request item id/path + savePath
Tree->>Utils: joinPath(savePath, itemPath)
Utils-->>Tree: fullPath
Tree->>Clipboard: copyTextToClipboard(fullPath)
alt copy success
Clipboard-->>Toast: success toast("Copied path")
Toast-->>User: show success
else copy failure
Clipboard-->>Toast: error toast("Could not copy")
Toast-->>User: show error
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-12-03T18:11:08.682ZApplied to files:
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
web/src/lib/utils.ts (1)
312-317: Function works correctly for its intended use case.The
joinPathimplementation appropriately detects Windows vs Unix separators and handles path joining. One minor edge case to consider: ifrelativePathstarts with a separator, the result would have a double separator (e.g.,/base//relative). However, given thatrelativePathvalues come from torrent file listings (which use consistent forward slashes) andbasePathfromsave_path(platform-normalized), this scenario is unlikely in practice.Optional: Defensive handling for edge cases
If you want to be extra defensive, consider normalizing the relativePath:
export function joinPath(basePath: string, relativePath: string): string { if (!basePath) return relativePath const separator = basePath.includes("\\") ? "\\" : "/" const cleanBase = basePath.replace(/[\\/]$/, "") - return `${cleanBase}${separator}${relativePath}` + const cleanRelative = relativePath.replace(/^[\\/]+/, "") + return `${cleanBase}${separator}${cleanRelative}` }
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
web/src/components/torrents/TorrentDetailsPanel.tsxweb/src/components/torrents/TorrentFileTree.tsxweb/src/components/torrents/details/TorrentFileTable.tsxweb/src/lib/utils.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: finevan
Repo: autobrr/qui PR: 677
File: web/src/components/torrents/AddTorrentDialog.tsx:496-504
Timestamp: 2025-12-03T18:11:08.682Z
Learning: In the AddTorrentDialog component (web/src/components/torrents/AddTorrentDialog.tsx), temporary path settings (useDownloadPath/downloadPath) should be applied per-torrent rather than updating global instance preferences. The UI/UX is designed to suggest that these options apply to the individual torrent being added.
📚 Learning: 2025-12-03T18:11:08.682Z
Learnt from: finevan
Repo: autobrr/qui PR: 677
File: web/src/components/torrents/AddTorrentDialog.tsx:496-504
Timestamp: 2025-12-03T18:11:08.682Z
Learning: In the AddTorrentDialog component (web/src/components/torrents/AddTorrentDialog.tsx), temporary path settings (useDownloadPath/downloadPath) should be applied per-torrent rather than updating global instance preferences. The UI/UX is designed to suggest that these options apply to the individual torrent being added.
Applied to files:
web/src/components/torrents/details/TorrentFileTable.tsxweb/src/components/torrents/TorrentFileTree.tsxweb/src/components/torrents/TorrentDetailsPanel.tsx
🧬 Code graph analysis (1)
web/src/components/torrents/details/TorrentFileTable.tsx (1)
web/src/lib/utils.ts (2)
joinPath(312-317)copyTextToClipboard(193-212)
🔇 Additional comments (2)
web/src/components/torrents/TorrentDetailsPanel.tsx (1)
1502-1502: LGTM! Clean prop propagation.The savePath propagation to TorrentFileTable and TorrentFileTree correctly enables the new "Copy Path" feature by passing the torrent's save_path to child components.
Also applies to: 1557-1557
web/src/components/torrents/TorrentFileTree.tsx (1)
250-250: Good UX improvement with explicit labels.Changing "Rename" to "Rename File" and "Rename Folder" improves clarity, especially in mobile view where context might be less obvious. This aligns well with the PR's goal of improving the mobile experience.
Also applies to: 376-376
Couldn't decide if we should name it
Copy PathorCopy Save Pathbut in my opinion shorter wins so leaving it as it is.Solves #910
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.