Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Share one subgrid across network rows, drop the bleed-layer workarounds
Anmol Kapil6b10ff6e606b
diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsxindex dc7219d..6783e3a 100644--- a/src/renderer/src/components/NetworkRow.tsx+++ b/src/renderer/src/components/NetworkRow.tsx@@ -1,21 +1,99 @@+import type { BlockState, ChunkState } from '@shared/types'import { useState } from 'react'import { useNetworkVisuals } from '../hooks/useNetworkVisuals'-import type { BlockState } from '@shared/types'-import { DANGER, NETWORK_ROW_GRID_COLUMNS } from '../theme'+import { DANGER } from '../theme'import type { NetworkGroup } from '../utils/format'import { formatBytes, formatSpeed } from '../utils/format'import { ColorBadge } from './ColorBadge'import { NetworkEditPopover } from './NetworkEditPopover'import { TruncatedText } from './TruncatedText'+import { Button } from './ui/button'interface NetworkRowProps {group: NetworkGroupsharePercent: numbertotalBytes?: number | null- totalDownloaded?: numberblocks?: BlockState[]}+// Every row — this one and each expanded stream row — is a direct col-span-full subgrid child of+// DownloadingScreen's networks grid, so all rows share one set of column tracks instead of each+// re-deriving its own and hoping they line up. The grid's side gutters live *inside* its first and+// last tracks (see NETWORK_ROW_GRID_COLUMNS), which is what lets a row's divider and fill be a+// plain border/background on the row itself: its box already reaches both window edges.+const rowClass = 'col-span-full grid grid-cols-subgrid items-center gap-3'++function ProgressBar({+ percent,+ color,+ label,+ className+}: {+ percent: number+ color: string+ label: string+ className: string+}): React.JSX.Element {+ return (+ <div+ role="cell"+ className={`w-full overflow-hidden rounded-full border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)] ${className}`}+ >+ <div+ role="progressbar"+ aria-label={label}+ aria-valuenow={Math.round(percent)}+ className="h-full rounded-full transition-[width] duration-200 ease-out"+ style={{ width: `${percent}%`, background: color }}+ />+ </div>+ )+}++/** What an expanded stream row shows: the block that stream is working on right now (falling back+ * to the one starting at its range, for a stream that hasn't claimed a block yet) and how far+ * along that block is. A completed stream reads as full even when no block backs it. */+function describeStream(+ chunk: ChunkState,+ blocks: BlockState[] | undefined,+ totalBytes: number | null | undefined+): {+ block: BlockState | undefined+ size: number+ downloaded: number+ percent: number+ done: boolean+} {+ const block =+ (chunk.currentBlockIndex != null ? blocks?.[chunk.currentBlockIndex] : undefined) ??+ blocks?.find((b) => b.rangeStart === chunk.rangeStart)++ const isDone = chunk.status === 'completed'+ const range = block ?? chunk+ const size =+ range.rangeEnd !== null+ ? range.rangeEnd - range.rangeStart + 1+ : block+ ? 0+ : totalBytes+ ? totalBytes - chunk.rangeStart+ : 0+ const downloaded = block+ ? block.bytesDownloaded+ : isDone && size > 0+ ? size+ : chunk.bytesDownloaded+ const percent = size > 0 ? Math.min(100, Math.max(0, (downloaded / size) * 100)) : 0++ return {+ block,+ size,+ downloaded,+ percent,+ done: block?.status === 'completed' || isDone || percent >= 100+ }+}+export function NetworkRow({group,sharePercent,@@ -27,210 +105,186 @@ export function NetworkRow({const hasError = group.chunks.some((chunk) => chunk.status === 'error')const isActive = group.chunks.some((chunk) => chunk.status === 'downloading')- const groupShareDisplay =- group.bytesDownloaded === 0- ? '0%'- : Math.round(sharePercent) === 0 && sharePercent > 0- ? '<1%'- : `${Math.round(sharePercent)}%`+ const rounded = Math.round(sharePercent)+ const shareLabel = group.bytesDownloaded === 0 ? '0%' : rounded === 0 ? '<1%' : `${rounded}%`return (- // A subgrid, not its own independent grid — it inherits the exact column tracks the parent- // grid (DownloadingScreen's networks table, using the same NETWORK_ROW_GRID_COLUMNS) computed- // for the header and every other row, rather than recomputing its own and hoping they match.- <div className="col-span-full grid grid-cols-subgrid items-center gap-3 border-t-[0.5px] border-[var(--border-subtle)] py-[11px]">+ <><div- className="size-2 rounded-full"- style={{- background: hasError ? DANGER : visual.solid,- animation: isActive ? 'plexo-glow 1.8s infinite' : undefined,- opacity: isActive || hasError ? 1 : 0.65- }}- />- <div className="flex min-w-0 items-center gap-[6px]">- <TruncatedText- text={visual.name}- className="font-sans text-[12.5px] leading-[1.2] font-semibold text-foreground"+ role="row"+ className={`${rowClass} border-t-[0.5px] border-[var(--border-subtle)] py-[11px]`}+ >+ <div+ role="cell"+ className="ml-5 size-2 rounded-full"+ style={{+ background: hasError ? DANGER : visual.solid,+ animation: isActive ? 'plexo-glow 1.8s infinite' : undefined,+ opacity: isActive || hasError ? 1 : 0.65+ }}/>- <NetworkEditPopover- interfaceId={group.interfaceId}- interfaceKind={group.interfaceKind}- osName={group.interfaceLabel}+ <div role="cell" className="flex min-w-0 items-center gap-[6px]">+ <TruncatedText+ text={visual.name}+ className="font-sans text-[12.5px] leading-[1.2] font-semibold text-foreground"+ />+ <NetworkEditPopover+ interfaceId={group.interfaceId}+ interfaceKind={group.interfaceKind}+ osName={group.interfaceLabel}+ />+ <Button+ type="button"+ variant="outline"+ size="xs"+ onClick={() => setExpanded((v) => !v)}+ aria-expanded={expanded}+ className="h-auto cursor-pointer rounded-[4px] border-[0.5px] bg-card px-[7px] py-[3px] font-mono text-[10.5px] leading-none font-medium text-[var(--text-secondary)] aria-expanded:bg-secondary dark:bg-card"+ >+ {group.chunks.length} streams+ <span aria-hidden className="text-[7.5px] opacity-75">+ {expanded ? '▲' : '▼'}+ </span>+ </Button>+ </div>+ <ProgressBar+ className="h-1.5"+ label={`${visual.name} progress`}+ percent={+ totalBytes && totalBytes > 0+ ? Math.min(100, (group.bytesDownloaded / totalBytes) * 100)+ : 0+ }+ color={visual.solid}/>- <button- type="button"- onClick={() => setExpanded((v) => !v)}- aria-expanded={expanded}- className={`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-[4px] border-[0.5px] border-border px-[7px] py-[3px] font-mono text-[10.5px] leading-none font-medium select-none ${- expanded ? 'bg-secondary text-foreground' : 'bg-card text-[var(--text-secondary)]'- }`}+ <div+ role="cell"+ className="text-right font-mono text-[11.5px] leading-none font-medium tabular-nums"+ style={{ color: sharePercent > 0 ? 'var(--text)' : 'var(--text-tertiary)' }}>- <span>{group.chunks.length} streams</span>- <span className="text-[7.5px] opacity-75">{expanded ? '▲' : '▼'}</span>- </button>- </div>- <div className="flex min-w-0 items-center">- <div className="h-1.5 flex-1 overflow-hidden rounded-full border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)]">- <div- className="h-full rounded-full transition-[width] duration-[250ms] ease-out"- style={{- width:- totalBytes && totalBytes > 0- ? `${Math.min(100, Math.max(0, (group.bytesDownloaded / totalBytes) * 100))}%`- : '0%',- background: visual.solid- }}- />+ {shareLabel}+ </div>+ <div+ role="cell"+ className="text-right font-mono text-[12.5px] leading-none font-semibold tabular-nums"+ style={{ color: isActive ? visual.text : 'var(--text-tertiary)' }}+ >+ {isActive ? formatSpeed(group.speedBytesPerSec) : '—'}+ </div>+ <div+ role="cell"+ className="pr-5 text-right font-mono text-[11.5px] leading-none text-[var(--text-secondary)] tabular-nums"+ >+ {formatBytes(group.bytesDownloaded)}</div></div>- <div- className="text-right font-mono text-[11.5px] leading-none font-medium tabular-nums"- style={{ color: sharePercent > 0 ? 'var(--text)' : 'var(--text-tertiary)' }}- >- {groupShareDisplay}- </div>- <div- className="text-right font-mono text-[12.5px] leading-none font-semibold tabular-nums"- style={{ color: isActive ? visual.text : 'var(--text-tertiary)' }}- >- {isActive ? formatSpeed(group.speedBytesPerSec) : '—'}- </div>- <div className="text-right font-mono text-[11.5px] leading-none text-[var(--text-secondary)] tabular-nums">- {formatBytes(group.bytesDownloaded)}- </div>- {expanded && group.chunks.length > 0 && (- <div className="col-span-full flex flex-col gap-1.5 border-y-[0.5px] border-[var(--border-subtle)] bg-card px-5 pt-1.5 pb-2.5">- {group.chunks.map((chunk, index) => {- const isChunkActive = chunk.status === 'downloading'- const isChunkDone = chunk.status === 'completed'- const isChunkError = chunk.status === 'error'-- const currentBlock =- blocks && blocks.length > 0- ? ((chunk.currentBlockIndex != null- ? blocks[chunk.currentBlockIndex]- : undefined) ?? blocks.find((b) => b.rangeStart === chunk.rangeStart))- : undefined-- const chunkSize = currentBlock- ? currentBlock.rangeEnd !== null- ? currentBlock.rangeEnd - currentBlock.rangeStart + 1- : 0- : chunk.rangeEnd !== null- ? chunk.rangeEnd - chunk.rangeStart + 1- : totalBytes- ? totalBytes - chunk.rangeStart- : 0-- const chunkBytesDownloaded = currentBlock- ? currentBlock.bytesDownloaded- : isChunkDone && chunkSize > 0- ? chunkSize- : chunk.bytesDownloaded-- const chunkPercent =- chunkSize > 0- ? Math.min(100, Math.max(0, (chunkBytesDownloaded / chunkSize) * 100))- : 0-- const isCurrentBlockDone =- currentBlock?.status === 'completed' ||- isChunkDone ||- (chunkSize > 0 && chunkPercent >= 100)-- return (- <div- key={chunk.id}- className="grid items-center gap-3 py-[3px] font-mono text-[11px] leading-[1.2]"- style={{ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS }}- >- <div className="flex justify-center">- <div- className="size-[5px] rounded-full"- style={{- background: isChunkError- ? DANGER- : isCurrentBlockDone- ? visual.solid- : isChunkActive- ? visual.solid- : 'var(--icon-muted)',- opacity: isChunkActive || isCurrentBlockDone ? 1 : 0.4- }}- />- </div>-- <div className="flex min-w-0 items-center gap-[6px]">- <span className="font-medium whitespace-nowrap text-foreground">- Stream #{index + 1}- </span>- {currentBlock && (- <span className="rounded-[3px] border-[0.5px] border-border bg-secondary px-[4.5px] py-[1.5px] font-mono text-[9px] leading-none whitespace-nowrap text-muted-foreground">- Chunk #{currentBlock.index + 1}- </span>- )}- {isChunkActive ? (- <ColorBadge- bg={visual.bg}- border={visual.border}- text={visual.text}- className="h-auto rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em]"- >- ACTIVE- </ColorBadge>- ) : isCurrentBlockDone ? (- <span className="text-[9.5px] text-muted-foreground">Done</span>- ) : chunk.status === 'paused' ? (- <span className="text-[9.5px] text-muted-foreground">Paused</span>- ) : chunk.status === 'retrying' ? (- <span className="text-[9.5px] text-destructive">Retrying…</span>- ) : (- <span className="text-[9.5px] text-muted-foreground">Waiting</span>- )}- </div>-- <div className="flex min-w-0 items-center">- <div className="h-[5px] flex-1 overflow-hidden rounded-full border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)]">- <div- className="h-full rounded-full transition-[width] duration-200 ease-out"- style={{- width: isCurrentBlockDone ? '100%' : `${chunkPercent}%`,- background: isChunkError ? DANGER : visual.solid- }}- />- </div>- </div>+ {expanded &&+ group.chunks.map((chunk, index) => {+ const isFirst = index === 0+ const isLast = index === group.chunks.length - 1+ const isChunkActive = chunk.status === 'downloading'+ const isChunkError = chunk.status === 'error'+ const stream = describeStream(chunk, blocks, totalBytes)+ const statusText = stream.done+ ? 'Done'+ : chunk.status === 'paused'+ ? 'Paused'+ : chunk.status === 'retrying'+ ? 'Retrying…'+ : 'Waiting'++ return (+ <div+ role="row"+ key={chunk.id}+ className={`${rowClass} border-[var(--border-subtle)] bg-card py-[6px] font-mono text-[11px] leading-[1.2] ${+ isFirst ? 'border-t-[0.5px] pt-[9px]' : ''+ } ${isLast ? 'border-b-[0.5px] pb-[11px]' : ''}`}+ >+ <div role="cell" className="flex justify-center pl-5"><div- className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"+ className="size-[5px] rounded-full"style={{- color: isCurrentBlockDone- ? visual.text- : isChunkActive- ? 'var(--text)'- : 'var(--text-tertiary)'+ background: isChunkError+ ? DANGER+ : isChunkActive || stream.done+ ? visual.solid+ : 'var(--icon-muted)',+ opacity: isChunkActive || stream.done ? 1 : 0.4}}- >- {Math.round(chunkPercent)}%- </div>+ />+ </div>- <div- className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"- style={{ color: isChunkActive ? visual.text : 'var(--text-tertiary)' }}- >- {isChunkActive ? formatSpeed(chunk.speedBytesPerSec) : '—'}- </div>-- <div className="text-right font-mono text-[11px] leading-none whitespace-nowrap text-[var(--text-secondary)] tabular-nums">- {chunkSize > 0- ? `${formatBytes(chunkBytesDownloaded)} / ${formatBytes(chunkSize)}`- : formatBytes(chunkBytesDownloaded)}- </div>+ <div role="cell" className="flex min-w-0 items-center gap-[6px]">+ <span className="font-medium whitespace-nowrap text-foreground">+ Stream #{index + 1}+ </span>+ {stream.block && (+ <span className="rounded-[3px] border-[0.5px] border-border bg-secondary px-[4.5px] py-[1.5px] font-mono text-[9px] leading-none whitespace-nowrap text-muted-foreground">+ Chunk #{stream.block.index + 1}+ </span>+ )}+ {isChunkActive ? (+ <ColorBadge+ bg={visual.bg}+ border={visual.border}+ text={visual.text}+ className="h-auto rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em]"+ >+ ACTIVE+ </ColorBadge>+ ) : (+ <span+ className={`text-[9.5px] ${+ chunk.status === 'retrying' ? 'text-destructive' : 'text-muted-foreground'+ }`}+ >+ {statusText}+ </span>+ )}</div>- )- })}- </div>- )}- </div>++ <ProgressBar+ className="h-[5px]"+ label={`Stream #${index + 1} progress`}+ percent={stream.done ? 100 : stream.percent}+ color={isChunkError ? DANGER : visual.solid}+ />++ <div+ role="cell"+ className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"+ style={{+ color: stream.done+ ? visual.text+ : isChunkActive+ ? 'var(--text)'+ : 'var(--text-tertiary)'+ }}+ >+ {Math.round(stream.percent)}%+ </div>++ <div+ role="cell"+ className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"+ style={{ color: isChunkActive ? visual.text : 'var(--text-tertiary)' }}+ >+ {isChunkActive ? formatSpeed(chunk.speedBytesPerSec) : '—'}+ </div>++ <div+ role="cell"+ className="pr-5 text-right font-mono text-[11px] leading-none whitespace-nowrap text-[var(--text-secondary)] tabular-nums"+ >+ {stream.size > 0+ ? `${formatBytes(stream.downloaded)} / ${formatBytes(stream.size)}`+ : formatBytes(stream.downloaded)}+ </div>+ </div>+ )+ })}+ </>)}diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsxindex 7c2b9fd..15f640f 100644--- a/src/renderer/src/screens/DownloadingScreen.tsx+++ b/src/renderer/src/screens/DownloadingScreen.tsx@@ -12,7 +12,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '../components/ui/tooltiimport { useNetworkPolling } from '../hooks/useNetworkPolling'import { useNetworkVisuals } from '../hooks/useNetworkVisuals'import { useAppStore } from '../store/useAppStore'-import { NETWORK_ROW_GRID_COLUMNS } from '../theme'+import { KIND_PALETTE, NETWORK_ROW_GRID_COLUMNS } from '../theme'import {dirnameOf,fileExtensionBadge,@@ -29,18 +29,8 @@ import {// light/dark theme — scoping the theme variables it reads (--text, --border, ...) to these// literal values keeps its own children (labels, the combine diagram, the chart) legible no// matter which OS appearance the rest of the window is following.-const heroClass = 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px]'-const sectionHeaderClass =- 'font-mono text-[10px] leading-none tracking-[0.16em] text-muted-foreground uppercase'--// Build list of toggleable comparison metrics for active networks (only "X× [NETWORK] ALONE").-interface SpeedChipOption {- label: string- tooltip: string- color: string- bg: string- border: string-}+const heroClass =+ 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px] text-foreground'/** Inline "·" separator between adjacent stats. `shrink` pins it at its natural width inside a* flex row that might otherwise squeeze it (footer rows), matching each call site's prior style. */@@ -56,6 +46,59 @@ function InlineStat({ label, value }: { label: string; value: string }): React.J)}+/** The hero band's headline figure: a tracked-out label over one big tabular number and its unit.+ * Both states of the band (total speed, assembly progress) are this same shape. */+function BigStat({+ label,+ value,+ unit,+ valueClass+}: {+ label: string+ value: string | number+ unit?: string+ valueClass: string+}): React.JSX.Element {+ return (+ <>+ <div className="font-mono text-[10px] leading-none font-medium tracking-[0.2em] text-muted-foreground">+ {label}+ </div>+ <div className="flex items-baseline gap-[7px]">+ <div+ className={`font-mono text-[38px] leading-[0.88] font-semibold tracking-[-0.03em] tabular-nums ${valueClass}`}+ >+ {value}+ </div>+ {unit && (+ <div className="font-mono text-[12px] leading-none font-medium text-muted-foreground">+ {unit}+ </div>+ )}+ </div>+ </>+ )+}++/** Says why a footer action is unavailable, and only while it is — a tooltip on a button you can+ * actually press has nothing to explain. */+function WhileAssembling({+ active,+ text,+ children+}: {+ active: boolean+ text: string+ children: React.ReactElement+}): React.JSX.Element {+ return (+ <Tooltip open={active ? undefined : false}>+ <TooltipTrigger render={children} />+ <TooltipContent>{text}</TooltipContent>+ </Tooltip>+ )+}+export function DownloadingScreen({ download }: { download: DownloadState }): React.JSX.Element {useNetworkPolling(true)@@ -128,10 +171,6 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst visuals = groups.map((group) =>networkVisual(group.interfaceId, group.interfaceKind, group.interfaceLabel))- const activeGroups = groups.filter((group) =>- group.chunks.some((chunk) => chunk.status === 'downloading')- )-const [chipModeIndex, setChipModeIndex] = useState(0)const totalRetries = download.chunks.reduce((sum, chunk) => sum + chunk.retryCount, 0)@@ -139,71 +178,49 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst avgSpeedBytesPerSec = elapsedSeconds > 0 ? download.bytesDownloaded / elapsedSeconds : 0- const chipOptions: SpeedChipOption[] = []- if (groups.length > 1 && !isPaused) {- const sortedIndices = groups- .map((_, i) => i)- .filter((i) =>- download.speedBytesPerSec > 0- ? groups[i].speedBytesPerSec > 0- : groups[i].bytesDownloaded > 0- )- .sort((a, b) => {- const valA =- download.speedBytesPerSec > 0 ? groups[a].speedBytesPerSec : groups[a].bytesDownloaded- const valB =- download.speedBytesPerSec > 0 ? groups[b].speedBytesPerSec : groups[b].bytesDownloaded- return valB - valA- })-- for (const idx of sortedIndices) {- const g = groups[idx]- const visual = visuals[idx]- const name = visual.name.toUpperCase()- if (download.speedBytesPerSec > 0 && g.speedBytesPerSec > 0) {- const ratio = download.speedBytesPerSec / g.speedBytesPerSec- if (ratio >= 1.05) {- chipOptions.push({- label: `${ratio.toFixed(1)}× ${name} ALONE`,- tooltip: `Total speed is ${ratio.toFixed(1)}× faster than ${visual.name} alone`,- color: visual.text,- bg: visual.bg,- border: visual.border- })- }- } else if (download.bytesDownloaded > 0 && g.bytesDownloaded > 0) {- const ratio = download.bytesDownloaded / g.bytesDownloaded- if (ratio >= 1.05) {- chipOptions.push({- label: `${ratio.toFixed(1)}× ${name} ALONE`,- tooltip: `Total downloaded is ${ratio.toFixed(1)}× compared to ${visual.name} alone`,- color: visual.text,- bg: visual.bg,- border: visual.border- })- }- }- }- }+ // "N× WIFI ALONE": the combined download measured against one network on its own, by whichever+ // metric is live — current speed while bytes are moving, total downloaded otherwise. A network+ // that carried the download barely faster than it would alone (< 1.05×) makes no point worth a+ // chip. Cycling order is fastest network (smallest multiple) first, as it was.+ const bySpeed = download.speedBytesPerSec > 0+ const totalMetric = bySpeed ? download.speedBytesPerSec : download.bytesDownloaded+ const chipOptions =+ groups.length > 1 && !isPaused && totalMetric > 0+ ? groups+ .map((group, index) => ({+ ratio: totalMetric / (bySpeed ? group.speedBytesPerSec : group.bytesDownloaded),+ visual: visuals[index]+ }))+ .filter(({ ratio }) => Number.isFinite(ratio) && ratio >= 1.05)+ .sort((a, b) => a.ratio - b.ratio)+ .map(({ ratio, visual }) => ({+ visual,+ label: `${ratio.toFixed(1)}× ${visual.name.toUpperCase()} ALONE`,+ tooltip: bySpeed+ ? `Total speed is ${ratio.toFixed(1)}× faster than ${visual.name} alone`+ : `Total downloaded is ${ratio.toFixed(1)}× compared to ${visual.name} alone`+ }))+ : []const activeChipOption =chipOptions.length > 0 ? chipOptions[chipModeIndex % chipOptions.length] : null+ const statusBadge = isAssembling+ ? { label: 'ASSEMBLING', palette: KIND_PALETTE.ethernet }+ : isPaused+ ? { label: 'PAUSED', palette: KIND_PALETTE.usb }+ : null+const throughputStatusLabel = isAssembling? 'ASSEMBLING': isPaused? null: `LAST ${speedHistory.length}S`- const networksStatusLabel = isAssembling- ? 'assembling'- : isPaused- ? null- : `${activeGroups.length} active`const pauseResumeLabel = resuming ? 'Resuming…' : isPaused ? 'Resume' : 'Pause'return (<div className="flex h-full flex-col bg-background">- <div className={`${heroClass} text-foreground`}>+ <div className={heroClass}><div className="flex items-center gap-[14px]"><CombineDiagramnetworks={groups.map((group, index) => ({@@ -217,38 +234,20 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re<div className="flex min-w-[130px] shrink-0 flex-col gap-[7px]">{isAssembling ? (- <>- <div className="font-mono text-[10px] leading-none font-medium tracking-[0.2em] text-muted-foreground">- ASSEMBLING- </div>- <div className="flex items-baseline gap-[7px]">- <div className="font-mono text-[38px] leading-[0.88] font-semibold tracking-[-0.03em] tabular-nums text-[var(--color-ethernet)]">- {assemblePercent}- </div>- <div className="font-mono text-[12px] leading-none font-medium text-muted-foreground">- %- </div>- </div>- </>+ <BigStat+ label="ASSEMBLING"+ value={assemblePercent}+ unit="%"+ valueClass="text-[var(--color-ethernet)]"+ />) : (<>- <div className="flex items-center gap-1.5 font-mono text-[10px] leading-none font-medium tracking-[0.2em] text-muted-foreground">- <span>TOTAL SPEED</span>- </div>- <div className="flex items-baseline gap-[7px]">- <div- className={`font-mono text-[38px] leading-[0.88] font-semibold tracking-[-0.03em] tabular-nums ${- isPaused ? 'text-muted-foreground' : 'text-foreground'- }`}- >- {isPaused ? '—' : speed.value}- </div>- {!isPaused && (- <div className="font-mono text-[12px] leading-none font-medium text-muted-foreground">- {speed.unit}/s- </div>- )}- </div>+ <BigStat+ label="TOTAL SPEED"+ value={isPaused ? '—' : speed.value}+ unit={isPaused ? undefined : `${speed.unit}/s`}+ valueClass={isPaused ? 'text-muted-foreground' : 'text-foreground'}+ /><div className="flex items-center gap-2 font-mono text-[10px] leading-none font-medium tabular-nums text-muted-foreground"><InlineStat label="AVG" value={formatSpeed(avgSpeedBytesPerSec)} /><Dot />@@ -256,7 +255,10 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re</div>{isPaused? download.error && (- <div className="mt-0.5 font-sans text-[11px] leading-[1.2] font-medium text-destructive">+ <div+ role="alert"+ className="mt-0.5 font-sans text-[11px] leading-[1.2] font-medium text-destructive"+ >{download.error}</div>)@@ -264,9 +266,9 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re<CyclableChiplabel={activeChipOption.label}tooltip={`${activeChipOption.tooltip}${chipOptions.length > 1 ? ' (click to toggle)' : ''}`}- bg={activeChipOption.bg}- border={activeChipOption.border}- color={activeChipOption.color}+ bg={activeChipOption.visual.bg}+ border={activeChipOption.visual.border}+ color={activeChipOption.visual.text}cyclable={chipOptions.length > 1}onClick={() => setChipModeIndex((i) => (i + 1) % chipOptions.length)}/>@@ -325,24 +327,14 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re</span></>)}- {isPaused && (+ {statusBadge && (<ColorBadge- bg="var(--color-usb-bg)"- border="var(--color-usb-border)"- text="var(--color-usb)"+ bg={statusBadge.palette.bg}+ border={statusBadge.palette.border}+ text={statusBadge.palette.text}className="h-auto rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]">- PAUSED- </ColorBadge>- )}- {isAssembling && (- <ColorBadge- bg="var(--color-ethernet-bg)"- border="var(--color-ethernet-border)"- text="var(--color-ethernet-text)"- className="h-auto rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]"- >- ASSEMBLING+ {statusBadge.label}</ColorBadge>)}</div>@@ -362,41 +354,42 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re</div><div className="flex-1 overflow-x-hidden overflow-y-auto">- <div className="flex items-baseline justify-between p-[0_20px_8px]">- <div className={sectionHeaderClass}>Networks</div>- <div className="shrink-0 font-mono text-[10.5px] leading-none text-muted-foreground">- {groups.length} combined · {download.chunks.length} streams- {networksStatusLabel ? ` · ${networksStatusLabel}` : ''}- </div>- </div><div- className="grid gap-x-3 px-5"+ role="table"+ aria-label="Networks"+ className="grid gap-x-3"style={{ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS }}>- <div className="col-span-full grid grid-cols-subgrid gap-x-3 border-b border-border pt-2.5 pb-[7px] font-mono text-[9.5px] leading-none tracking-[0.12em] text-muted-foreground uppercase">- <div />- <div>Network</div>- <div>Progress</div>- <div className="text-right">Share</div>- <div className="text-right">Speed</div>- <div className="text-right">Downloaded</div>+ <div+ role="row"+ className="col-span-full grid grid-cols-subgrid gap-x-3 border-b border-border pt-2.5 pb-[7px] font-mono text-[9.5px] leading-none tracking-[0.12em] text-muted-foreground uppercase"+ >+ <div role="columnheader" aria-label="Status" />+ <div role="columnheader">Network</div>+ <div role="columnheader">Progress</div>+ <div role="columnheader" className="text-right">+ Share+ </div>+ <div role="columnheader" className="text-right">+ Speed+ </div>+ <div role="columnheader" className="pr-5 text-right">+ Downloaded+ </div></div>- {groups.map((group) => {- const sharePercent =- totalDownloadedByNetworks > 0- ? (group.bytesDownloaded / totalDownloadedByNetworks) * 100- : 0- return (- <NetworkRow- key={group.interfaceId}- group={group}- sharePercent={sharePercent}- totalBytes={download.totalBytes}- totalDownloaded={totalDownloadedByNetworks}- blocks={download.blocks}- />- )- })}+ {groups.map((group) => (+ <NetworkRow+ key={group.interfaceId}+ group={group}+ sharePercent={+ totalDownloadedByNetworks > 0+ ? (group.bytesDownloaded / totalDownloadedByNetworks) * 100+ : 0+ }+ totalBytes={download.totalBytes}+ blocks={download.blocks}+ />+ ))}</div></div>@@ -423,36 +416,26 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re</>)}</div>- <Tooltip open={isAssembling ? undefined : false}>- <TooltipTrigger- render={- <Button- type="button"- variant={isPaused ? 'default' : 'secondary'}- onClick={handlePauseResume}- disabled={isAssembling || resuming}- >- {pauseResumeLabel}- </Button>- }- />- <TooltipContent>Can't pause while assembling the file</TooltipContent>- </Tooltip>- <Tooltip open={isAssembling ? undefined : false}>- <TooltipTrigger- render={- <Button- type="button"- variant="destructive"- onClick={handleCancel}- disabled={isAssembling}- >- Cancel- </Button>- }- />- <TooltipContent>Can't cancel while assembling the file</TooltipContent>- </Tooltip>+ <WhileAssembling active={isAssembling} text="Can’t pause while assembling the file">+ <Button+ type="button"+ variant={isPaused ? 'default' : 'secondary'}+ onClick={handlePauseResume}+ disabled={isAssembling || resuming}+ >+ {pauseResumeLabel}+ </Button>+ </WhileAssembling>+ <WhileAssembling active={isAssembling} text="Can’t cancel while assembling the file">+ <Button+ type="button"+ variant="destructive"+ onClick={handleCancel}+ disabled={isAssembling}+ >+ Cancel+ </Button>+ </WhileAssembling></div></div>)diff --git a/src/renderer/src/theme.ts b/src/renderer/src/theme.tsindex 4874fcc..a02bc27 100644--- a/src/renderer/src/theme.ts+++ b/src/renderer/src/theme.ts@@ -35,15 +35,26 @@ export const KIND_PALETTE: Record<NetworkInterfaceKind, KindPalette> = {// The brand amber doubles as the USB network color, exactly as in the design.export const DANGER = 'var(--color-danger)'+// The table's 20px side gutters live inside the first and last tracks (30px = 20 + the status+// dot's 10, 160px = 140 + 20) rather than as padding on the grid itself. A subgrid row can only+// paint inside its parent's content box, so with the padding on the grid every row divider and+// every expanded row's fill stopped 20px short of the window and had to be faked by an+// absolutely-positioned bleed layer behind each row. With the gutters as tracks, a row box+// already spans window edge to window edge and a plain border/background does the job.+//// Network sizes to its content (name + streams pill + "⋯" button) instead of a guessed fixed-// px — `minmax(0, max-content)` grows it to fit whatever's actually in that cell (no dead-// trailing space before Progress) and, just as importantly, lets it shrink below that on a-// narrow window instead of holding a fixed width the row can't fit in. Progress is the one-// column that should visually scale with the window (the bar already fills 100% of its track),-// so it alone takes the leftover space; that also keeps the gap after the bar, into Share, the-// same fixed 12px as every other column boundary — instead of Network's gap growing while-// Progress's stays put.-export const NETWORK_ROW_GRID_COLUMNS = '10px minmax(0, max-content) 1fr 48px 78px 90px'+// px — `max-content` grows it to fit whatever's actually in that cell (no dead trailing space+// before Progress) and, just as importantly, lets it shrink on a narrow window instead of+// holding a fixed width the row can't fit in. Progress is the one column that should visually+// scale with the window (the bar already fills 100% of its track), so it alone takes the+// leftover space; that also keeps the gap after the bar, into Share, the same fixed 12px as+// every other column boundary — instead of Network's gap growing while Progress's stays put.+// The 190px floor exists because every row shares this one subgrid track, collapsed and expanded+// alike: with a floor of 0, expanding a group mounts "Stream #N · Chunk #N · <status>" rows into+// the same column, which is routinely wider than the collapsed row's "<name> · N streams" — so+// the track (and everything right of it) would jump wider the instant you expand. 190px already+// covers that expanded content, so expanding never grows the track further.+export const NETWORK_ROW_GRID_COLUMNS = '30px minmax(190px, max-content) 1fr 48px 78px 160px'// A curated set of user-selectable network colors, distinct from (and in addition to) the// kind defaults above — each ships its own on-solid text color so it's legible without having