Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/components/TorrentDetailsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface Props {
onToggle: () => void
height: number
onHeightChange: (h: number) => void
selectedCount?: number
}

type Tab = 'general' | 'trackers' | 'peers' | 'http' | 'content'
Expand Down Expand Up @@ -767,7 +768,7 @@ function ContentTab({ hash }: { hash: string }) {
return <ContentTabInner key={hash} hash={hash} files={files} />
}

export function TorrentDetailsPanel({ hash, name, category, tags, expanded, onToggle, height, onHeightChange }: Props) {
export function TorrentDetailsPanel({ hash, name, category, tags, expanded, onToggle, height, onHeightChange, selectedCount = 0 }: Props) {
const [tab, setTab] = useState<Tab>('general')
const [dragging, setDragging] = useState(false)
const dragStartY = useRef(0)
Expand Down Expand Up @@ -894,7 +895,7 @@ export function TorrentDetailsPanel({ hash, name, category, tags, expanded, onTo
<div className="text-center">
<MousePointer className="w-8 h-8 mx-auto mb-2" style={{ color: 'var(--border)' }} strokeWidth={1} />
<p className="text-xs uppercase tracking-widest" style={{ color: 'var(--text-muted)' }}>
Select a torrent
{selectedCount > 1 ? `${selectedCount} torrents selected` : 'Select a torrent'}
</p>
</div>
</div>
Expand All @@ -906,3 +907,4 @@ export function TorrentDetailsPanel({ hash, name, category, tags, expanded, onTo
}



13 changes: 13 additions & 0 deletions src/components/TorrentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,16 @@ export function TorrentList() {
}
}

function handleCheckboxToggle(hash: string) {
setSelected((prev) => {
const next = new Set(prev)
if (next.has(hash)) next.delete(hash)
else next.add(hash)
return next
})
setLastSelected(hash)
}

useEffect(() => {
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Escape') {
Expand Down Expand Up @@ -741,6 +751,7 @@ export function TorrentList() {
torrent={t}
selected={selected.has(t.hash)}
onSelect={handleSelect}
onCheckboxToggle={handleCheckboxToggle}
onContextMenu={(e) => handleContextMenu(e, t)}
ratioThreshold={ratioThreshold}
hideAddedTime={hideAddedTime}
Expand Down Expand Up @@ -839,6 +850,7 @@ export function TorrentList() {
onToggle={() => setPanelExpanded(!panelExpanded)}
height={panelHeight}
onHeightChange={setPanelHeight}
selectedCount={selected.size}
/>
</Suspense>

Expand Down Expand Up @@ -878,3 +890,4 @@ export function TorrentList() {
)
}


9 changes: 8 additions & 1 deletion src/components/TorrentRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ interface Props {
torrent: Torrent
selected: boolean
onSelect: (hash: string, multi: boolean, range: boolean) => void
onCheckboxToggle: (hash: string) => void
onContextMenu: (e: React.MouseEvent) => void
ratioThreshold: number
hideAddedTime: boolean
Expand All @@ -287,6 +288,7 @@ export function TorrentRow({
torrent,
selected,
onSelect,
onCheckboxToggle,
onContextMenu,
ratioThreshold,
hideAddedTime,
Expand Down Expand Up @@ -321,7 +323,11 @@ export function TorrentRow({
>
<div className="flex items-center gap-3">
<div
className="shrink-0 w-4 h-4 rounded border transition-colors duration-150 flex items-center justify-center"
onClick={(e) => {
e.stopPropagation()
onCheckboxToggle(torrent.hash)
}}
className="shrink-0 w-4 h-4 rounded border transition-colors duration-150 flex items-center justify-center cursor-pointer"
style={{
borderColor: selected ? 'var(--text-muted)' : 'var(--border)',
backgroundColor: selected ? 'color-mix(in srgb, white 3%, transparent)' : 'transparent',
Expand Down Expand Up @@ -353,3 +359,4 @@ export function TorrentRow({
</tr>
)
}

Loading
Loading