Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Fix accessibility and design-consistency issues found by frontend audit
Anmol Kapil45220b5ee368
diff --git a/src/renderer/index.html b/src/renderer/index.htmlindex 35ec383..2e4832c 100644--- a/src/renderer/index.html+++ b/src/renderer/index.html@@ -1,5 +1,5 @@<!doctype html>-<html>+<html lang="en"><head><meta charset="UTF-8" /><title>Plexo</title>diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.cssindex 8cf2a93..62e30a0 100644--- a/src/renderer/src/assets/main.css+++ b/src/renderer/src/assets/main.css@@ -27,7 +27,10 @@--text: #1d1d1f;--text-secondary: #6e6e73;- --text-tertiary: #8a8a8e;+ /* #8a8a8e (the original design value) is only 3.45:1 against this screen's white/near-white+ backgrounds — fails WCAG AA (4.5:1) for the 9-13px text this token is used at throughout.+ Darkened to the lightest gray that still clears 4.5:1. */+ --text-tertiary: #737377;--border: #e0e0e2;--border-subtle: #ececee;@@ -273,3 +276,13 @@ button {transform: translateY(0) scale(1);}}++@media (prefers-reduced-motion: reduce) {+ *,+ *::before,+ *::after {+ animation-duration: 0.01ms !important;+ animation-iteration-count: 1 !important;+ transition-duration: 0.01ms !important;+ }+}diff --git a/src/renderer/src/components/BlockGrid.tsx b/src/renderer/src/components/BlockGrid.tsxindex 04c11c9..1e7933b 100644--- a/src/renderer/src/components/BlockGrid.tsx+++ b/src/renderer/src/components/BlockGrid.tsx@@ -390,7 +390,12 @@ export function BlockGrid({outline: hoveredIndex === index ? '1.5px solid var(--text-secondary)' : 'none',outlineOffset: 1,overflow: 'hidden',- transition: 'opacity 0.3s, box-shadow 0.15s'+ transition: 'opacity 0.3s, box-shadow 0.15s',+ // A multi-GB file can mean thousands of cells; skip layout/paint work for the+ // ones scrolled out of view (MAX_VISIBLE_ROWS caps what's visible, not what's+ // rendered) rather than hand-rolling a virtualized list for a fixed-size grid.+ contentVisibility: 'auto',+ containIntrinsicSize: `${TARGET_CELL_PX}px ${CELL_HEIGHT_PX}px`}}>{/* One square, one color: the network that actually delivered most of thisdiff --git a/src/renderer/src/components/CyclableChip.tsx b/src/renderer/src/components/CyclableChip.tsxindex 4e8065c..de75033 100644--- a/src/renderer/src/components/CyclableChip.tsx+++ b/src/renderer/src/components/CyclableChip.tsx@@ -23,7 +23,7 @@ export function CyclableChip({type="button"onClick={onClick}title={tooltip}- className="inline-flex w-fit items-center gap-1.5 rounded-[5px] border-[0.5px] px-2.5 py-1 font-mono text-[10.5px] font-semibold whitespace-nowrap select-none"+ className="inline-flex min-h-6 w-fit items-center gap-1.5 rounded-[5px] border-[0.5px] px-2.5 py-1 font-mono text-[10.5px] font-semibold whitespace-nowrap select-none"style={{background: bg,borderColor: border,diff --git a/src/renderer/src/components/DevToolsPanel.tsx b/src/renderer/src/components/DevToolsPanel.tsxindex 59bd400..9aa556f 100644--- a/src/renderer/src/components/DevToolsPanel.tsx+++ b/src/renderer/src/components/DevToolsPanel.tsx@@ -1,5 +1,5 @@import type { NetworkInterfaceKind, SimulatedNetworkConfig } from '@shared/types'-import { useEffect, useState } from 'react'+import { useEffect, useRef, useState } from 'react'import { useAppStore } from '../store/useAppStore'import { describeError, toDisplayPath } from '../utils/format'import { Button } from './ui/button'@@ -60,6 +60,7 @@ export function DevToolsPanel(): React.JSX.Element | null {const [assembleSpeedMBps, setAssembleSpeedMBps] = useState(DEFAULT_ASSEMBLE_SPEED_MBPS)const [starting, setStarting] = useState(false)const [error, setError] = useState<string | null>(null)+ const panelRef = useRef<HTMLDivElement>(null)// Menu item lives in the main process (see installDevMenu in src/main/index.ts) — it can't// reach this component's state directly, so it round-trips through IPC instead.@@ -68,6 +69,38 @@ export function DevToolsPanel(): React.JSX.Element | null {return window.plexo.onToggleDevToolsPanel(() => setOpen((v) => !v))}, [isDev])+ // Base UI's `Popover`/`Dialog` primitives already ship in this codebase for exactly this+ // (focus trap, Escape-to-close, aria-modal) — this panel predates that pattern being pulled in+ // elsewhere. Minimal hand-rolled equivalent here rather than a new dependency for a dev-only tool.+ useEffect(() => {+ if (!open) return+ panelRef.current?.focus()++ const handleKeyDown = (event: KeyboardEvent): void => {+ if (event.key === 'Escape') {+ setOpen(false)+ return+ }+ if (event.key !== 'Tab' || !panelRef.current) return+ const focusable = panelRef.current.querySelectorAll<HTMLElement>(+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'+ )+ if (focusable.length === 0) return+ const first = focusable[0]+ const last = focusable[focusable.length - 1]+ if (event.shiftKey && document.activeElement === first) {+ event.preventDefault()+ last.focus()+ } else if (!event.shiftKey && document.activeElement === last) {+ event.preventDefault()+ first.focus()+ }+ }++ document.addEventListener('keydown', handleKeyDown)+ return () => document.removeEventListener('keydown', handleKeyDown)+ }, [open])+if (!isDev) return nullconst effectiveDestinationDir = destinationDir || downloadsDir@@ -138,19 +171,31 @@ export function DevToolsPanel(): React.JSX.Element | null {if (event.target === event.currentTarget) setOpen(false)}}>- <div className="flex max-h-[calc(100%-60px)] w-[380px] flex-col gap-3 overflow-y-auto rounded-[12px] border-[0.5px] border-[var(--border-strong)] bg-card p-4 shadow-[0_8px_30px_rgba(0,0,0,0.4)]">+ <div+ ref={panelRef}+ role="dialog"+ aria-modal="true"+ aria-labelledby="devtools-panel-title"+ tabIndex={-1}+ className="flex max-h-[calc(100%-60px)] w-[380px] flex-col gap-3 overflow-y-auto rounded-[12px] border-[0.5px] border-[var(--border-strong)] bg-card p-4 shadow-[0_8px_30px_rgba(0,0,0,0.4)] outline-none [overscroll-behavior:contain]"+ ><div className="flex items-center justify-between">- <div className="font-sans text-[13px] leading-[1.2] font-bold text-foreground">+ <div+ id="devtools-panel-title"+ className="font-sans text-[13px] leading-[1.2] font-bold text-foreground"+ >Simulate a download</div>- <button+ <Buttontype="button"+ variant="ghost"+ size="icon-xs"onClick={() => setOpen(false)}aria-label="Close"- className="border-none bg-transparent font-sans text-sm leading-none font-semibold text-muted-foreground"+ className="font-sans text-sm leading-none font-semibold text-muted-foreground">×- </button>+ </Button></div><div className="font-sans text-[11.5px] leading-[1.4] text-muted-foreground">Pick a file already on disk to "download" it through the real pipeline —@@ -214,6 +259,7 @@ export function DevToolsPanel(): React.JSX.Element | null {kind: event.target.value as NetworkInterfaceKind})}+ aria-label="Network kind"className={`${rowInputClass} shrink-0`}>{KIND_OPTIONS.map((kind) => (@@ -228,6 +274,7 @@ export function DevToolsPanel(): React.JSX.Element | null {onChange={(event) =>updateNetwork(network.key, { label: event.target.value })}+ aria-label="Network name"className={`${rowInputClass} min-w-0 flex-1`}/><Buttondiff --git a/src/renderer/src/components/NetworkCard.tsx b/src/renderer/src/components/NetworkCard.tsxindex c01058e..9dea729 100644--- a/src/renderer/src/components/NetworkCard.tsx+++ b/src/renderer/src/components/NetworkCard.tsx@@ -4,6 +4,7 @@ import { useAppStore } from '../store/useAppStore'import { resolveNetworkVisual, type NetworkColorId } from '../theme'import { ColorBadge } from './ColorBadge'import { NetworkEditorFields } from './NetworkEditorFields'+import { Button } from './ui/button'import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'@@ -61,6 +62,8 @@ export function NetworkCard({<div className="flex items-center gap-[9px]"><buttontype="button"+ role="checkbox"+ aria-checked={selected}onClick={onToggle}className="flex min-w-0 flex-1 items-center gap-[9px] border-none bg-transparent p-0 text-left [font:inherit] text-inherit">@@ -79,13 +82,15 @@ export function NetworkCard({render={<PopoverTriggerrender={- <button+ <Buttontype="button"+ variant="ghost"+ size="icon-xs"aria-label="Rename or recolor this network"- className="shrink-0 border-none bg-transparent px-1 py-0.5 font-sans text-xs font-bold text-muted-foreground"+ className="shrink-0 font-sans text-xs font-bold text-muted-foreground">⋯- </button>+ </Button>}/>}diff --git a/src/renderer/src/components/NetworkEditorFields.tsx b/src/renderer/src/components/NetworkEditorFields.tsxindex 5d64353..7e155b9 100644--- a/src/renderer/src/components/NetworkEditorFields.tsx+++ b/src/renderer/src/components/NetworkEditorFields.tsx@@ -42,9 +42,12 @@ export function NetworkEditorFields({</div><div className="flex flex-col gap-[5px]">- <label className={fieldLabelClass}>Display Name</label>+ <label htmlFor="network-display-name" className={fieldLabelClass}>+ Display Name+ </label><inputref={inputRef}+ id="network-display-name"type="text"value={name}onChange={(event) => onNameChange(event.target.value)}@@ -53,7 +56,7 @@ export function NetworkEditorFields({}}placeholder={namePlaceholder}autoFocus- className="rounded-[6px] border border-input bg-background px-[9px] py-1.5 font-sans text-[12px] leading-[1.3] font-medium text-foreground outline-none"+ className="rounded-[6px] border border-input bg-background px-[9px] py-1.5 font-sans text-[12px] leading-[1.3] font-medium text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"/></div>@@ -75,7 +78,9 @@ export function NetworkEditorFields({type="button"onClick={() => onColorSelect(undefined)}title="Default color for this network kind"- className={`flex size-[19px] shrink-0 items-center justify-center rounded-full bg-background p-0 ${+ aria-label="Default color for this network kind"+ aria-pressed={!colorId}+ className={`flex size-6 shrink-0 items-center justify-center rounded-full bg-background p-0 ${!colorId ? 'border-2 border-foreground' : 'border border-input'}`}>@@ -89,7 +94,9 @@ export function NetworkEditorFields({type="button"onClick={() => onColorSelect(swatch.id)}title={swatch.label}- className={`size-[19px] shrink-0 rounded-full p-0 ${+ aria-label={swatch.label}+ aria-pressed={isSelected}+ className={`size-6 shrink-0 rounded-full p-0 ${isSelected ? 'scale-110 border-2 border-foreground' : 'border border-transparent'}`}style={{ background: swatch.solid }}diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsxindex b82247a..cb9e929 100644--- a/src/renderer/src/components/NetworkRow.tsx+++ b/src/renderer/src/components/NetworkRow.tsx@@ -11,6 +11,7 @@ import type { NetworkGroup } from '../utils/format'import { formatBytes, formatSpeed } from '../utils/format'import { ColorBadge } from './ColorBadge'import { NetworkEditorFields } from './NetworkEditorFields'+import { Button } from './ui/button'import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'interface NetworkRowProps {@@ -66,7 +67,8 @@ export function NetworkRow({type="button"onClick={() => setExpanded((v) => !v)}title={expanded ? 'Collapse streams' : 'Expand streams'}- className={`inline-flex shrink-0 cursor-pointer items-center gap-[3px] rounded-[4px] border-[0.5px] border-border px-1.5 py-0.5 font-mono text-[10px] leading-none font-medium select-none ${+ aria-expanded={expanded}+ className={`inline-flex min-h-6 shrink-0 cursor-pointer items-center gap-[3px] rounded-[4px] border-[0.5px] border-border px-1.5 py-0.5 font-mono text-[10px] leading-none font-medium select-none ${expanded ? 'bg-secondary text-foreground' : 'bg-card text-[var(--text-secondary)]'}`}>@@ -76,14 +78,16 @@ export function NetworkRow({<Popover open={editing} onOpenChange={setEditing}><PopoverTriggerrender={- <button+ <Buttontype="button"+ variant="ghost"+ size="icon-xs"title="Rename or recolor this network"aria-label="Rename or recolor this network"- className="shrink-0 border-none bg-transparent px-1 py-0.5 font-sans text-xs font-bold text-muted-foreground"+ className="shrink-0 font-sans text-xs font-bold text-muted-foreground">⋯- </button>+ </Button>}/><PopoverContent className="w-[276px]">diff --git a/src/renderer/src/components/ThemeToggle.tsx b/src/renderer/src/components/ThemeToggle.tsxindex 2ed221e..f02457d 100644--- a/src/renderer/src/components/ThemeToggle.tsx+++ b/src/renderer/src/components/ThemeToggle.tsx@@ -72,6 +72,7 @@ export function ThemeToggle(): React.JSX.Element {<buttontype="button"title={`${current.label} — click to change`}+ aria-label={`${current.label} — click to change`}onClick={cycle}className="flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-[6px] border-[0.5px] border-border bg-secondary text-[var(--text-secondary)] [-webkit-app-region:no-drag]">diff --git a/src/renderer/src/components/ThroughputChart.tsx b/src/renderer/src/components/ThroughputChart.tsxindex c782543..0bb66e6 100644--- a/src/renderer/src/components/ThroughputChart.tsx+++ b/src/renderer/src/components/ThroughputChart.tsx@@ -1,3 +1,5 @@+import { formatSpeed } from '../utils/format'+const WIDTH = 560const HEIGHT = 130@@ -46,11 +48,16 @@ export function ThroughputChart({.map((value, i) => `${(i * xStep).toFixed(1)},${toY(value).toFixed(1)}`).join(' ')+ const peakTotal = Math.max(0, ...totals)+ const latestTotal = totals[totals.length - 1] ?? 0+return (<svgviewBox={`0 0 ${WIDTH} ${HEIGHT}`}preserveAspectRatio="none"className="mt-[7px] block h-[104px] w-full"+ role="img"+ aria-label={`Combined throughput over time. Currently ${formatSpeed(latestTotal)}, peak ${formatSpeed(peakTotal)}.`}><g stroke="var(--border)" strokeWidth={1}><line x1={0} y1={HEIGHT * 0.33} x2={WIDTH} y2={HEIGHT * 0.33} />diff --git a/src/renderer/src/screens/CompleteScreen.tsx b/src/renderer/src/screens/CompleteScreen.tsxindex 74b8368..e9e32a2 100644--- a/src/renderer/src/screens/CompleteScreen.tsx+++ b/src/renderer/src/screens/CompleteScreen.tsx@@ -98,7 +98,7 @@ export function CompleteScreen({<div className={`${heroClass} text-foreground`}><div className="flex items-center gap-[18px]"><div className="flex size-11 shrink-0 items-center justify-center rounded-full border border-[var(--color-wifi-border)] bg-[var(--color-wifi-bg)]">- <svg viewBox="0 0 24 24" className="size-[21px]">+ <svg viewBox="0 0 24 24" className="size-[21px]" aria-hidden="true"><pathd="M5,13 L10,18 L19,7"fill="none"diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsxindex f5a105d..989a269 100644--- a/src/renderer/src/screens/DownloadingScreen.tsx+++ b/src/renderer/src/screens/DownloadingScreen.tsx@@ -112,7 +112,11 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Revoid window.plexo.pauseDownload(download.id)}}- const handleCancel = (): void => void window.plexo.cancelDownload(download.id)+ const handleCancel = (): void => {+ if (window.confirm('Cancel this download? Progress will be lost.')) {+ void window.plexo.cancelDownload(download.id)+ }+ }const effectiveSpeed = isPaused ? 0 : download.speedBytesPerSecconst speed = splitFormattedBytes(effectiveSpeed)diff --git a/src/renderer/src/screens/ErrorScreen.tsx b/src/renderer/src/screens/ErrorScreen.tsxindex 25778a2..d6c462b 100644--- a/src/renderer/src/screens/ErrorScreen.tsx+++ b/src/renderer/src/screens/ErrorScreen.tsx@@ -48,7 +48,7 @@ export function ErrorScreen({}`}>{cancelled ? (- <svg viewBox="0 0 24 24" className="size-[22px]">+ <svg viewBox="0 0 24 24" className="size-[22px]" aria-hidden="true"><circlecx="12"cy="12"@@ -68,7 +68,7 @@ export function ErrorScreen({/></svg>) : (- <svg viewBox="0 0 24 24" className="size-[22px]">+ <svg viewBox="0 0 24 24" className="size-[22px]" aria-hidden="true"><circlecx="12"cy="12"@@ -151,7 +151,7 @@ export function ErrorScreen({<buttontype="button"onClick={handleCopyUrl}- className={`shrink-0 border-none bg-transparent px-1 py-0.5 font-mono text-[11px] leading-none ${+ className={`min-h-6 shrink-0 border-none bg-transparent px-1 py-0.5 font-mono text-[11px] leading-none ${copied ? 'text-[var(--color-success)]' : 'text-primary'}`}>diff --git a/src/renderer/src/screens/IdleScreen.tsx b/src/renderer/src/screens/IdleScreen.tsxindex b7da20f..13f94e7 100644--- a/src/renderer/src/screens/IdleScreen.tsx+++ b/src/renderer/src/screens/IdleScreen.tsx@@ -179,12 +179,13 @@ export function IdleScreen(): React.JSX.Element {LINK</div><input- type="text"+ type="url"value={url}onChange={(event) => setUrl(event.target.value)}placeholder="https://"+ spellCheck={false}aria-labelledby="idle-link-label"- className="min-w-0 flex-1 border-none bg-transparent font-mono text-[13px] text-foreground outline-none"+ className="min-w-0 flex-1 rounded-[3px] border-none bg-transparent font-mono text-[13px] text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50"/><Buttontype="button"@@ -225,7 +226,7 @@ export function IdleScreen(): React.JSX.Element {disabled={!ready}placeholder="—"aria-labelledby="idle-saveas-label"- className="min-w-0 flex-1 border-none bg-transparent font-mono text-[12.5px] text-foreground outline-none"+ className="min-w-0 flex-1 rounded-[3px] border-none bg-transparent font-mono text-[12.5px] text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50"/>{ready && ready.totalBytes !== null && (<div className="shrink-0 whitespace-nowrap font-mono text-[11px] font-medium text-muted-foreground">