Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Redesign UI to v2: group by physical network, custom titlebar, per-network customization
Anmol Kapil323ffae899cf
diff --git a/src/main/download/downloadManager.ts b/src/main/download/downloadManager.tsindex f45d48c..8f73de8 100644--- a/src/main/download/downloadManager.ts+++ b/src/main/download/downloadManager.ts@@ -75,9 +75,9 @@ function splitIntoRanges(return ranges}-// Defensive cap independent of whatever the renderer sends — connections are+// Defensive cap independent of whatever the renderer sends — chunks are// distributed round-robin across interfaces, not tied 1:1 to them anymore.-const MAX_CONNECTIONS = 32+const MAX_CHUNKS = 32const MAX_CHUNK_RETRIES = 5const RETRY_BASE_DELAY_MS = 1000@@ -197,16 +197,16 @@ export class DownloadManager {requestPayload.suggestedFileName)- const connectionCount = Math.max(1, Math.min(requestPayload.connectionCount, MAX_CONNECTIONS))+ const chunkCount = Math.max(1, Math.min(requestPayload.chunkCount, MAX_CHUNKS))const canSplit =- requestPayload.supportsRanges && requestPayload.totalBytes > 0 && connectionCount > 1+ requestPayload.supportsRanges && requestPayload.totalBytes > 0 && chunkCount > 1const ranges = canSplit- ? splitIntoRanges(requestPayload.totalBytes, connectionCount)+ ? splitIntoRanges(requestPayload.totalBytes, chunkCount): [{ start: 0, end: requestPayload.totalBytes > 0 ? requestPayload.totalBytes - 1 : null }]- // Round-robin: connections no longer have to match interfaces 1:1, so an- // interface can carry more than one connection's worth of chunks.+ // Round-robin: chunks no longer have to match interfaces 1:1, so a single+ // physical network can carry more than one chunk's worth of connections.const activeInterfaces = canSplit- ? Array.from({ length: connectionCount }, (_, index) => interfaces[index % interfaces.length])+ ? Array.from({ length: chunkCount }, (_, index) => interfaces[index % interfaces.length]): [interfaces[0]]const chunks: ChunkState[] = ranges.map((range, index) => ({@@ -218,7 +218,8 @@ export class DownloadManager {rangeEnd: range.end,bytesDownloaded: 0,speedBytesPerSec: 0,- status: 'pending'+ status: 'pending',+ retryCount: 0}))const state: DownloadState = {@@ -445,7 +446,8 @@ export class DownloadManager {rangeEnd: originalRangeEnd,bytesDownloaded: 0,speedBytesPerSec: 0,- status: 'pending'+ status: 'pending',+ retryCount: 0}runtime.state.chunks.push(newChunk)this.scheduleUpdate(runtime)@@ -505,6 +507,7 @@ export class DownloadManager {const message = error instanceof Error ? error.message : String(error)chunk.error = messageattempt += 1+ chunk.retryCount += 1if (attempt > MAX_CHUNK_RETRIES) {chunk.status = 'error'diff --git a/src/main/index.ts b/src/main/index.tsindex e90abe8..750b6e0 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -21,6 +21,12 @@ function createWindow(): void {// (which briefly exposes the raw window background) doesn't flash white.backgroundColor: nativeTheme.shouldUseDarkColors ? '#1c1c1e' : '#ffffff',...(process.platform === 'linux' ? { icon } : {}),+ // Design v2 draws its own logo + status readout where the title normally sits — on macOS,+ // keep the real traffic lights (still native, still draggable) but let the renderer's own+ // title bar occupy the rest of the strip instead of an OS-drawn title.+ ...(process.platform === 'darwin'+ ? { titleBarStyle: 'hiddenInset', trafficLightPosition: { x: 16, y: 16 } }+ : {}),webPreferences: {preload: join(__dirname, '../preload/index.js'),sandbox: falsediff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.tsindex de80445..1da6394 100644--- a/src/main/ipc/handlers.ts+++ b/src/main/ipc/handlers.ts@@ -1,11 +1,16 @@import { clipboard, dialog, ipcMain, shell, type BrowserWindow } from 'electron'import { IpcChannels } from '../../shared/ipc-channels'-import type { NetworkInterfaceInfo, StartDownloadRequest } from '../../shared/types'+import type {+ NetworkInterfaceInfo,+ NetworkPreference,+ StartDownloadRequest+} from '../../shared/types'import { DownloadManager } from '../download/downloadManager'import { getDefaultDownloadsDir, getHomeDir } from '../download/paths'import { probeUrl } from '../download/probe'import { measureLatencies } from '../network/latency'import { listActiveInterfaces } from '../network/interfaces'+import { loadNetworkPreferences, saveNetworkPreference } from '../network/preferences'const NETWORK_SETTINGS_URL = 'x-apple.systempreferences:com.apple.preference.network'@@ -23,6 +28,13 @@ export function registerIpcHandlers(getWindow: () => BrowserWindow | null): DownipcMain.handle(IpcChannels.pingInterfaces, async () => measureLatencies(cachedInterfaces))+ ipcMain.handle(IpcChannels.getNetworkPreferences, async () => loadNetworkPreferences())++ ipcMain.handle(+ IpcChannels.setNetworkPreference,+ async (_event, id: string, patch: NetworkPreference) => saveNetworkPreference(id, patch)+ )+ipcMain.handle(IpcChannels.openNetworkSettings, async () => {await shell.openExternal(NETWORK_SETTINGS_URL)})diff --git a/src/main/network/preferences.ts b/src/main/network/preferences.tsnew file mode 100644index 0000000..73d0373--- /dev/null+++ b/src/main/network/preferences.ts@@ -0,0 +1,39 @@+import { readFile, writeFile } from 'node:fs/promises'+import { join } from 'node:path'+import { app } from 'electron'+import type { NetworkPreference, NetworkPreferences } from '../../shared/types'++function preferencesPath(): string {+ return join(app.getPath('userData'), 'network-preferences.json')+}++export async function loadNetworkPreferences(): Promise<NetworkPreferences> {+ try {+ const raw = await readFile(preferencesPath(), 'utf-8')+ return JSON.parse(raw) as NetworkPreferences+ } catch {+ // No file yet (first run) or it's unreadable/corrupt — either way, no saved prefs.+ return {}+ }+}++/** Merges `patch` into the stored preference for `id` — an explicit `undefined` field in+ * `patch` clears that field, a field simply left out of `patch` is left untouched. An id left+ * with no fields set is dropped entirely, so resetting a network removes it from the file. */+export async function saveNetworkPreference(+ id: string,+ patch: NetworkPreference+): Promise<NetworkPreferences> {+ const current = await loadNetworkPreferences()+ const merged: NetworkPreference = { ...current[id], ...patch }+ const next: NetworkPreferences = { ...current }++ if (merged.customName || merged.colorId) {+ next[id] = merged+ } else {+ delete next[id]+ }++ await writeFile(preferencesPath(), JSON.stringify(next, null, 2), 'utf-8')+ return next+}diff --git a/src/preload/index.ts b/src/preload/index.tsindex b1dc8ba..6d43b06 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -4,6 +4,8 @@ import { IpcChannels } from '../shared/ipc-channels'import type {DownloadState,NetworkInterfaceInfo,+ NetworkPreference,+ NetworkPreferences,ProbeResult,StartDownloadRequest} from '../shared/types'@@ -14,6 +16,8 @@ export interface InitialPaths {}const plexoApi = {+ platform: process.platform,+listInterfaces: (): Promise<NetworkInterfaceInfo[]> =>ipcRenderer.invoke(IpcChannels.listInterfaces),@@ -22,6 +26,12 @@ const plexoApi = {openNetworkSettings: (): Promise<void> => ipcRenderer.invoke(IpcChannels.openNetworkSettings),+ getNetworkPreferences: (): Promise<NetworkPreferences> =>+ ipcRenderer.invoke(IpcChannels.getNetworkPreferences),++ setNetworkPreference: (id: string, patch: NetworkPreference): Promise<NetworkPreferences> =>+ ipcRenderer.invoke(IpcChannels.setNetworkPreference, id, patch),+probeUrl: (url: string): Promise<ProbeResult> => ipcRenderer.invoke(IpcChannels.probeUrl, url),getInitialPaths: (): Promise<InitialPaths> => ipcRenderer.invoke(IpcChannels.getInitialPaths),diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 1bd4459..163f235 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -1,3 +1,5 @@+import { useEffect } from 'react'+import { TitleBar, type TitleBarStatus } from './components/TitleBar'import { useDownloadEvents } from './hooks/useDownloadEvents'import { CompleteScreen } from './screens/CompleteScreen'import { DownloadingScreen } from './screens/DownloadingScreen'@@ -5,6 +7,7 @@ import { ErrorScreen } from './screens/ErrorScreen'import { IdleScreen } from './screens/IdleScreen'import { NoConnectionsScreen } from './screens/NoConnectionsScreen'import { useAppStore } from './store/useAppStore'+import { groupChunksByInterface } from './utils/format'function App(): React.JSX.Element {useDownloadEvents()@@ -13,27 +16,47 @@ function App(): React.JSX.Element {const interfacesStatus = useAppStore((store) => store.interfacesStatus)const currentDownload = useAppStore((store) => store.currentDownload)const clearCurrentDownload = useAppStore((store) => store.clearCurrentDownload)+ const loadNetworkPreferences = useAppStore((store) => store.loadNetworkPreferences)++ useEffect(() => {+ loadNetworkPreferences()+ }, [loadNetworkPreferences])const handleNewDownload = (): void => {if (currentDownload) void window.plexo.removeDownload(currentDownload.id)clearCurrentDownload()}+ const noConnections = interfacesStatus === 'ready' && interfaces.length === 0++ let screen: React.JSX.Element+ let titleBarStatus: TitleBarStatus = { kind: 'none' }+if (currentDownload) {if (currentDownload.status === 'downloading' || currentDownload.status === 'paused') {- return <DownloadingScreen download={currentDownload} />+ screen = <DownloadingScreen download={currentDownload} />+ titleBarStatus = {+ kind: 'merged',+ networkCount: groupChunksByInterface(currentDownload.chunks).length+ }+ } else if (currentDownload.status === 'completed') {+ screen = <CompleteScreen download={currentDownload} onNewDownload={handleNewDownload} />+ } else {+ screen = <ErrorScreen download={currentDownload} onNewDownload={handleNewDownload} />}- if (currentDownload.status === 'completed') {- return <CompleteScreen download={currentDownload} onNewDownload={handleNewDownload} />- }- return <ErrorScreen download={currentDownload} onNewDownload={handleNewDownload} />- }-- if (interfacesStatus === 'ready' && interfaces.length === 0) {- return <NoConnectionsScreen />+ } else if (noConnections) {+ screen = <NoConnectionsScreen />+ titleBarStatus = { kind: 'offline' }+ } else {+ screen = <IdleScreen />}- return <IdleScreen />+ return (+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>+ <TitleBar status={titleBarStatus} />+ <div style={{ flex: 1, minHeight: 0 }}>{screen}</div>+ </div>+ )}export default Appdiff --git a/src/renderer/src/assets/fonts/Manrope-Variable.woff2 b/src/renderer/src/assets/fonts/Manrope-Variable.woff2new file mode 100644index 0000000..9d7abb1Binary files /dev/null and b/src/renderer/src/assets/fonts/Manrope-Variable.woff2 differdiff --git a/src/renderer/src/assets/fonts/RobotoMono-Variable.woff2 b/src/renderer/src/assets/fonts/RobotoMono-Variable.woff2new file mode 100644index 0000000..4a23268Binary files /dev/null and b/src/renderer/src/assets/fonts/RobotoMono-Variable.woff2 differdiff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.cssindex babee3f..3bda2f9 100644--- a/src/renderer/src/assets/main.css+++ b/src/renderer/src/assets/main.css@@ -1,3 +1,19 @@+@font-face {+ font-family: 'Manrope';+ font-style: normal;+ font-weight: 400 700;+ font-display: swap;+ src: url('./fonts/Manrope-Variable.woff2') format('woff2');+}++@font-face {+ font-family: 'Roboto Mono';+ font-style: normal;+ font-weight: 400 600;+ font-display: swap;+ src: url('./fonts/RobotoMono-Variable.woff2') format('woff2');+}+:root {color-scheme: light dark;@@ -16,9 +32,9 @@--border-strong: #b9b9bb;--footer-border: #d8d8da;- --button-secondary-from: #fefefe;- --button-secondary-to: #f3f3f3;- --button-shadow: rgba(0, 0, 0, 0.05);+ --button-secondary-bg: linear-gradient(#fefefe, #f3f3f3);+ --button-secondary-border: var(--border-strong);+ --button-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);--button-disabled-bg: #f4f4f5;--button-disabled-border: #d2d2d4;--button-disabled-text: #a8a8ac;@@ -30,55 +46,105 @@--checkbox-shadow: rgba(0, 0, 0, 0.15);--checkbox-inset-shadow: rgba(0, 0, 0, 0.04);- --kind-wifi-bg: oklch(0.6 0.16 250 / 0.13);- --kind-wifi-text: oklch(0.46 0.14 250);- --kind-usb-bg: oklch(0.65 0.14 195 / 0.15);- --kind-usb-text: oklch(0.44 0.11 195);- --kind-ethernet-bg: oklch(0.58 0.17 300 / 0.13);- --kind-ethernet-text: oklch(0.44 0.14 300);- --kind-neutral-bg: oklch(0.55 0.02 260 / 0.13);- --kind-neutral-text: oklch(0.4 0.02 260);+ /* Network + brand palette — light-mode originals, adapted to sit on a white ground. */+ --color-wifi: #2f8577;+ --color-wifi-bg: #e7f3f1;+ --color-wifi-border: #bfe0da;+ --color-wifi-text: #1f6358;+ --color-wifi-onsolid: #ffffff;++ --color-usb: #b5790f;+ --color-usb-bg: #fbf1de;+ --color-usb-border: #edd7a8;+ --color-usb-text: #8a5a13;+ --color-usb-onsolid: #ffffff;++ --color-ethernet: #5567a0;+ --color-ethernet-bg: #eceef7;+ --color-ethernet-border: #c9d0ea;+ --color-ethernet-text: #3d4d82;+ --color-ethernet-onsolid: #ffffff;++ --color-neutral: #6e7278;+ --color-neutral-bg: #f0f0f1;+ --color-neutral-border: #d6d7d9;+ --color-neutral-text: #55585c;+ --color-neutral-onsolid: #ffffff;++ --color-accent: #b5790f;+ --color-accent-onsolid: #ffffff;+ --color-accent-shadow: rgba(181, 121, 15, 0.2);+ --color-success: #2f8577;++ --color-danger: #b3261e;+ --color-danger-bg: #fbeaea;+ --color-danger-border: #f0c6c4;}@media (prefers-color-scheme: dark) {:root {- --bg: #1c1c1e;- --bg-secondary: #202023;- --bg-tertiary: #232326;- --input-bg: #2c2c2e;- --track-bg: #3a3a3c;-- --text: #f2f2f3;- --text-secondary: #a1a1a6;- --text-tertiary: #8e8e93;-- --border: rgba(255, 255, 255, 0.1);- --border-subtle: rgba(255, 255, 255, 0.08);- --border-strong: rgba(255, 255, 255, 0.18);- --footer-border: rgba(255, 255, 255, 0.12);-- --button-secondary-from: #3a3a3d;- --button-secondary-to: #313134;- --button-shadow: rgba(0, 0, 0, 0.3);- --button-disabled-bg: #2c2c2e;- --button-disabled-border: rgba(255, 255, 255, 0.12);- --button-disabled-text: #6e6e73;-- --icon-muted: #55555a;- --icon-muted-strong: #636368;- --scrollbar-thumb: #48484a;+ /* Graphite instrument-panel background — exact hex values from the "Plexo v2" design doc. */+ --bg: #1b1e20;+ --bg-secondary: #202325;+ --bg-tertiary: #202325;+ --input-bg: #242729;+ --track-bg: #262a2d;++ --text: #eae7e2;+ --text-secondary: #a9adb2;+ --text-tertiary: #8d9196;++ --border: #2b2f33;+ --border-subtle: #23262a;+ --border-strong: #33383c;+ --footer-border: #2b2f33;++ --button-secondary-bg: #262a2d;+ --button-secondary-border: var(--border-strong);+ --button-shadow: none;+ --button-disabled-bg: #232628;+ --button-disabled-border: #2b2f33;+ --button-disabled-text: #5d6268;++ --icon-muted: #33383c;+ --icon-muted-strong: #3a3f44;+ --scrollbar-thumb: #3a3f44;--checkbox-shadow: rgba(0, 0, 0, 0.4);--checkbox-inset-shadow: rgba(0, 0, 0, 0.3);- --kind-wifi-bg: oklch(0.6 0.16 250 / 0.22);- --kind-wifi-text: oklch(0.78 0.1 250);- --kind-usb-bg: oklch(0.65 0.14 195 / 0.22);- --kind-usb-text: oklch(0.78 0.09 195);- --kind-ethernet-bg: oklch(0.58 0.17 300 / 0.22);- --kind-ethernet-text: oklch(0.78 0.1 300);- --kind-neutral-bg: oklch(0.55 0.02 260 / 0.25);- --kind-neutral-text: oklch(0.75 0.02 260);+ --color-wifi: #4ea89a;+ --color-wifi-bg: #22312e;+ --color-wifi-border: #3a5450;+ --color-wifi-text: #7fc9bb;+ --color-wifi-onsolid: #10201d;++ --color-usb: #d8a44c;+ --color-usb-bg: #33291a;+ --color-usb-border: #54421f;+ --color-usb-text: #e8bb6d;+ --color-usb-onsolid: #221806;++ --color-ethernet: #7e93bd;+ --color-ethernet-bg: #232a38;+ --color-ethernet-border: #3a4660;+ --color-ethernet-text: #a7b8db;+ --color-ethernet-onsolid: #141a26;++ --color-neutral: #8d9196;+ --color-neutral-bg: #26292c;+ --color-neutral-border: #3a3f44;+ --color-neutral-text: #a9adb2;+ --color-neutral-onsolid: #16181a;++ --color-accent: #d8a44c;+ --color-accent-onsolid: #1b1408;+ --color-accent-shadow: rgba(216, 164, 76, 0.22);+ --color-success: #4ea89a;++ --color-danger: #eda3a3;+ --color-danger-bg: #2c1c1c;+ --color-danger-border: #4a2a2a;}}@@ -95,7 +161,7 @@ body,body {overflow: hidden;- font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', Helvetica, sans-serif;+ font-family: 'Manrope', -apple-system, 'SF Pro Text', 'Helvetica Neue', Helvetica, sans-serif;-webkit-font-smoothing: antialiased;background: var(--bg);color: var(--text);@@ -123,3 +189,19 @@ button {background-color: var(--scrollbar-thumb);border-radius: 9999px;}++@keyframes plexo-dash {+ to {+ stroke-dashoffset: -60;+ }+}++@keyframes plexo-glow {+ 0%,+ 100% {+ opacity: 0.45;+ }+ 50% {+ opacity: 1;+ }+}diff --git a/src/renderer/src/components/ConnectionRow.tsx b/src/renderer/src/components/ConnectionRow.tsxdeleted file mode 100644index 1c45c7f..0000000--- a/src/renderer/src/components/ConnectionRow.tsx+++ /dev/null@@ -1,111 +0,0 @@-import type { NetworkInterfaceInfo } from '@shared/types'-import { FONT_MONO, FONT_UI, SUCCESS } from '../theme'-import { KindBadge } from './KindBadge'--interface ConnectionRowProps {- iface: NetworkInterfaceInfo- selected: boolean- latencyMs: number | null | undefined- onToggle: () => void-}--function Checkbox({ checked }: { checked: boolean }): React.JSX.Element {- if (checked) {- return (- <div- style={{- width: 14,- height: 14,- borderRadius: 4,- background: 'oklch(0.58 0.19 255)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- color: '#fff',- font: `700 9px/1 ${FONT_UI}`,- boxShadow: 'inset 0 0 0 0.5px var(--checkbox-shadow)',- flexShrink: 0- }}- >- ✓- </div>- )- }- return (- <div- style={{- width: 14,- height: 14,- borderRadius: 4,- background: 'var(--input-bg)',- border: '0.5px solid var(--icon-muted-strong)',- boxShadow: 'inset 0 1px 1px var(--checkbox-inset-shadow)',- flexShrink: 0- }}- />- )-}--export function ConnectionRow({- iface,- selected,- latencyMs,- onToggle-}: ConnectionRowProps): React.JSX.Element {- const online = latencyMs != null-- return (- <button- type="button"- onClick={onToggle}- style={{- display: 'flex',- alignItems: 'center',- gap: 10,- padding: '9px 20px',- borderWidth: '0.5px 0 0 0',- borderStyle: 'solid',- borderColor: 'var(--border-subtle)',- background: 'transparent',- width: '100%',- textAlign: 'left',- cursor: 'pointer',- font: 'inherit',- color: 'inherit'- }}- >- <Checkbox checked={selected} />- <KindBadge kind={iface.kind} />- <div style={{ font: `13px/1 ${FONT_UI}`, color: 'var(--text)' }}>{iface.displayName}</div>- <div style={{ font: `11.5px/1 ${FONT_MONO}`, color: 'var(--text-tertiary)' }}>- {iface.device}- </div>- <div style={{ flex: 1 }} />- <div style={{ font: `11.5px/1 ${FONT_MONO}`, color: 'var(--text-secondary)' }}>- {iface.address}- </div>- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 6,- width: 96,- justifyContent: 'flex-end'- }}- >- <div- style={{- width: 7,- height: 7,- borderRadius: '50%',- background: online ? SUCCESS : 'var(--icon-muted)',- flexShrink: 0- }}- />- <div style={{ font: `11.5px/1 ${FONT_MONO}`, color: 'var(--text-secondary)' }}>- {online ? `${latencyMs} ms` : '—'}- </div>- </div>- </button>- )-}diff --git a/src/renderer/src/components/FieldsSection.tsx b/src/renderer/src/components/FieldsSection.tsxdeleted file mode 100644index eec7c1e..0000000--- a/src/renderer/src/components/FieldsSection.tsx+++ /dev/null@@ -1,72 +0,0 @@-import { FONT_MONO, FONT_UI, secondaryButtonStyle } from '../theme'--const labelStyle: React.CSSProperties = {- width: 60,- textAlign: 'right',- font: `13px/1 ${FONT_UI}`,- color: 'var(--text-secondary)',- flexShrink: 0-}--const fieldBoxStyle: React.CSSProperties = {- flex: 1,- minWidth: 0,- border: '0.5px solid var(--border-strong)',- borderRadius: 6,- background: 'var(--input-bg)',- boxShadow: 'inset 0 1px 1px var(--button-shadow)',- padding: '6px 9px',- font: `13px/1.3 ${FONT_MONO}`,- color: 'var(--text)',- whiteSpace: 'nowrap',- overflow: 'hidden',- textOverflow: 'ellipsis'-}--interface FieldsSectionProps {- url: string- onUrlChange: (url: string) => void- displayDestinationDir: string- onBrowse: () => void- disabled?: boolean-}--export function FieldsSection({- url,- onUrlChange,- displayDestinationDir,- onBrowse,- disabled = false-}: FieldsSectionProps): React.JSX.Element {- return (- <div- style={{- padding: '18px 20px 16px',- display: 'flex',- flexDirection: 'column',- gap: 10,- opacity: disabled ? 0.5 : 1,- pointerEvents: disabled ? 'none' : 'auto'- }}- >- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>- <div style={labelStyle}>URL</div>- <input- type="text"- value={url}- onChange={(event) => onUrlChange(event.target.value)}- placeholder="https://"- disabled={disabled}- style={{ ...fieldBoxStyle, outline: 'none' }}- />- </div>- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>- <div style={labelStyle}>Save to</div>- <div style={fieldBoxStyle}>{displayDestinationDir}</div>- <button type="button" onClick={onBrowse} disabled={disabled} style={secondaryButtonStyle}>- Browse…- </button>- </div>- </div>- )-}diff --git a/src/renderer/src/components/MergeDiagram.tsx b/src/renderer/src/components/MergeDiagram.tsxnew file mode 100644index 0000000..880b910--- /dev/null+++ b/src/renderer/src/components/MergeDiagram.tsx@@ -0,0 +1,77 @@+import { FONT_MONO } from '../theme'++const ROW_HEIGHT = 30+const MERGE_X = 150+const WIDTH = 232++/** Draws the bonded-links-into-one-stream diagram from design v2: one dashed, flowing line+ * per active physical network, converging into a single solid stream. */+export function MergeDiagram({+ networks,+ muted = false+}: {+ networks: Array<{ solid: string; label: string }>+ muted?: boolean+}): React.JSX.Element {+ const height = Math.max(70, networks.length * ROW_HEIGHT + 16)+ const midY = height / 2++ return (+ <svg+ viewBox={`0 0 ${WIDTH} ${height}`}+ style={{ width: WIDTH, height, display: 'block', flexShrink: 0 }}+ >+ <g fill="none" strokeWidth={3} strokeLinecap="round">+ {networks.map((network, index) => {+ const y = (index + 0.5) * (height / networks.length)+ const color = muted ? 'var(--icon-muted)' : network.solid+ return (+ <path+ key={network.label + index}+ d={`M4,${y.toFixed(1)} C70,${y.toFixed(1)} 84,${midY.toFixed(1)} ${MERGE_X},${midY.toFixed(1)}`}+ stroke={color}+ strokeDasharray="6 8"+ style={+ muted+ ? undefined+ : { animation: `plexo-dash ${1.1 + index * 0.2}s linear infinite` }+ }+ />+ )+ })}+ <path+ d={`M${MERGE_X},${midY} L${WIDTH - 10},${midY}`}+ stroke={muted ? 'var(--icon-muted)' : 'var(--text)'}+ strokeWidth={8}+ />+ </g>+ <circle+ cx={MERGE_X}+ cy={midY}+ r={11}+ fill="none"+ stroke={muted ? 'var(--icon-muted)' : 'var(--text)'}+ strokeOpacity={muted ? 1 : 0.25}+ strokeWidth={1.5}+ strokeDasharray={muted ? '3 4' : undefined}+ />+ <circle cx={MERGE_X} cy={midY} r={4.5} fill={muted ? 'var(--icon-muted)' : 'var(--text)'} />+ {networks.map((network, index) => {+ const y = (index + 0.5) * (height / networks.length)+ const color = muted ? 'var(--icon-muted)' : network.solid+ return <circle key={`dot-${index}`} cx={4} cy={y} r={4} fill={color} />+ })}+ {!muted && (+ <text+ x={WIDTH - 10}+ y={midY - 16}+ textAnchor="end"+ fill="var(--text-tertiary)"+ style={{ font: `500 9px ${FONT_MONO}`, letterSpacing: '0.1em' }}+ >+ ONE STREAM+ </text>+ )}+ </svg>+ )+}diff --git a/src/renderer/src/components/NetworkCard.tsx b/src/renderer/src/components/NetworkCard.tsxnew file mode 100644index 0000000..037531f--- /dev/null+++ b/src/renderer/src/components/NetworkCard.tsx@@ -0,0 +1,208 @@+import type { NetworkInterfaceInfo } from '@shared/types'+import { useState } from 'react'+import { useAppStore } from '../store/useAppStore'+import { FONT_MONO, FONT_UI, resolveNetworkVisual, type NetworkColorId } from '../theme'+import { NetworkEditorFields } from './NetworkEditorFields'++interface NetworkCardProps {+ iface: NetworkInterfaceInfo+ selected: boolean+ latencyMs: number | null | undefined+ onToggle: () => void+}++function Checkbox({+ checked,+ color,+ onColor+}: {+ checked: boolean+ color: string+ onColor: string+}): React.JSX.Element {+ if (checked) {+ return (+ <div+ style={{+ width: 15,+ height: 15,+ borderRadius: 4,+ background: color,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ color: onColor,+ font: `700 9px/1 ${FONT_UI}`,+ boxShadow: 'inset 0 0 0 0.5px var(--checkbox-shadow)',+ flexShrink: 0+ }}+ >+ ✓+ </div>+ )+ }+ return (+ <div+ style={{+ width: 15,+ height: 15,+ borderRadius: 4,+ background: 'var(--input-bg)',+ border: '0.5px solid var(--icon-muted-strong)',+ boxShadow: 'inset 0 1px 1px var(--checkbox-inset-shadow)',+ flexShrink: 0+ }}+ />+ )+}++export function NetworkCard({+ iface,+ selected,+ latencyMs,+ onToggle+}: NetworkCardProps): React.JSX.Element {+ const [editing, setEditing] = useState(false)+ const preference = useAppStore((store) => store.networkPreferences[iface.id])+ const setNetworkPreference = useAppStore((store) => store.setNetworkPreference)+ const visual = resolveNetworkVisual(iface.kind, iface.displayName, preference)+ const online = latencyMs != null++ if (editing) {+ return (+ <div+ style={{+ borderRadius: 11,+ padding: 15,+ background: 'var(--bg-secondary)',+ border: '0.5px solid var(--border)'+ }}+ >+ <NetworkEditorFields+ name={preference?.customName ?? ''}+ onNameChange={(customName) => setNetworkPreference(iface.id, { customName })}+ namePlaceholder={iface.displayName}+ colorId={preference?.colorId as NetworkColorId | undefined}+ onColorSelect={(colorId) => setNetworkPreference(iface.id, { colorId })}+ onDone={() => setEditing(false)}+ />+ </div>+ )+ }++ return (+ <div+ style={{+ borderRadius: 11,+ padding: 15,+ background: selected ? visual.bg : 'var(--bg-secondary)',+ border: `0.5px solid ${selected ? visual.border : 'var(--border)'}`,+ display: 'flex',+ flexDirection: 'column',+ gap: 11+ }}+ >+ <div style={{ display: 'flex', alignItems: 'center', gap: 9 }}>+ <button+ type="button"+ onClick={onToggle}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 9,+ flex: 1,+ minWidth: 0,+ border: 'none',+ background: 'none',+ padding: 0,+ textAlign: 'left',+ cursor: 'pointer',+ font: 'inherit',+ color: 'inherit'+ }}+ >+ <Checkbox checked={selected} color={visual.solid} onColor={visual.onSolid} />+ <div+ style={{+ font: `600 13px/1 ${FONT_UI}`,+ color: selected ? 'var(--text)' : 'var(--text-secondary)',+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ minWidth: 0+ }}+ >+ {visual.name}+ </div>+ </button>+ <button+ type="button"+ onClick={() => setEditing(true)}+ title="Rename or recolor this network"+ style={{+ border: 'none',+ background: 'none',+ color: 'var(--text-tertiary)',+ font: `700 12px/1 ${FONT_UI}`,+ cursor: 'pointer',+ padding: '2px 4px',+ flexShrink: 0+ }}+ >+ ⋯+ </button>+ <div+ style={{+ font: `500 10px/1 ${FONT_MONO}`,+ letterSpacing: '0.1em',+ color: selected ? visual.text : 'var(--text-tertiary)',+ flexShrink: 0+ }}+ >+ {visual.label}+ </div>+ </div>+ <div+ style={{+ font: `10.5px/1 ${FONT_MONO}`,+ color: 'var(--text-tertiary)',+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {iface.device} · {iface.address}+ </div>+ <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between' }}>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>+ <div+ style={{+ font: `500 9px/1 ${FONT_MONO}`,+ letterSpacing: '0.12em',+ color: 'var(--text-tertiary)'+ }}+ >+ PING+ </div>+ <div+ style={{+ font: `500 13px/1 ${FONT_MONO}`,+ color: online && selected ? visual.text : 'var(--text-secondary)'+ }}+ >+ {online ? `${latencyMs} ms` : '—'}+ </div>+ </div>+ <div+ style={{+ width: 7,+ height: 7,+ borderRadius: '50%',+ background: online ? 'var(--color-success)' : 'var(--icon-muted)',+ flexShrink: 0+ }}+ />+ </div>+ </div>+ )+}diff --git a/src/renderer/src/components/NetworkEditorFields.tsx b/src/renderer/src/components/NetworkEditorFields.tsxnew file mode 100644index 0000000..a4ea60b--- /dev/null+++ b/src/renderer/src/components/NetworkEditorFields.tsx@@ -0,0 +1,104 @@+import { FONT_MONO, FONT_UI, NETWORK_COLOR_SWATCHES, type NetworkColorId } from '../theme'++interface NetworkEditorFieldsProps {+ name: string+ onNameChange: (name: string) => void+ namePlaceholder: string+ colorId: NetworkColorId | undefined+ onColorSelect: (colorId: NetworkColorId | undefined) => void+ onDone: () => void+}++/** Inline rename + recolor controls for one physical network — shared between the Idle screen's+ * network cards and the live network row on the Downloading screen, so a confusing OS device+ * name (e.g. "feth0") can be fixed from wherever it shows up. */+export function NetworkEditorFields({+ name,+ onNameChange,+ namePlaceholder,+ colorId,+ onColorSelect,+ onDone+}: NetworkEditorFieldsProps): React.JSX.Element {+ return (+ <div+ style={{+ display: 'flex',+ flexDirection: 'column',+ gap: 9,+ padding: '10px 12px',+ borderRadius: 8,+ background: 'var(--input-bg)',+ border: '0.5px solid var(--border-strong)'+ }}+ >+ <input+ type="text"+ value={name}+ onChange={(event) => onNameChange(event.target.value)}+ placeholder={namePlaceholder}+ style={{+ border: '0.5px solid var(--border)',+ borderRadius: 6,+ background: 'var(--bg)',+ outline: 'none',+ padding: '6px 8px',+ font: `12.5px/1.3 ${FONT_UI}`,+ color: 'var(--text)'+ }}+ />+ <div style={{ display: 'flex', alignItems: 'center', gap: 7, flexWrap: 'wrap' }}>+ <button+ type="button"+ onClick={() => onColorSelect(undefined)}+ title="Use the default color for this network kind"+ style={{+ width: 18,+ height: 18,+ borderRadius: '50%',+ border: `1.5px solid ${!colorId ? 'var(--text)' : 'var(--border-strong)'}`,+ background: 'var(--bg)',+ color: 'var(--text-tertiary)',+ font: `600 10px/1 ${FONT_UI}`,+ cursor: 'pointer',+ flexShrink: 0+ }}+ >+ ×+ </button>+ {NETWORK_COLOR_SWATCHES.map((swatch) => (+ <button+ key={swatch.id}+ type="button"+ onClick={() => onColorSelect(swatch.id)}+ title={swatch.label}+ style={{+ width: 18,+ height: 18,+ borderRadius: '50%',+ border: colorId === swatch.id ? '1.5px solid var(--text)' : '1.5px solid transparent',+ background: swatch.solid,+ cursor: 'pointer',+ flexShrink: 0+ }}+ />+ ))}+ <div style={{ flex: 1 }} />+ <button+ type="button"+ onClick={onDone}+ style={{+ border: 'none',+ background: 'none',+ color: 'var(--color-accent)',+ font: `600 11px/1 ${FONT_MONO}`,+ cursor: 'pointer',+ padding: '2px 0'+ }}+ >+ Done+ </button>+ </div>+ </div>+ )+}diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsxnew file mode 100644index 0000000..62eb401--- /dev/null+++ b/src/renderer/src/components/NetworkRow.tsx@@ -0,0 +1,173 @@+import type { ChunkStatus } from '@shared/types'+import { useState } from 'react'+import { useAppStore } from '../store/useAppStore'+import {+ DANGER,+ FONT_MONO,+ FONT_UI,+ NETWORK_ROW_GRID_COLUMNS,+ resolveNetworkVisual,+ type NetworkColorId+} from '../theme'+import type { NetworkGroup } from '../utils/format'+import { formatBytes, formatSpeed } from '../utils/format'+import { NetworkEditorFields } from './NetworkEditorFields'++/** A chunk still filling in fades up from a floor opacity rather than snapping straight to+ * full color, so its own progress reads at a glance within the network's mini chunk bar. */+function chunkOpacity(percent: number, status: ChunkStatus): number {+ if (status === 'completed') return 1+ if (status === 'pending') return 0.16+ return Math.max(0.3, Math.min(1, percent / 100))+}++export function NetworkRow({+ group,+ totalBytes,+ sharePercent,+ latencyMs+}: {+ group: NetworkGroup+ totalBytes: number+ sharePercent: number+ latencyMs?: number | null+}): React.JSX.Element {+ const [editing, setEditing] = useState(false)+ const preference = useAppStore((store) => store.networkPreferences[group.interfaceId])+ const setNetworkPreference = useAppStore((store) => store.setNetworkPreference)+ const visual = resolveNetworkVisual(group.interfaceKind, group.interfaceLabel, preference)+ const hasError = group.chunks.some((chunk) => chunk.status === 'error')+ const isActive = group.chunks.some((chunk) => chunk.status === 'downloading')++ return (+ <div>+ <div+ style={{+ display: 'grid',+ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS,+ gap: 14,+ alignItems: 'center',+ padding: '11px 20px',+ borderTop: '0.5px solid var(--border-subtle)'+ }}+ >+ <div+ style={{+ width: 8,+ height: 8,+ borderRadius: '50%',+ background: hasError ? DANGER : visual.solid,+ animation: isActive ? 'plexo-glow 1.8s infinite' : undefined,+ opacity: isActive || hasError ? 1 : 0.45+ }}+ />+ <div style={{ minWidth: 0, display: 'flex', alignItems: 'center', gap: 6 }}>+ <div style={{ minWidth: 0 }}>+ <div+ style={{+ font: `600 12.5px/1.3 ${FONT_UI}`,+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {visual.name}+ </div>+ <div+ style={{ marginTop: 3, font: `10px/1 ${FONT_MONO}`, color: 'var(--text-tertiary)' }}+ >+ {group.chunks.length} chunk{group.chunks.length === 1 ? '' : 's'}+ </div>+ </div>+ <button+ type="button"+ onClick={() => setEditing((value) => !value)}+ title="Rename or recolor this network"+ style={{+ border: 'none',+ background: 'none',+ color: 'var(--text-tertiary)',+ font: `700 12px/1 ${FONT_UI}`,+ cursor: 'pointer',+ padding: '2px 4px',+ flexShrink: 0+ }}+ >+ ⋯+ </button>+ </div>+ <div style={{ display: 'flex', gap: 3, height: 15 }}>+ {group.chunks.map((chunk) => {+ const chunkSize =+ chunk.rangeEnd !== null+ ? chunk.rangeEnd - chunk.rangeStart + 1+ : totalBytes - chunk.rangeStart+ const percent = chunkSize > 0 ? (chunk.bytesDownloaded / chunkSize) * 100 : 0+ return (+ <div+ key={chunk.id}+ style={{+ flex: 1,+ borderRadius: 2,+ background: chunk.status === 'error' ? DANGER : visual.solid,+ opacity: chunkOpacity(percent, chunk.status)+ }}+ />+ )+ })}+ </div>+ <div+ style={{+ textAlign: 'right',+ font: `500 12px/1 ${FONT_MONO}`,+ color: 'var(--text)',+ fontVariantNumeric: 'tabular-nums'+ }}+ >+ {Math.round(sharePercent)}%+ </div>+ <div+ style={{+ textAlign: 'right',+ font: `600 12.5px/1 ${FONT_MONO}`,+ color: isActive ? visual.text : 'var(--text-tertiary)',+ fontVariantNumeric: 'tabular-nums'+ }}+ >+ {isActive ? formatSpeed(group.speedBytesPerSec) : '—'}+ </div>+ <div+ style={{+ textAlign: 'right',+ font: `11.5px/1 ${FONT_MONO}`,+ color: 'var(--text-secondary)',+ fontVariantNumeric: 'tabular-nums'+ }}+ >+ {formatBytes(group.bytesDownloaded)}+ </div>+ <div+ style={{+ textAlign: 'right',+ font: `11.5px/1 ${FONT_MONO}`,+ color: 'var(--text-tertiary)'+ }}+ >+ {latencyMs != null ? `${latencyMs} ms` : '—'}+ </div>+ </div>+ {editing && (+ <div style={{ padding: '0 20px 11px' }}>+ <NetworkEditorFields+ name={preference?.customName ?? ''}+ onNameChange={(customName) => setNetworkPreference(group.interfaceId, { customName })}+ namePlaceholder={group.interfaceLabel}+ colorId={preference?.colorId as NetworkColorId | undefined}+ onColorSelect={(colorId) => setNetworkPreference(group.interfaceId, { colorId })}+ onDone={() => setEditing(false)}+ />+ </div>+ )}+ </div>+ )+}diff --git a/src/renderer/src/components/StreamRow.tsx b/src/renderer/src/components/StreamRow.tsxdeleted file mode 100644index 276fde1..0000000--- a/src/renderer/src/components/StreamRow.tsx+++ /dev/null@@ -1,92 +0,0 @@-import type { ChunkState } from '@shared/types'-import { DANGER, FONT_MONO, FONT_UI, KIND_PALETTE } from '../theme'-import { formatBytes, formatSpeed } from '../utils/format'-import { KindBadge } from './KindBadge'--export function StreamRow({- chunk,- totalBytes,- connectionSuffix-}: {- chunk: ChunkState- totalBytes: number- connectionSuffix?: string-}): React.JSX.Element {- const chunkSize =- chunk.rangeEnd !== null ? chunk.rangeEnd - chunk.rangeStart + 1 : totalBytes - chunk.rangeStart- const percent =- chunkSize > 0 ? Math.min(100, Math.round((chunk.bytesDownloaded / chunkSize) * 100)) : 0- const barColor = chunk.status === 'error' ? DANGER : KIND_PALETTE[chunk.interfaceKind].solid-- return (- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 12,- padding: '10px 20px',- borderTop: '0.5px solid var(--border-subtle)'- }}- >- <KindBadge kind={chunk.interfaceKind} />- <div- style={{- width: 150,- font: `13px/1 ${FONT_UI}`,- whiteSpace: 'nowrap',- overflow: 'hidden',- textOverflow: 'ellipsis'- }}- >- {chunk.interfaceLabel}- {connectionSuffix}- </div>- <div- style={{- flex: 1,- minWidth: 0,- height: 5,- borderRadius: 3,- background: 'var(--track-bg)',- overflow: 'hidden'- }}- >- <div- style={{ width: `${percent}%`, height: '100%', borderRadius: 3, background: barColor }}- />- </div>- <div- style={{- width: 38,- textAlign: 'right',- font: `11.5px/1 ${FONT_MONO}`,- fontVariantNumeric: 'tabular-nums'- }}- >- {percent}%- </div>- <div- style={{- width: 92,- textAlign: 'right',- font: `11.5px/1 ${FONT_MONO}`,- color: 'var(--text)',- fontVariantNumeric: 'tabular-nums'- }}- >- {chunk.status === 'downloading' ? formatSpeed(chunk.speedBytesPerSec) : '—'}- </div>- <div- style={{- width: 74,- textAlign: 'right',- font: `11.5px/1 ${FONT_MONO}`,- color: 'var(--text-tertiary)',- fontVariantNumeric: 'tabular-nums'- }}- >- {formatBytes(chunk.bytesDownloaded)}- </div>- </div>- )-}diff --git a/src/renderer/src/components/ThroughputChart.tsx b/src/renderer/src/components/ThroughputChart.tsxnew file mode 100644index 0000000..ed54039--- /dev/null+++ b/src/renderer/src/components/ThroughputChart.tsx@@ -0,0 +1,71 @@+const WIDTH = 560+const HEIGHT = 130++interface ThroughputChartProps {+ order: Array<{ interfaceId: string; solid: string }>+ historyByInterface: Record<string, number[]>+}++/** Stacked area chart of recent throughput, split by physical network — the "whole divided+ * by each physical network" readout from design v2, instead of one line per connection. */+export function ThroughputChart({+ order,+ historyByInterface+}: ThroughputChartProps): React.JSX.Element | null {+ const length = Math.max(+ 0,+ ...order.map((entry) => historyByInterface[entry.interfaceId]?.length ?? 0)+ )+ if (length < 2) return null++ const totals = Array.from({ length }, (_, i) =>+ order.reduce((sum, entry) => sum + (historyByInterface[entry.interfaceId]?.[i] ?? 0), 0)+ )+ const max = Math.max(1, ...totals)+ const xStep = WIDTH / (length - 1)+ const toY = (value: number): number => HEIGHT - (value / max) * HEIGHT++ interface Layer {+ solid: string+ points: string+ }+ const toPoint = (value: number, i: number): string =>+ `${(i * xStep).toFixed(1)},${toY(value).toFixed(1)}`+ const { layers } = order.reduce<{ cumulative: number[]; layers: Layer[] }>(+ (acc, entry) => {+ const series = historyByInterface[entry.interfaceId] ?? []+ const bottom = acc.cumulative+ const top = bottom.map((value, i) => value + (series[i] ?? 0))+ const points = [...top.map(toPoint), ...bottom.map(toPoint).reverse()].join(' ')+ return { cumulative: top, layers: [...acc.layers, { solid: entry.solid, points }] }+ },+ { cumulative: new Array<number>(length).fill(0), layers: [] }+ )++ const outline = totals+ .map((value, i) => `${(i * xStep).toFixed(1)},${toY(value).toFixed(1)}`)+ .join(' ')++ return (+ <svg+ viewBox={`0 0 ${WIDTH} ${HEIGHT}`}+ preserveAspectRatio="none"+ style={{ width: '100%', height: 104, display: 'block', marginTop: 7 }}+ >+ <g stroke="var(--border)" strokeWidth={1}>+ <line x1={0} y1={HEIGHT * 0.33} x2={WIDTH} y2={HEIGHT * 0.33} />+ <line x1={0} y1={HEIGHT * 0.66} x2={WIDTH} y2={HEIGHT * 0.66} />+ </g>+ {layers.map((layer, index) => (+ <polygon key={index} points={layer.points} fill={layer.solid} fillOpacity={0.62} />+ ))}+ <polyline+ points={outline}+ fill="none"+ stroke="var(--text)"+ strokeWidth={2}+ strokeOpacity={0.85}+ />+ </svg>+ )+}diff --git a/src/renderer/src/components/TitleBar.tsx b/src/renderer/src/components/TitleBar.tsxnew file mode 100644index 0000000..4068c6c--- /dev/null+++ b/src/renderer/src/components/TitleBar.tsx@@ -0,0 +1,72 @@+import { FONT_UI, TITLE_BAR_HEIGHT, pillStyle } from '../theme'++export type TitleBarStatus =+ { kind: 'none' } | { kind: 'merged'; networkCount: number } | { kind: 'offline' }++const isMac = window.plexo.platform === 'darwin'++export function TitleBar({ status }: { status: TitleBarStatus }): React.JSX.Element {+ const dimmed = status.kind === 'offline'++ return (+ <div+ style={{+ height: TITLE_BAR_HEIGHT,+ flexShrink: 0,+ display: 'flex',+ alignItems: 'center',+ gap: 13,+ // Real traffic lights are inset here on macOS (see main/index.ts, trafficLightPosition) —+ // 16px inset + ~52px cluster width + a clear ~26px gap before our own content starts.+ padding: `0 14px 0 ${isMac ? 94 : 14}px`,+ background: 'var(--bg-secondary)',+ borderBottom: '0.5px solid var(--border)',+ WebkitAppRegion: 'drag'+ }}+ >+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>+ <div+ style={{+ width: 15,+ height: 15,+ borderRadius: 4,+ background: dimmed ? 'var(--icon-muted)' : 'var(--color-accent)',+ flexShrink: 0+ }}+ />+ <div+ style={{+ font: `700 12.5px/1 ${FONT_UI}`,+ letterSpacing: '0.005em',+ color: dimmed ? 'var(--text-tertiary)' : 'var(--text)'+ }}+ >+ Plexo+ </div>+ </div>+ <div style={{ flex: 1 }} />+ {status.kind === 'merged' && (+ <div style={pillStyle('positive')}>+ <div+ style={{+ width: 6,+ height: 6,+ borderRadius: '50%',+ background: 'var(--color-wifi)',+ animation: 'plexo-glow 2s ease-in-out infinite'+ }}+ />+ {status.networkCount} {status.networkCount === 1 ? 'network' : 'networks'} merged+ </div>+ )}+ {status.kind === 'offline' && (+ <div style={pillStyle('negative')}>+ <div+ style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--color-danger)' }}+ />+ Offline+ </div>+ )}+ </div>+ )+}diff --git a/src/renderer/src/env.d.ts b/src/renderer/src/env.d.tsindex 11f02fe..ec7d5e5 100644--- a/src/renderer/src/env.d.ts+++ b/src/renderer/src/env.d.ts@@ -1 +1,9 @@/// <reference types="vite/client" />++// Electron's frameless-window drag region — not part of the standard CSS property set that+// csstype (and therefore React.CSSProperties) knows about.+declare module 'csstype' {+ interface Properties {+ WebkitAppRegion?: 'drag' | 'no-drag'+ }+}diff --git a/src/renderer/src/screens/CompleteScreen.tsx b/src/renderer/src/screens/CompleteScreen.tsxindex 957b12f..175e262 100644--- a/src/renderer/src/screens/CompleteScreen.tsx+++ b/src/renderer/src/screens/CompleteScreen.tsx@@ -1,35 +1,40 @@import type { DownloadState } from '@shared/types'+import { ThroughputChart } from '../components/ThroughputChart'import { useAppStore } from '../store/useAppStore'import {FONT_MONO,FONT_UI,- KIND_PALETTE,- SUCCESS,+ accentChipStyle,footerStyle,footerTextStyle,primaryButtonStyle,+ resolveNetworkVisual,secondaryButtonStyle,- sectionHeaderLabelStyle+ sectionHeaderLabelStyle,+ statGridStyle,+ statLabelStyle,+ statValueStyle} from '../theme'import {- connectionSuffixes,dirnameOf,formatBytes,formatDuration,formatSpeed,+ groupChunksByInterface,toDisplayPath} from '../utils/format'-const statLabelStyle: React.CSSProperties = {- font: `600 9.5px/1 ${FONT_UI}`,- letterSpacing: '0.08em',- textTransform: 'uppercase',- color: 'var(--text-tertiary)'-}--const statValueStyle: React.CSSProperties = {- font: `15px/1 ${FONT_MONO}`,- fontVariantNumeric: 'tabular-nums'+const heroScopeStyle: React.CSSProperties = {+ padding: '18px 20px',+ background: 'linear-gradient(#1f2224, #1b1e20)',+ borderBottom: '1px solid #2b2f33',+ color: '#f5f2ed',+ ...({+ '--text': '#f5f2ed',+ '--text-secondary': '#a9adb2',+ '--text-tertiary': '#8d9196',+ '--border': '#2b2f33'+ } as React.CSSProperties)}export function CompleteScreen({@@ -40,6 +45,9 @@ export function CompleteScreen({onNewDownload: () => void}): React.JSX.Element {const homeDir = useAppStore((store) => store.homeDir)+ const peakSpeedBytesPerSec = useAppStore((store) => store.peakSpeedBytesPerSec)+ const speedHistoryByInterface = useAppStore((store) => store.speedHistoryByInterface)+ const networkPreferences = useAppStore((store) => store.networkPreferences)const finalSize = download.totalBytes || download.bytesDownloaded// completedAt is always set by the time a download reaches 'completed' — the@@ -47,8 +55,30 @@ export function CompleteScreen({const elapsedSeconds = ((download.completedAt ?? download.startedAt) - download.startedAt) / 1000const avgSpeed = elapsedSeconds > 0 ? finalSize / elapsedSeconds : 0- const totalWeight = download.chunks.reduce((sum, chunk) => sum + chunk.bytesDownloaded, 0) || 1- const suffixes = connectionSuffixes(download.chunks)+ const groups = groupChunksByInterface(download.chunks)+ const visuals = groups.map((group) =>+ resolveNetworkVisual(+ group.interfaceKind,+ group.interfaceLabel,+ networkPreferences[group.interfaceId]+ )+ )+ const totalWeight = groups.reduce((sum, group) => sum + group.bytesDownloaded, 0) || 1+ const totalRetries = download.chunks.reduce((sum, chunk) => sum + chunk.retryCount, 0)++ // "Time saved" vs. what the download would have taken over its single best-performing+ // network alone, using that network's own realized average rate as the baseline — a+ // number we can actually stand behind, unlike a made-up multiplier.+ const fastestGroup = groups.reduce<(typeof groups)[number] | null>(+ (fastest, group) =>+ !fastest || group.bytesDownloaded > fastest.bytesDownloaded ? group : fastest,+ null+ )+ const fastestAvgSpeed =+ fastestGroup && elapsedSeconds > 0 ? fastestGroup.bytesDownloaded / elapsedSeconds : 0+ const soloBaselineSeconds = fastestAvgSpeed > 0 ? finalSize / fastestAvgSpeed : 0+ const secondsSaved = soloBaselineSeconds - elapsedSeconds+ const showSavedChip = groups.length > 1 && secondsSaved > 1const handleReveal = (): void => void window.plexo.revealInFolder(download.destinationPath)@@ -56,55 +86,96 @@ export function CompleteScreen({<divstyle={{ display: 'flex', flexDirection: 'column', height: '100%', background: 'var(--bg)' }}>- <div style={{ padding: '22px 20px 18px', display: 'flex', alignItems: 'center', gap: 14 }}>- <div- style={{- width: 30,- height: 30,- borderRadius: '50%',- background: SUCCESS,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- color: '#fff',- font: `700 15px/1 ${FONT_UI}`,- flexShrink: 0- }}- >- ✓- </div>- <div style={{ display: 'flex', flexDirection: 'column', gap: 4, minWidth: 0 }}>- <div style={{ font: `600 15px/1.2 ${FONT_UI}` }}>Download complete</div>+ <div style={heroScopeStyle}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 18 }}><divstyle={{- font: `12px/1.3 ${FONT_MONO}`,- color: 'var(--text-secondary)',- whiteSpace: 'nowrap',- overflow: 'hidden',- textOverflow: 'ellipsis'+ width: 44,+ height: 44,+ borderRadius: '50%',+ background: '#22312e',+ border: '1px solid #3a5450',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ flexShrink: 0}}>- {download.fileName} — {toDisplayPath(dirnameOf(download.destinationPath), homeDir)}+ <svg viewBox="0 0 24 24" style={{ width: 21, height: 21 }}>+ <path+ d="M5,13 L10,18 L19,7"+ fill="none"+ stroke="#4ea89a"+ strokeWidth={2.4}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ </div>+ <div style={{ minWidth: 0, flex: 1 }}>+ <div+ style={{+ font: `700 16px/1.2 ${FONT_UI}`,+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {download.fileName}+ </div>+ <div+ style={{+ marginTop: 5,+ font: `11.5px/1.3 ${FONT_MONO}`,+ color: '#8d9196',+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {formatBytes(finalSize)} ·{' '}+ {toDisplayPath(dirnameOf(download.destinationPath), homeDir)}+ </div>+ </div>+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 5 }}>+ <div+ style={{ font: `500 9px/1 ${FONT_MONO}`, letterSpacing: '0.16em', color: '#8d9196' }}+ >+ AVERAGE+ </div>+ <div style={{ display: 'flex', alignItems: 'baseline', gap: 6 }}>+ <div+ style={{+ font: `600 26px/0.9 ${FONT_MONO}`,+ letterSpacing: '-0.02em',+ color: '#f5f2ed',+ fontVariantNumeric: 'tabular-nums'+ }}+ >+ {formatSpeed(avgSpeed).split(' ')[0]}+ </div>+ <div style={{ font: `500 11px/1 ${FONT_MONO}`, color: '#8d9196' }}>MB/s</div>+ </div>+ {showSavedChip && (+ <div style={accentChipStyle}>SAVED {formatDuration(secondsSaved)}</div>+ )}</div></div></div><divstyle={{- margin: '0 20px 18px',- display: 'grid',- gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',- border: '0.5px solid var(--border)',- borderRadius: 8,- overflow: 'hidden',- background: 'var(--bg-secondary)'+ margin: '18px 20px',+ ...statGridStyle,+ gridTemplateColumns: 'repeat(5, minmax(0, 1fr))'}}>{[{ label: 'Size', value: formatBytes(finalSize) },{ label: 'Time', value: formatDuration(elapsedSeconds) },- { label: 'Avg speed', value: formatSpeed(avgSpeed) },- { label: 'Streams', value: String(download.chunks.length) }+ { label: 'Peak', value: formatSpeed(peakSpeedBytesPerSec) },+ { label: 'Networks', value: String(groups.length) },+ { label: 'Chunks', value: String(download.chunks.length) }].map((stat, index) => (<divkey={stat.label}@@ -122,67 +193,69 @@ export function CompleteScreen({))}</div>+ <div style={{ margin: '0 20px 16px', display: 'flex', flexDirection: 'column', gap: 8 }}>+ <div style={sectionHeaderLabelStyle}>Speed over the download</div>+ <ThroughputChart+ order={groups.map((g, i) => ({ interfaceId: g.interfaceId, solid: visuals[i].solid }))}+ historyByInterface={speedHistoryByInterface}+ />+ </div>+<divstyle={{ margin: '0 20px 20px', display: 'flex', flexDirection: 'column', gap: 9, flex: 1 }}>- <div style={sectionHeaderLabelStyle}>Contribution</div>+ <div style={sectionHeaderLabelStyle}>Contribution by network</div><divstyle={{display: 'flex',- height: 8,- borderRadius: 4,+ height: 10,+ borderRadius: 999,overflow: 'hidden',- background: 'var(--track-bg)'+ background: 'var(--track-bg)',+ gap: 2}}>- {download.chunks.map((chunk) => (+ {groups.map((group, index) => (<div- key={chunk.id}- style={{- flex: chunk.bytesDownloaded,- background: KIND_PALETTE[chunk.interfaceKind].solid- }}+ key={group.interfaceId}+ style={{ flex: group.bytesDownloaded || 0.0001, background: visuals[index].solid }}/>))}</div>- <div- style={{- display: 'flex',- gap: 18,- font: `11px/1 ${FONT_MONO}`,- color: 'var(--text-secondary)',- flexWrap: 'wrap'- }}- >- {download.chunks.map((chunk) => (- <div key={chunk.id} style={{ display: 'flex', alignItems: 'center', gap: 6 }}>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>+ {groups.map((group, index) => (+ <div key={group.interfaceId} style={{ display: 'flex', alignItems: 'center', gap: 9 }}><divstyle={{- width: 6,- height: 6,+ width: 7,+ height: 7,borderRadius: '50%',- background: KIND_PALETTE[chunk.interfaceKind].solid+ background: visuals[index].solid}}/>- {KIND_PALETTE[chunk.interfaceKind].label}- {suffixes.get(chunk.id)} {formatBytes(chunk.bytesDownloaded)} ·{' '}- {Math.round((chunk.bytesDownloaded / totalWeight) * 100)}%+ <div style={{ font: `500 12px/1 ${FONT_UI}` }}>{visuals[index].name}</div>+ <div style={{ flex: 1 }} />+ <div style={{ font: `11.5px/1 ${FONT_MONO}`, color: 'var(--text-secondary)' }}>+ {formatBytes(group.bytesDownloaded)} ·{' '}+ {Math.round((group.bytesDownloaded / totalWeight) * 100)}%+ </div></div>))}</div></div><div style={footerStyle}>- <div style={footerTextStyle}>Reassembled from {download.chunks.length} chunks</div>+ <div style={footerTextStyle}>+ reassembled from {download.chunks.length} chunks+ {totalRetries > 0+ ? ` · ${totalRetries} ${totalRetries === 1 ? 'retry' : 'retries'}`+ : ' · 0 retries'}+ </div><div style={{ flex: 1 }} /><button type="button" onClick={onNewDownload} style={secondaryButtonStyle}>New Download</button>- <button- type="button"- onClick={handleReveal}- style={{ ...primaryButtonStyle, padding: '6px 16px' }}- >+ <button type="button" onClick={handleReveal} style={primaryButtonStyle}>Reveal in Finder</button></div>diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsxindex 845993e..564aecb 100644--- a/src/renderer/src/screens/DownloadingScreen.tsx+++ b/src/renderer/src/screens/DownloadingScreen.tsx@@ -1,32 +1,65 @@import type { DownloadState } from '@shared/types'import { useEffect, useState } from 'react'-import { StreamRow } from '../components/StreamRow'+import { MergeDiagram } from '../components/MergeDiagram'+import { NetworkRow } from '../components/NetworkRow'+import { ThroughputChart } from '../components/ThroughputChart'+import { useNetworkPolling } from '../hooks/useNetworkPolling'import { useAppStore } from '../store/useAppStore'import {FONT_MONO,FONT_UI,- KIND_PALETTE,- PROGRESS_GRADIENT,+ accentChipStyle,+ dangerButtonStyle,footerStyle,footerTextStyle,+ networkTableHeaderStyle,+ resolveNetworkVisual,secondaryButtonStyle,sectionHeaderLabelStyle,- sectionHeaderMetaStyle+ sectionHeaderMetaStyle,+ statGridStyle,+ statLabelStyle,+ statValueStyle} from '../theme'import {- connectionSuffixes,dirnameOf,+ fileExtensionBadge,formatBytes,formatDuration,formatEta,formatPercent,+ formatSpeed,+ groupChunksByInterface,splitFormattedBytes,toDisplayPath} from '../utils/format'+// The hero band is always this exact dark panel from the design, regardless of the app's own+// light/dark theme — scoping the theme variables it reads (--text, --border, ...) to these+// literal values keeps its own children (labels, the merge diagram, the chart) legible no+// matter which OS appearance the rest of the window is following.+const heroScopeStyle: React.CSSProperties = {+ padding: '18px 20px',+ background: 'linear-gradient(#1f2224, #1b1e20)',+ borderBottom: '1px solid #2b2f33',+ color: '#f5f2ed',+ ...({+ '--text': '#f5f2ed',+ '--text-secondary': '#a9adb2',+ '--text-tertiary': '#8d9196',+ '--border': '#2b2f33'+ } as React.CSSProperties)+}+export function DownloadingScreen({ download }: { download: DownloadState }): React.JSX.Element {+ useNetworkPolling(true)+const homeDir = useAppStore((store) => store.homeDir)const speedHistory = useAppStore((store) => store.speedHistory)+ const speedHistoryByInterface = useAppStore((store) => store.speedHistoryByInterface)+ const peakSpeedBytesPerSec = useAppStore((store) => store.peakSpeedBytesPerSec)+ const latencies = useAppStore((store) => store.latencies)+ const networkPreferences = useAppStore((store) => store.networkPreferences)const [now, setNow] = useState(() => Date.now())useEffect(() => {@@ -46,7 +79,6 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re}, [percent, knownSize])const elapsedSeconds = (now - download.startedAt) / 1000- const activeCount = download.chunks.filter((chunk) => chunk.status === 'downloading').lengthconst handlePauseResume = (): void => {if (isPaused) void window.plexo.resumeDownload(download.id)@@ -55,193 +87,266 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst handleCancel = (): void => void window.plexo.cancelDownload(download.id)const speed = splitFormattedBytes(download.speedBytesPerSec)- const totalSpeed = download.chunks.reduce((sum, chunk) => sum + chunk.speedBytesPerSec, 0)- const weights = download.chunks.map((chunk) =>- totalSpeed > 0 ? chunk.speedBytesPerSec : chunk.bytesDownloaded+ const groups = groupChunksByInterface(download.chunks)+ const visuals = groups.map((group) =>+ resolveNetworkVisual(+ group.interfaceKind,+ group.interfaceLabel,+ networkPreferences[group.interfaceId]+ )+ )+ const activeGroups = groups.filter((group) =>+ group.chunks.some((chunk) => chunk.status === 'downloading')+ )+ const weights = groups.map((group) =>+ download.speedBytesPerSec > 0 ? group.speedBytesPerSec : group.bytesDownloaded)const totalWeight = weights.reduce((sum, weight) => sum + weight, 0) || 1- const maxSpeedSample = Math.max(1, ...speedHistory)- const suffixes = connectionSuffixes(download.chunks)++ const fastestIndex = groups.reduce<number>(+ (fastest, group, index) =>+ fastest === -1 || group.speedBytesPerSec > groups[fastest].speedBytesPerSec ? index : fastest,+ -1+ )+ const fastestGroup = fastestIndex === -1 ? null : groups[fastestIndex]+ const speedupRatio =+ fastestGroup && fastestGroup.speedBytesPerSec > 0+ ? download.speedBytesPerSec / fastestGroup.speedBytesPerSec+ : 0+ const showSpeedupChip = groups.length > 1 && speedupRatio > 1.05++ const completedChunks = download.chunks.filter((chunk) => chunk.status === 'completed').length+ const totalRetries = download.chunks.reduce((sum, chunk) => sum + chunk.retryCount, 0)+ const remainingBytes = knownSize ? Math.max(0, download.totalBytes - download.bytesDownloaded) : 0return (<divstyle={{ display: 'flex', flexDirection: 'column', height: '100%', background: 'var(--bg)' }}>- <div- style={{- padding: '18px 20px 16px',- background: 'linear-gradient(180deg, #13161c, #0d0f14)',- color: '#fff'- }}- >- <div style={{ display: 'flex', alignItems: 'flex-end', gap: 24 }}>- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>+ <div style={heroScopeStyle}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 20 }}>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 8, minWidth: 122 }}><divstyle={{- font: `600 10px/1 ${FONT_UI}`,- letterSpacing: '0.1em',- textTransform: 'uppercase',- color: 'rgba(255,255,255,0.55)'+ font: `500 10px/1 ${FONT_MONO}`,+ letterSpacing: '0.2em',+ color: '#8d9196'}}>- Combined throughput+ TOTAL SPEED</div><div style={{ display: 'flex', alignItems: 'baseline', gap: 7 }}><divstyle={{- font: `500 38px/1 ${FONT_MONO}`,- letterSpacing: '-0.02em',+ font: `600 40px/0.88 ${FONT_MONO}`,+ letterSpacing: '-0.03em',+ color: '#f5f2ed',fontVariantNumeric: 'tabular-nums'}}>{speed.value}</div>- <div style={{ font: `13px/1 ${FONT_MONO}`, color: 'rgba(255,255,255,0.6)' }}>+ <div style={{ font: `500 12px/1 ${FONT_MONO}`, color: '#8d9196' }}>{speed.unit}/s</div></div>+ {showSpeedupChip && fastestIndex !== -1 && (+ <div style={accentChipStyle}>+ {speedupRatio.toFixed(1)}× {visuals[fastestIndex].name.toUpperCase()} ALONE+ </div>+ )}</div>- <div style={{ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 8 }}>- <div- style={{- display: 'flex',- height: 10,- borderRadius: 5,- overflow: 'hidden',- background: 'rgba(255,255,255,0.1)'- }}- >- {download.chunks.map((chunk, index) => (- <div- key={chunk.id}- style={{- flex: weights[index],- background: KIND_PALETTE[chunk.interfaceKind].solid- }}- />- ))}- </div>+ <MergeDiagram networks={visuals.map((v) => ({ solid: v.solid, label: v.name }))} />++ <div style={{ flex: 1, minWidth: 0 }}><divstyle={{- display: 'flex',- gap: 16,- font: `10.5px/1 ${FONT_MONO}`,- color: 'rgba(255,255,255,0.65)',- flexWrap: 'wrap'+ font: `500 9.5px/1 ${FONT_MONO}`,+ letterSpacing: '0.12em',+ color: '#8d9196'}}>- {download.chunks.map((chunk, index) => (- <div key={chunk.id} style={{ display: 'flex', alignItems: 'center', gap: 5 }}>- <div- style={{- width: 6,- height: 6,- borderRadius: '50%',- background: KIND_PALETTE[chunk.interfaceKind].solid- }}- />- {KIND_PALETTE[chunk.interfaceKind].label}- {suffixes.get(chunk.id)} {Math.round((weights[index] / totalWeight) * 100)}%- </div>- ))}+ THROUGHPUT · LAST {speedHistory.length}S</div>- </div>-- <div style={{ display: 'flex', alignItems: 'flex-end', gap: 2, height: 44 }}>- {speedHistory.map((value, index) => (- <div- key={index}- style={{- width: 3,- borderRadius: 1.5,- background: 'rgba(255,255,255,0.34)',- height: `${Math.max(4, (value / maxSpeedSample) * 44)}px`- }}- />- ))}+ <ThroughputChart+ order={groups.map((g, i) => ({+ interfaceId: g.interfaceId,+ solid: visuals[i].solid+ }))}+ historyByInterface={speedHistoryByInterface}+ /></div></div></div>- <div style={{ padding: '14px 20px 12px', display: 'flex', flexDirection: 'column', gap: 9 }}>- <div style={{ display: 'flex', alignItems: 'baseline', gap: 10 }}>- <div style={{ font: `500 13px/1 ${FONT_UI}` }}>{download.fileName}</div>- <div style={{ flex: 1 }} />+ <div style={{ padding: '14px 20px 12px', display: 'flex', flexDirection: 'column', gap: 10 }}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}><divstyle={{- font: `11.5px/1 ${FONT_MONO}`,+ width: 38,+ height: 38,+ borderRadius: 9,+ background: 'var(--bg-secondary)',+ border: '0.5px solid var(--border-strong)',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ font: `600 8.5px/1 ${FONT_MONO}`,color: 'var(--text-secondary)',- fontVariantNumeric: 'tabular-nums'+ flexShrink: 0}}>- {formatBytes(download.bytesDownloaded)}- {knownSize ? ` of ${formatBytes(download.totalBytes)} · ${percent}%` : ''}- {!isPaused && knownSize- ? ` · ${formatEta(download.totalBytes - download.bytesDownloaded, download.speedBytesPerSec)} left`- : ''}- {isPaused ? ' · paused' : ''}+ {fileExtensionBadge(download.fileName)}+ </div>+ <div style={{ flex: 1, minWidth: 0 }}>+ <div+ style={{+ font: `600 13px/1.3 ${FONT_UI}`,+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {download.fileName}+ </div>+ <div+ style={{+ marginTop: 2,+ font: `11.5px/1 ${FONT_MONO}`,+ color: 'var(--text-secondary)',+ fontVariantNumeric: 'tabular-nums'+ }}+ >+ {formatBytes(download.bytesDownloaded)}+ {knownSize ? ` of ${formatBytes(download.totalBytes)} · ${percent}%` : ''}+ {!isPaused && knownSize+ ? ` · ${formatEta(remainingBytes, download.speedBytesPerSec)} left`+ : ''}+ {isPaused ? ' · paused' : ''}+ </div></div></div><div- style={{ height: 6, borderRadius: 3, background: 'var(--track-bg)', overflow: 'hidden' }}+ style={{+ height: 9,+ borderRadius: 999,+ background: 'var(--track-bg)',+ overflow: 'hidden',+ display: 'flex',+ gap: 2+ }}>- <div- style={{- width: knownSize ? `${percent}%` : '100%',- height: '100%',- borderRadius: 3,- background: PROGRESS_GRADIENT- }}- />+ {knownSize ? (+ <>+ {groups.map((group, index) => (+ <div+ key={group.interfaceId}+ style={{+ flex: group.bytesDownloaded || 0.0001,+ background: visuals[index].solid+ }}+ />+ ))}+ <div style={{ flex: remainingBytes || 0.0001 }} />+ </>+ ) : (+ <div style={{ width: '100%', background: 'var(--color-accent)' }} />+ )}</div></div><divstyle={{- borderTop: '0.5px solid var(--border)',- background: 'var(--bg-secondary)',- flex: 1,- overflowY: 'auto'+ margin: '0 20px 14px',+ ...statGridStyle,+ gridTemplateColumns: 'repeat(6, minmax(0, 1fr))'}}>+ {[+ { label: 'Downloaded', value: formatBytes(download.bytesDownloaded) },+ { label: 'Total', value: knownSize ? formatBytes(download.totalBytes) : '—' },+ {+ label: 'ETA',+ value:+ !isPaused && knownSize ? formatEta(remainingBytes, download.speedBytesPerSec) : '—'+ },+ { label: 'Elapsed', value: formatDuration(elapsedSeconds) },+ { label: 'Peak', value: formatSpeed(peakSpeedBytesPerSec) },+ { label: 'Chunks', value: `${completedChunks} / ${download.chunks.length}` }+ ].map((stat, index) => (+ <div+ key={stat.label}+ style={{+ padding: '9px 12px',+ display: 'flex',+ flexDirection: 'column',+ gap: 5,+ borderLeft: index > 0 ? '0.5px solid var(--border)' : undefined,+ minWidth: 0+ }}+ >+ <div style={statLabelStyle}>{stat.label}</div>+ <div+ style={{+ ...statValueStyle,+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {stat.value}+ </div>+ </div>+ ))}+ </div>++ <div style={{ flex: 1, overflowY: 'auto' }}><divstyle={{display: 'flex',alignItems: 'baseline',justifyContent: 'space-between',- padding: '11px 20px 7px'+ padding: '0 20px 8px'}}>- <div style={sectionHeaderLabelStyle}>Streams</div>+ <div style={sectionHeaderLabelStyle}>Networks</div><div style={sectionHeaderMetaStyle}>- {download.chunks.length} chunks · {activeCount} active+ {groups.length} merged · {download.chunks.length} chunks · {activeGroups.length} active</div></div>- {download.chunks.map((chunk) => (- <StreamRow- key={chunk.id}- chunk={chunk}+ <div style={networkTableHeaderStyle}>+ <div />+ <div>Network</div>+ <div>Chunks</div>+ <div style={{ textAlign: 'right' }}>Share</div>+ <div style={{ textAlign: 'right' }}>Speed</div>+ <div style={{ textAlign: 'right' }}>Moved</div>+ <div style={{ textAlign: 'right' }}>Ping</div>+ </div>+ {groups.map((group, index) => (+ <NetworkRow+ key={group.interfaceId}+ group={group}totalBytes={download.totalBytes}- connectionSuffix={suffixes.get(chunk.id)}+ sharePercent={(weights[index] / totalWeight) * 100}+ latencyMs={latencies[group.interfaceId]}/>))}</div><div style={footerStyle}><div style={footerTextStyle}>- elapsed {formatDuration(elapsedSeconds)} ·{' '}+ resumable · elapsed {formatDuration(elapsedSeconds)}+ {totalRetries > 0 ? ` · ${totalRetries} ${totalRetries === 1 ? 'retry' : 'retries'}` : ''}+ {' · '}{toDisplayPath(dirnameOf(download.destinationPath), homeDir)}</div><div style={{ flex: 1 }} /><button type="button" onClick={handlePauseResume} style={secondaryButtonStyle}>{isPaused ? 'Resume' : 'Pause'}</button>- <button- type="button"- onClick={handleCancel}- style={{ ...secondaryButtonStyle, padding: '6px 18px' }}- >+ <button type="button" onClick={handleCancel} style={dangerButtonStyle}>Cancel</button></div>diff --git a/src/renderer/src/screens/IdleScreen.tsx b/src/renderer/src/screens/IdleScreen.tsxindex e394eb6..c1a219e 100644--- a/src/renderer/src/screens/IdleScreen.tsx+++ b/src/renderer/src/screens/IdleScreen.tsx@@ -1,16 +1,14 @@import type { ProbeResult } from '@shared/types'import { useEffect, useRef, useState } from 'react'-import { ConnectionRow } from '../components/ConnectionRow'-import { FieldsSection } from '../components/FieldsSection'+import { NetworkCard } from '../components/NetworkCard'import { useNetworkPolling } from '../hooks/useNetworkPolling'import { useAppStore } from '../store/useAppStore'import {DANGER,+ FONT_MONO,+ FONT_UI,disabledPrimaryButtonStyle,- footerStyle,- footerTextStyle,primaryButtonStyle,- secondaryButtonStyle,sectionHeaderLabelStyle,sectionHeaderMetaStyle} from '../theme'@@ -19,22 +17,27 @@ import { describeError, formatBytes, toDisplayPath } from '../utils/format'type ProbeState =| { status: 'idle' }| { status: 'probing' }- | { status: 'ready'; result: ProbeResult; multiConnectionAllowed: boolean }+ | { status: 'ready'; result: ProbeResult; multiChunkAllowed: boolean }| { status: 'error'; message: string }const PROBE_DEBOUNCE_MS = 600-const MIN_CONNECTIONS_PER_INTERFACE = 1-const MAX_CONNECTIONS_PER_INTERFACE = 8+const MIN_CHUNKS_PER_NETWORK = 1+const MAX_CHUNKS_PER_NETWORK = 8-const stepperButtonStyle: React.CSSProperties = {- width: 20,- height: 20,- borderRadius: 5,- border: '0.5px solid var(--border-strong)',- background: 'linear-gradient(var(--button-secondary-from), var(--button-secondary-to))',- color: 'var(--text)',- font: '13px/1 -apple-system, sans-serif',- cursor: 'pointer'+const fieldLabelStyle: React.CSSProperties = {+ font: `500 10px/1 ${FONT_MONO}`,+ letterSpacing: '0.14em',+ color: 'var(--text-tertiary)',+ flexShrink: 0+}++const stepperArrowStyle: React.CSSProperties = {+ border: 'none',+ background: 'none',+ color: 'var(--text-secondary)',+ font: `600 13px/1 ${FONT_UI}`,+ cursor: 'pointer',+ padding: '0 2px'}export function IdleScreen(): React.JSX.Element {@@ -52,7 +55,7 @@ export function IdleScreen(): React.JSX.Element {const [probe, setProbe] = useState<ProbeState>({ status: 'idle' })const [selectedInterfaceIds, setSelectedInterfaceIds] = useState<string[]>([])- const [connectionsPerInterface, setConnectionsPerInterface] = useState(1)+ const [chunksPerNetwork, setChunksPerNetwork] = useState(1)const [starting, setStarting] = useState(false)const [startError, setStartError] = useState<string | null>(null)@@ -81,12 +84,12 @@ export function IdleScreen(): React.JSX.Element {try {const result = await window.plexo.probeUrl(trimmed)if (probeRequestId.current !== requestId) return- const multiConnectionAllowed = result.supportsRanges && result.totalBytes !== null- setProbe({ status: 'ready', result, multiConnectionAllowed })+ const multiChunkAllowed = result.supportsRanges && result.totalBytes !== null+ setProbe({ status: 'ready', result, multiChunkAllowed })setSelectedInterfaceIds(- (multiConnectionAllowed ? interfaces : interfaces.slice(0, 1)).map((iface) => iface.id)+ (multiChunkAllowed ? interfaces : interfaces.slice(0, 1)).map((iface) => iface.id))- setConnectionsPerInterface(1)+ setChunksPerNetwork(1)} catch (error) {if (probeRequestId.current !== requestId) returnsetProbe({ status: 'error', message: describeError(error) })@@ -100,9 +103,9 @@ export function IdleScreen(): React.JSX.Element {}, [url])const handleToggleInterface = (id: string): void => {- const multiConnectionAllowed = probe.status === 'ready' && probe.multiConnectionAllowed+ const multiChunkAllowed = probe.status === 'ready' && probe.multiChunkAllowedsetSelectedInterfaceIds((prev) => {- if (!multiConnectionAllowed) return [id]+ if (!multiChunkAllowed) return [id]return prev.includes(id) ? prev.filter((entry) => entry !== id) : [...prev, id]})}@@ -127,11 +130,9 @@ export function IdleScreen(): React.JSX.Element {destinationDir,suggestedFileName: probe.result.suggestedFileName,totalBytes: probe.result.totalBytes ?? 0,- supportsRanges: probe.multiConnectionAllowed,+ supportsRanges: probe.multiChunkAllowed,interfaceIds: selectedInterfaceIds,- connectionCount: probe.multiConnectionAllowed- ? selectedInterfaceIds.length * connectionsPerInterface- : 1,+ chunkCount: probe.multiChunkAllowed ? selectedInterfaceIds.length * chunksPerNetwork : 1,etag: probe.result.etag,lastModified: probe.result.lastModified})@@ -147,53 +148,203 @@ export function IdleScreen(): React.JSX.Element {selectedInterfaceIds.length > 0 &&Boolean(destinationDir) &&!starting+ const multiChunkAllowed = probe.status === 'ready' && probe.multiChunkAllowed+ const totalChunks = multiChunkAllowed ? selectedInterfaceIds.length * chunksPerNetwork : 1return (<divstyle={{ display: 'flex', flexDirection: 'column', height: '100%', background: 'var(--bg)' }}>- <FieldsSection- url={url}- onUrlChange={setUrl}- displayDestinationDir={toDisplayPath(destinationDir || downloadsDir, homeDir)}- onBrowse={handleBrowse}- />+ <div style={{ padding: '16px 20px 14px', display: 'flex', flexDirection: 'column', gap: 9 }}>+ <div style={{ display: 'flex', gap: 9, alignItems: 'center' }}>+ <div+ style={{+ flex: 1,+ minWidth: 0,+ display: 'flex',+ alignItems: 'center',+ gap: 9,+ padding: '9px 12px',+ borderRadius: 9,+ background: 'var(--input-bg)',+ border: '0.5px solid var(--border-strong)'+ }}+ >+ <div style={fieldLabelStyle}>LINK</div>+ <input+ type="text"+ value={url}+ onChange={(event) => setUrl(event.target.value)}+ placeholder="https://"+ style={{+ flex: 1,+ minWidth: 0,+ border: 'none',+ outline: 'none',+ background: 'transparent',+ font: `13px/1.3 ${FONT_MONO}`,+ color: 'var(--text)'+ }}+ />+ <button+ type="button"+ onClick={handlePaste}+ style={{+ border: 'none',+ borderRadius: 5,+ background: 'var(--track-bg)',+ padding: '3px 8px',+ font: `500 9.5px/1 ${FONT_MONO}`,+ color: 'var(--text-secondary)',+ whiteSpace: 'nowrap',+ cursor: 'pointer',+ flexShrink: 0+ }}+ >+ PASTE ⌘V+ </button>+ </div>+ <button+ type="button"+ onClick={handleStart}+ disabled={!canStart}+ style={canStart ? primaryButtonStyle : disabledPrimaryButtonStyle}+ >+ {starting ? 'Starting…' : 'Start'}+ </button>+ </div>- {probe.status === 'error' && (- <div- style={{- margin: '0 20px 10px',- font: '12px/1.4 -apple-system, sans-serif',- color: DANGER- }}- >- {probe.message}+ <div style={{ display: 'flex', gap: 9, alignItems: 'center' }}>+ <div+ style={{+ flex: 1,+ minWidth: 0,+ display: 'flex',+ alignItems: 'center',+ gap: 9,+ padding: '7px 12px',+ borderRadius: 9,+ background: 'var(--bg-secondary)',+ border: '0.5px solid var(--border)'+ }}+ >+ <div style={fieldLabelStyle}>SAVE TO</div>+ <div+ style={{+ flex: 1,+ minWidth: 0,+ font: `12.5px/1.3 ${FONT_MONO}`,+ color: 'var(--text-secondary)',+ whiteSpace: 'nowrap',+ overflow: 'hidden',+ textOverflow: 'ellipsis'+ }}+ >+ {toDisplayPath(destinationDir || downloadsDir, homeDir)}+ </div>+ <button+ type="button"+ onClick={handleBrowse}+ style={{+ border: 'none',+ background: 'none',+ font: `500 11px/1 ${FONT_MONO}`,+ color: 'var(--color-accent)',+ whiteSpace: 'nowrap',+ cursor: 'pointer',+ flexShrink: 0+ }}+ >+ Browse…+ </button>+ </div>+ <div+ style={{+ width: 122,+ flexShrink: 0,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ gap: 8,+ padding: '7px 0',+ borderRadius: 9,+ background: 'var(--bg-secondary)',+ border: '0.5px solid var(--border)',+ opacity: multiChunkAllowed ? 1 : 0.5+ }}+ >+ <button+ type="button"+ onClick={() =>+ setChunksPerNetwork((count) => Math.max(MIN_CHUNKS_PER_NETWORK, count - 1))+ }+ disabled={!multiChunkAllowed || chunksPerNetwork <= MIN_CHUNKS_PER_NETWORK}+ style={stepperArrowStyle}+ >+ −+ </button>+ <div+ style={{+ font: `11px/1 ${FONT_MONO}`,+ color: 'var(--text-secondary)',+ whiteSpace: 'nowrap'+ }}+ >+ {totalChunks} chunk{totalChunks === 1 ? '' : 's'}+ </div>+ <button+ type="button"+ onClick={() =>+ setChunksPerNetwork((count) => Math.min(MAX_CHUNKS_PER_NETWORK, count + 1))+ }+ disabled={!multiChunkAllowed || chunksPerNetwork >= MAX_CHUNKS_PER_NETWORK}+ style={stepperArrowStyle}+ >+ ++ </button>+ </div></div>- )}- <div- style={{- borderTop: '0.5px solid var(--border)',- background: 'var(--bg-secondary)',- flex: 1,- overflowY: 'auto'- }}- >+ {probe.status === 'error' && (+ <div style={{ font: `12px/1.4 ${FONT_UI}`, color: DANGER }}>{probe.message}</div>+ )}+ {probe.status === 'ready' && !probe.multiChunkAllowed && (+ <div style={{ font: `11.5px/1.4 ${FONT_UI}`, color: 'var(--text-tertiary)' }}>+ This server doesn't support multi-chunk downloads for this file — using a single+ network.+ </div>+ )}+ {startError && (+ <div style={{ font: `11.5px/1.4 ${FONT_UI}`, color: DANGER }}>{startError}</div>+ )}+ </div>++ <div style={{ flex: 1, overflowY: 'auto', padding: '0 20px 14px' }}><divstyle={{display: 'flex',alignItems: 'baseline',justifyContent: 'space-between',- padding: '12px 20px 8px'+ paddingBottom: 8,+ borderBottom: '0.5px solid var(--border)'}}>- <div style={sectionHeaderLabelStyle}>Connections</div>- <div style={sectionHeaderMetaStyle}>{interfaces.length} detected</div>+ <div style={sectionHeaderLabelStyle}>Networks</div>+ <div style={sectionHeaderMetaStyle}>+ {interfaces.length} detected · {selectedInterfaceIds.length} selected+ </div></div>- <div style={{ display: 'flex', flexDirection: 'column' }}>+ <div+ style={{+ display: 'grid',+ gridTemplateColumns: 'repeat(auto-fit, minmax(190px, 1fr))',+ gap: 10,+ paddingTop: 12+ }}+ >{interfaces.map((iface) => (- <ConnectionRow+ <NetworkCardkey={iface.id}iface={iface}selected={selectedInterfaceIds.includes(iface.id)}@@ -202,108 +353,25 @@ export function IdleScreen(): React.JSX.Element {/>))}</div>-- {probe.status === 'ready' &&- probe.multiConnectionAllowed &&- selectedInterfaceIds.length > 0 && (- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 10,- padding: '10px 20px',- borderTop: '0.5px solid var(--border-subtle)'- }}- >- <div style={{ font: '12.5px/1 -apple-system, sans-serif', color: 'var(--text)' }}>- Connections per link- </div>- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>- <button- type="button"- onClick={() =>- setConnectionsPerInterface((count) =>- Math.max(MIN_CONNECTIONS_PER_INTERFACE, count - 1)- )- }- disabled={connectionsPerInterface <= MIN_CONNECTIONS_PER_INTERFACE}- style={stepperButtonStyle}- >- −- </button>- <div- style={{- font: `12.5px/1 ${'"SF Mono", ui-monospace, Menlo, monospace'}`,- color: 'var(--text)',- width: 14,- textAlign: 'center'- }}- >- {connectionsPerInterface}- </div>- <button- type="button"- onClick={() =>- setConnectionsPerInterface((count) =>- Math.min(MAX_CONNECTIONS_PER_INTERFACE, count + 1)- )- }- disabled={connectionsPerInterface >= MAX_CONNECTIONS_PER_INTERFACE}- style={stepperButtonStyle}- >- +- </button>- </div>- <div style={{ flex: 1 }} />- <div- style={{- font: '11.5px/1.4 -apple-system, sans-serif',- color: 'var(--text-tertiary)'- }}- >- {selectedInterfaceIds.length * connectionsPerInterface} connections total- </div>- </div>- )}-- {probe.status === 'ready' && !probe.multiConnectionAllowed && (- <div- style={{- margin: '0 20px 10px',- font: '11.5px/1.4 -apple-system, sans-serif',- color: 'var(--text-tertiary)'- }}- >- This server doesn't support multi-connection downloads for this file — pick a- single connection.- </div>- )}</div>- <div style={footerStyle}>- <div style={footerTextStyle}>- {selectedInterfaceIds.length} selected+ <div+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '11px 20px',+ background: 'var(--bg-tertiary)',+ borderTop: '0.5px solid var(--footer-border)'+ }}+ >+ <div style={{ font: `11px/1.4 ${FONT_MONO}`, color: 'var(--text-tertiary)' }}>+ {selectedInterfaceIds.length} {selectedInterfaceIds.length === 1 ? 'network' : 'networks'}{' '}+ selected{probe.status === 'ready' && probe.result.totalBytes !== null? ` · ${formatBytes(probe.result.totalBytes)}`: ''}</div>- {startError && (- <div style={{ font: '11.5px/1.4 -apple-system, sans-serif', color: DANGER }}>- {startError}- </div>- )}- <div style={{ flex: 1 }} />- <button type="button" onClick={handlePaste} style={secondaryButtonStyle}>- Paste from Clipboard- </button>- <button- type="button"- onClick={handleStart}- disabled={!canStart}- style={canStart ? primaryButtonStyle : disabledPrimaryButtonStyle}- >- Start- </button></div></div>)diff --git a/src/renderer/src/screens/NoConnectionsScreen.tsx b/src/renderer/src/screens/NoConnectionsScreen.tsxindex 2f6ae46..f577b45 100644--- a/src/renderer/src/screens/NoConnectionsScreen.tsx+++ b/src/renderer/src/screens/NoConnectionsScreen.tsx@@ -1,111 +1,77 @@-import { FieldsSection } from '../components/FieldsSection'+import { MergeDiagram } from '../components/MergeDiagram'import { useNetworkPolling } from '../hooks/useNetworkPolling'import { useAppStore } from '../store/useAppStore'-import {- disabledPrimaryButtonStyle,- footerStyle,- footerTextStyle,- secondaryButtonStyle-} from '../theme'-import { toDisplayPath } from '../utils/format'+import { FONT_MONO, FONT_UI, disabledPrimaryButtonStyle, secondaryButtonStyle } from '../theme'++// Colors are irrelevant here — the diagram is rendered `muted`, which overrides them all to+// var(--icon-muted) — these are just three placeholder rows to draw the illustration with.+const PLACEHOLDER_NETWORKS = [+ { solid: 'var(--icon-muted)', label: 'Wi-Fi' },+ { solid: 'var(--icon-muted)', label: 'USB' },+ { solid: 'var(--icon-muted)', label: 'Ethernet' }+]export function NoConnectionsScreen(): React.JSX.Element {useNetworkPolling(true)- const url = useAppStore((store) => store.draftUrl)- const setUrl = useAppStore((store) => store.setDraftUrl)- const destinationDir = useAppStore((store) => store.draftDestinationDir)- const homeDir = useAppStore((store) => store.homeDir)- const downloadsDir = useAppStore((store) => store.downloadsDir)const loadInterfaces = useAppStore((store) => store.loadInterfaces)return (<divstyle={{ display: 'flex', flexDirection: 'column', height: '100%', background: 'var(--bg)' }}>- <FieldsSection- url={url}- onUrlChange={setUrl}- displayDestinationDir={toDisplayPath(destinationDir || downloadsDir, homeDir)}- onBrowse={() => {}}- disabled- />-<divstyle={{- borderTop: '0.5px solid var(--border)',- background: 'var(--bg-secondary)',flex: 1,padding: '40px 20px 44px',display: 'flex',flexDirection: 'column',alignItems: 'center',- gap: 12+ justifyContent: 'center',+ gap: 16}}>- <div- style={{- width: 40,- height: 40,- borderRadius: '50%',- border: '1.5px dashed var(--icon-muted)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center'- }}- >- <div- style={{ width: 8, height: 8, borderRadius: '50%', background: 'var(--icon-muted)' }}- />- </div>- <div style={{ font: '600 14px/1.2 -apple-system, sans-serif', color: 'var(--text)' }}>- No active network interfaces+ <MergeDiagram networks={PLACEHOLDER_NETWORKS} muted />+ <div style={{ font: `700 16px/1.2 ${FONT_UI}`, color: 'var(--text)' }}>+ No networks to merge</div><divstyle={{- maxWidth: 400,+ maxWidth: 380,textAlign: 'center',- font: '12.5px/1.5 -apple-system, sans-serif',+ font: `12.5px/1.6 ${FONT_UI}`,color: 'var(--text-secondary)'}}>- Plexo needs at least one connection. Join a Wi-Fi network, plug in Ethernet, or connect an- iPhone over USB with Personal Hotspot enabled.+ Plexo needs at least one active network. Join a Wi-Fi network, plug in Ethernet, or+ connect an iPhone over USB with Personal Hotspot enabled.</div><div style={{ display: 'flex', gap: 8, marginTop: 4 }}>- <button- type="button"- onClick={() => loadInterfaces()}- style={{- ...secondaryButtonStyle,- padding: '5px 13px',- font: '12.5px/1.3 -apple-system, sans-serif'- }}- >- Check Again+ <button type="button" onClick={() => loadInterfaces()} style={secondaryButtonStyle}>+ Scan Again</button><buttontype="button"onClick={() => window.plexo.openNetworkSettings()}- style={{- ...secondaryButtonStyle,- padding: '5px 13px',- font: '12.5px/1.3 -apple-system, sans-serif'- }}+ style={secondaryButtonStyle}>Network Settings…</button></div></div>- <div style={footerStyle}>- <div style={{ display: 'flex', alignItems: 'center', gap: 7 }}>- <div- style={{ width: 7, height: 7, borderRadius: '50%', background: 'var(--icon-muted)' }}- />- <div style={{ ...footerTextStyle, color: 'var(--text-tertiary)' }}>- 0 interfaces · monitoring- </div>+ <div+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '11px 20px',+ background: 'var(--bg-tertiary)',+ borderTop: '0.5px solid var(--footer-border)'+ }}+ >+ <div style={{ font: `11px/1.4 ${FONT_MONO}`, color: 'var(--text-tertiary)' }}>+ 0 networks · watching for changes</div><div style={{ flex: 1 }} /><button type="button" disabled style={disabledPrimaryButtonStyle}>diff --git a/src/renderer/src/store/useAppStore.ts b/src/renderer/src/store/useAppStore.tsindex 89a5620..56a83e0 100644--- a/src/renderer/src/store/useAppStore.ts+++ b/src/renderer/src/store/useAppStore.ts@@ -1,15 +1,28 @@-import type { DownloadState, NetworkInterfaceInfo } from '@shared/types'+import type {+ DownloadState,+ NetworkInterfaceInfo,+ NetworkPreference,+ NetworkPreferences+} from '@shared/types'import { create } from 'zustand'+import { groupChunksByInterface } from '../utils/format'type LoadStatus = 'idle' | 'loading' | 'ready' | 'error'-const SPEED_HISTORY_LENGTH = 24+const SPEED_HISTORY_LENGTH = 60+const SPEED_SAMPLE_INTERVAL_MS = 1000++// Throttling cadence lives outside the store's own state — it's bookkeeping for how often to+// sample, not something a component should ever read or re-render on.+let lastSpeedSampleAt = 0interface AppStore {interfaces: NetworkInterfaceInfo[]interfacesStatus: LoadStatusinterfacesError: string | nulllatencies: Record<string, number | null>+ /** User customizations (name/color) per network interface id — persisted in the main process. */+ networkPreferences: NetworkPreferenceshomeDir: stringdownloadsDir: string@@ -18,6 +31,12 @@ interface AppStore {/** Plexo focuses on one download at a time — this is it. */currentDownload: DownloadState | nullspeedHistory: number[]+ /** Same rolling window as speedHistory, split by physical network — for the stacked+ * per-network throughput chart, keyed by interface id. */+ speedHistoryByInterface: Record<string, number[]>+ /** Highest combined speed seen so far this download — a rolling history window would lose it+ * once it ages out, so this is tracked as a running max instead. */+ peakSpeedBytesPerSec: number/** Lifted out of the Idle screen so it survives a swap to/from the No-connections screen. */draftUrl: string@@ -26,6 +45,8 @@ interface AppStore {loadInterfaces: () => Promise<void>refreshLatencies: () => Promise<void>loadInitialPaths: () => Promise<void>+ loadNetworkPreferences: () => Promise<void>+ setNetworkPreference: (id: string, patch: NetworkPreference) => Promise<void>setCurrentDownload: (state: DownloadState) => voidclearCurrentDownload: () => voidsetDraftUrl: (url: string) => void@@ -37,6 +58,7 @@ export const useAppStore = create<AppStore>((set, get) => ({interfacesStatus: 'idle',interfacesError: null,latencies: {},+ networkPreferences: {},homeDir: '',downloadsDir: '',@@ -44,6 +66,8 @@ export const useAppStore = create<AppStore>((set, get) => ({currentDownload: null,speedHistory: [],+ speedHistoryByInterface: {},+ peakSpeedBytesPerSec: 0,draftUrl: '',draftDestinationDir: '',@@ -80,23 +104,70 @@ export const useAppStore = create<AppStore>((set, get) => ({}},+ loadNetworkPreferences: async () => {+ try {+ const networkPreferences = await window.plexo.getNetworkPreferences()+ set({ networkPreferences })+ } catch {+ // Best-effort — a failed read just leaves networks under their OS names/default colors.+ }+ },++ setNetworkPreference: async (id, patch) => {+ // Optimistic update so the rename/recolor feels instant — the IPC round trip resolves+ // (or, on failure, quietly leaves the optimistic value as the source of truth for now).+ set((state) => ({+ networkPreferences: {+ ...state.networkPreferences,+ [id]: { ...state.networkPreferences[id], ...patch }+ }+ }))+ try {+ const networkPreferences = await window.plexo.setNetworkPreference(id, patch)+ set({ networkPreferences })+ } catch {+ // Leave the optimistic value in place — not persisted to disk, but still usable this session.+ }+ },+setCurrentDownload: (download) => {const previous = get().currentDownloadconst isNewDownload = !previous || previous.id !== download.id- set({- currentDownload: download,- speedHistory:- download.status === 'downloading'- ? [...(isNewDownload ? [] : get().speedHistory), download.speedBytesPerSec].slice(- -SPEED_HISTORY_LENGTH- )- : isNewDownload- ? []- : get().speedHistory- })++ let speedHistory = isNewDownload ? [] : get().speedHistory+ let speedHistoryByInterface = isNewDownload ? {} : get().speedHistoryByInterface+ let peakSpeedBytesPerSec = isNewDownload ? 0 : get().peakSpeedBytesPerSec+ if (isNewDownload) lastSpeedSampleAt = 0++ if (download.status === 'downloading') {+ peakSpeedBytesPerSec = Math.max(peakSpeedBytesPerSec, download.speedBytesPerSec)++ const now = Date.now()+ if (now - lastSpeedSampleAt >= SPEED_SAMPLE_INTERVAL_MS) {+ lastSpeedSampleAt = now+ speedHistory = [...speedHistory, download.speedBytesPerSec].slice(-SPEED_HISTORY_LENGTH)++ const nextByInterface: Record<string, number[]> = {}+ for (const group of groupChunksByInterface(download.chunks)) {+ const previousSeries = speedHistoryByInterface[group.interfaceId] ?? []+ nextByInterface[group.interfaceId] = [...previousSeries, group.speedBytesPerSec].slice(+ -SPEED_HISTORY_LENGTH+ )+ }+ speedHistoryByInterface = nextByInterface+ }+ }++ set({ currentDownload: download, speedHistory, speedHistoryByInterface, peakSpeedBytesPerSec })},- clearCurrentDownload: () => set({ currentDownload: null, speedHistory: [] }),+ clearCurrentDownload: () =>+ set({+ currentDownload: null,+ speedHistory: [],+ speedHistoryByInterface: {},+ peakSpeedBytesPerSec: 0+ }),setDraftUrl: (draftUrl) => set({ draftUrl }),setDraftDestinationDir: (draftDestinationDir) => set({ draftDestinationDir })diff --git a/src/renderer/src/theme.ts b/src/renderer/src/theme.tsindex 547356e..2b257bd 100644--- a/src/renderer/src/theme.ts+++ b/src/renderer/src/theme.ts@@ -1,96 +1,144 @@-import type { NetworkInterfaceKind } from '@shared/types'+import type { NetworkInterfaceKind, NetworkPreference } from '@shared/types'-export const FONT_UI = `-apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, sans-serif`-export const FONT_MONO = `"SF Mono", ui-monospace, Menlo, monospace`+export const FONT_UI = `'Manrope', -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, sans-serif`+export const FONT_MONO = `"Roboto Mono", "SF Mono", ui-monospace, Menlo, monospace`interface KindPalette {solid: stringbg: string+ border: stringtext: string+ /** Glyph/text color for content drawn directly on top of `solid` (e.g. a checkmark). */+ onSolid: stringlabel: string}+function makeKindPalette(name: string, label: string): KindPalette {+ return {+ solid: `var(--color-${name})`,+ bg: `var(--color-${name}-bg)`,+ border: `var(--color-${name}-border)`,+ text: `var(--color-${name}-text)`,+ onSolid: `var(--color-${name}-onsolid)`,+ label+ }+}++// Teal / amber / steel per network, per the "Plexo v2" design — exact hex values live as+// CSS custom properties (main.css) so dark mode reproduces the design precisely while light+// mode gets a coherent, hand-tuned counterpart in the same hues.export const KIND_PALETTE: Record<NetworkInterfaceKind, KindPalette> = {- wifi: {- solid: 'oklch(0.6 0.16 250)',- bg: 'var(--kind-wifi-bg)',- text: 'var(--kind-wifi-text)',- label: 'WIFI'- },- usb: {- solid: 'oklch(0.65 0.14 195)',- bg: 'var(--kind-usb-bg)',- text: 'var(--kind-usb-text)',- label: 'USB'- },- ethernet: {- solid: 'oklch(0.58 0.17 300)',- bg: 'var(--kind-ethernet-bg)',- text: 'var(--kind-ethernet-text)',- label: 'ETH'- },- bridge: {- solid: 'oklch(0.55 0.02 260)',- bg: 'var(--kind-neutral-bg)',- text: 'var(--kind-neutral-text)',- label: 'NET'+ wifi: makeKindPalette('wifi', 'WIFI'),+ usb: makeKindPalette('usb', 'USB'),+ ethernet: makeKindPalette('ethernet', 'ETH'),+ bridge: makeKindPalette('neutral', 'NET'),+ other: makeKindPalette('neutral', 'NET')+}++// The brand amber doubles as the USB network color, exactly as in the design.+export const ACCENT = 'var(--color-accent)'+export const ACCENT_ON_TEXT = 'var(--color-accent-onsolid)'+export const SUCCESS = 'var(--color-success)'+export const DANGER = 'var(--color-danger)'++export const PROGRESS_GRADIENT = `linear-gradient(90deg, var(--color-wifi), var(--color-ethernet))`++export const accentChipStyle: React.CSSProperties = {+ padding: '4px 9px',+ borderRadius: 5,+ background: 'var(--color-usb-bg)',+ border: '0.5px solid var(--color-usb-border)',+ font: `600 10.5px/1 ${FONT_MONO}`,+ color: 'var(--color-usb-text)',+ whiteSpace: 'nowrap'+}++const PILL_TOKENS: Record<'positive' | 'negative', { bg: string; border: string; text: string }> = {+ positive: {+ bg: 'var(--color-wifi-bg)',+ border: 'var(--color-wifi-border)',+ text: 'var(--color-wifi-text)'},- other: {- solid: 'oklch(0.55 0.02 260)',- bg: 'var(--kind-neutral-bg)',- text: 'var(--kind-neutral-text)',- label: 'NET'+ negative: {+ bg: 'var(--color-danger-bg)',+ border: 'var(--color-danger-border)',+ text: 'var(--color-danger)'}}-export const ACCENT_GRADIENT = 'linear-gradient(oklch(0.62 0.19 255), oklch(0.56 0.19 255))'-export const PROGRESS_GRADIENT = 'linear-gradient(90deg, oklch(0.6 0.16 250), oklch(0.62 0.17 290))'-export const SUCCESS = 'oklch(0.62 0.15 150)'-export const DANGER = 'oklch(0.55 0.2 25)'+export function pillStyle(kind: 'positive' | 'negative'): React.CSSProperties {+ const tokens = PILL_TOKENS[kind]+ return {+ display: 'flex',+ alignItems: 'center',+ gap: 7,+ padding: '4px 10px',+ borderRadius: 999,+ background: tokens.bg,+ border: `0.5px solid ${tokens.border}`,+ font: `600 10px/1 ${FONT_MONO}`,+ letterSpacing: '0.08em',+ textTransform: 'uppercase',+ color: tokens.text,+ whiteSpace: 'nowrap'+ }+}export const secondaryButtonStyle: React.CSSProperties = {- border: '0.5px solid var(--border-strong)',- borderRadius: 6,- background: 'linear-gradient(var(--button-secondary-from), var(--button-secondary-to))',+ border: '0.5px solid var(--button-secondary-border)',+ borderRadius: 8,+ background: 'var(--button-secondary-bg)',whiteSpace: 'nowrap',flexShrink: 0,- boxShadow: '0 1px 1px var(--button-shadow)',- padding: '6px 14px',- font: `13px/1.3 ${FONT_UI}`,+ boxShadow: 'var(--button-shadow)',+ padding: '8px 17px',+ font: `600 12.5px/1.3 ${FONT_UI}`,color: 'var(--text)',cursor: 'pointer'}export const primaryButtonStyle: React.CSSProperties = {border: 'none',- borderRadius: 6,- background: ACCENT_GRADIENT,- boxShadow: '0 1px 2px rgba(0,0,0,0.18), inset 0 0.5px 0 rgba(255,255,255,0.3)',+ borderRadius: 8,+ background: 'var(--color-accent)',+ boxShadow: '0 4px 14px var(--color-accent-shadow)',whiteSpace: 'nowrap',flexShrink: 0,- padding: '6px 20px',- font: `500 13px/1.3 ${FONT_UI}`,- color: '#fff',+ padding: '8px 19px',+ font: `700 12.5px/1.3 ${FONT_UI}`,+ color: 'var(--color-accent-onsolid)',cursor: 'pointer'}export const disabledPrimaryButtonStyle: React.CSSProperties = {border: '0.5px solid var(--button-disabled-border)',- borderRadius: 6,+ borderRadius: 8,whiteSpace: 'nowrap',flexShrink: 0,background: 'var(--button-disabled-bg)',- padding: '6px 20px',- font: `500 13px/1.3 ${FONT_UI}`,+ padding: '8px 19px',+ font: `700 12.5px/1.3 ${FONT_UI}`,color: 'var(--button-disabled-text)',cursor: 'not-allowed'}+export const dangerButtonStyle: React.CSSProperties = {+ border: '0.5px solid var(--color-danger-border)',+ borderRadius: 8,+ background: 'var(--color-danger-bg)',+ whiteSpace: 'nowrap',+ flexShrink: 0,+ padding: '8px 17px',+ font: `600 12.5px/1.3 ${FONT_UI}`,+ color: 'var(--color-danger)',+ cursor: 'pointer'+}+export const footerStyle: React.CSSProperties = {display: 'flex',alignItems: 'center',gap: 12,- padding: '12px 20px',+ padding: '11px 20px',borderTop: '0.5px solid var(--footer-border)',background: 'var(--bg-tertiary)'}@@ -98,13 +146,13 @@ export const footerStyle: React.CSSProperties = {export const footerTextStyle: React.CSSProperties = {whiteSpace: 'nowrap',flexShrink: 0,- font: `11.5px/1.4 ${FONT_MONO}`,- color: 'var(--text-secondary)'+ font: `11px/1.4 ${FONT_MONO}`,+ color: 'var(--text-tertiary)'}export const sectionHeaderLabelStyle: React.CSSProperties = {- font: `600 11px/1 ${FONT_UI}`,- letterSpacing: '0.06em',+ font: `500 10px/1 ${FONT_MONO}`,+ letterSpacing: '0.16em',textTransform: 'uppercase',color: 'var(--text-tertiary)'}@@ -112,6 +160,97 @@ export const sectionHeaderLabelStyle: React.CSSProperties = {export const sectionHeaderMetaStyle: React.CSSProperties = {whiteSpace: 'nowrap',flexShrink: 0,- font: `11px/1 ${FONT_MONO}`,+ font: `10.5px/1 ${FONT_MONO}`,+ color: 'var(--text-tertiary)'+}++export const statGridStyle: React.CSSProperties = {+ display: 'grid',+ border: '0.5px solid var(--border)',+ borderRadius: 10,+ overflow: 'hidden',+ background: 'var(--bg-secondary)'+}++export const statLabelStyle: React.CSSProperties = {+ font: `500 9px/1 ${FONT_MONO}`,+ letterSpacing: '0.14em',+ textTransform: 'uppercase',color: 'var(--text-tertiary)'}++export const statValueStyle: React.CSSProperties = {+ font: `500 14px/1 ${FONT_MONO}`,+ fontVariantNumeric: 'tabular-nums'+}++export const NETWORK_ROW_GRID_COLUMNS = '10px 160px 1fr 40px 82px 68px 52px'++export const networkTableHeaderStyle: React.CSSProperties = {+ display: 'grid',+ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS,+ gap: 12,+ padding: '10px 20px 7px',+ font: `400 9.5px/1 ${FONT_MONO}`,+ letterSpacing: '0.12em',+ textTransform: 'uppercase',+ color: 'var(--text-tertiary)',+ borderBottom: '0.5px solid var(--border)'+}++export const TITLE_BAR_HEIGHT = 44++// 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+// to compute contrast for an arbitrary user-picked hue at runtime.+export const NETWORK_COLOR_SWATCHES = [+ { id: 'teal', label: 'Teal', solid: '#4ea89a', onSolid: '#10201d' },+ { id: 'amber', label: 'Amber', solid: '#d8a44c', onSolid: '#221806' },+ { id: 'steel', label: 'Steel', solid: '#7e93bd', onSolid: '#141a26' },+ { id: 'rose', label: 'Rose', solid: '#c97b7b', onSolid: '#210f0f' },+ { id: 'violet', label: 'Violet', solid: '#9c8fd6', onSolid: '#17131f' },+ { id: 'lime', label: 'Lime', solid: '#a3c66a', onSolid: '#161f0d' },+ { id: 'cyan', label: 'Cyan', solid: '#6db8c9', onSolid: '#0d1a1e' },+ { id: 'coral', label: 'Coral', solid: '#d99168', onSolid: '#241209' }+] as const++export type NetworkColorId = (typeof NETWORK_COLOR_SWATCHES)[number]['id']++/** Derives a full surface set (bg/border/text) from a swatch's one solid color, tinted against+ * the ambient theme — same trick as the kind palette, just computed at runtime since these+ * colors are picked by the user rather than baked into the design. */+function tint(source: string, amount: number, base = 'var(--bg-secondary)'): string {+ return `color-mix(in oklch, ${source} ${amount}%, ${base})`+}++export interface NetworkVisual extends KindPalette {+ /** The network's effective display name — the user's custom name if set, else the OS one. */+ name: string+}++/** Resolves what a physical network should actually look like in the UI: its kind's default+ * palette, unless the user picked a custom color for this specific interface id, and its OS+ * display name, unless the user gave it a friendlier one (e.g. "feth0" -> "iPhone Hotspot"). */+export function resolveNetworkVisual(+ kind: NetworkInterfaceKind,+ fallbackName: string,+ preference: NetworkPreference | undefined+): NetworkVisual {+ const name = preference?.customName?.trim() || fallbackName+ const kindPalette = KIND_PALETTE[kind]+ const swatch = NETWORK_COLOR_SWATCHES.find((entry) => entry.id === preference?.colorId)++ if (!swatch) {+ return { ...kindPalette, name }+ }++ return {+ solid: swatch.solid,+ bg: tint(swatch.solid, 16),+ border: tint(swatch.solid, 42, 'var(--border-strong)'),+ text: tint(swatch.solid, 62, 'var(--text)'),+ onSolid: swatch.onSolid,+ label: kindPalette.label,+ name+ }+}diff --git a/src/renderer/src/utils/format.ts b/src/renderer/src/utils/format.tsindex 3b5b166..23dafdf 100644--- a/src/renderer/src/utils/format.ts+++ b/src/renderer/src/utils/format.ts@@ -1,3 +1,5 @@+import type { ChunkState, NetworkInterfaceKind } from '@shared/types'+const UNITS = ['B', 'KB', 'MB', 'GB', 'TB']export function formatBytes(bytes: number): string {@@ -31,6 +33,13 @@ export function fileNameFromPath(path: string): string {return path.split('/').pop() ?? path}+/** Short uppercase file-type badge from a name's extension, e.g. "Xcode_16.2.xip" -> "XIP". */+export function fileExtensionBadge(fileName: string): string {+ const dotIndex = fileName.lastIndexOf('.')+ if (dotIndex <= 0 || dotIndex === fileName.length - 1) return 'FILE'+ return fileName.slice(dotIndex + 1, dotIndex + 4).toUpperCase()+}+/** m:ss, or h:mm:ss past an hour. */export function formatDuration(seconds: number): string {const total = Math.max(0, Math.round(seconds))@@ -52,29 +61,43 @@ export function dirnameOf(path: string): string {return index <= 0 ? '/' : path.slice(0, index)}-/** For chunks that share the same interface (multiple connections per link, or ones split- * off by dynamic rebalancing), returns a per-chunk " #N" suffix so they can be told apart- * in the UI — empty string when an interface only has a single chunk. */-export function connectionSuffixes(- chunks: Array<{ id: number; interfaceId: string }>-): Map<number, string> {- const totalByInterface = new Map<string, number>()- for (const chunk of chunks) {- totalByInterface.set(chunk.interfaceId, (totalByInterface.get(chunk.interfaceId) ?? 0) + 1)- }+export interface NetworkGroup {+ interfaceId: string+ interfaceLabel: string+ interfaceKind: NetworkInterfaceKind+ chunks: ChunkState[]+ bytesDownloaded: number+ speedBytesPerSec: number+}++/** Chunks are the unit of transfer, but a physical network is the unit the user thinks and+ * decides in — a network can carry several chunks (via "chunks per network", or ones split+ * off by dynamic rebalancing). Groups chunks by their interface, in order of first appearance,+ * with per-network totals so the UI can show one row per physical network. */+export function groupChunksByInterface(chunks: ChunkState[]): NetworkGroup[] {+ const order: string[] = []+ const groups = new Map<string, NetworkGroup>()- const seenByInterface = new Map<string, number>()- const suffixes = new Map<number, string>()for (const chunk of chunks) {- if ((totalByInterface.get(chunk.interfaceId) ?? 0) <= 1) {- suffixes.set(chunk.id, '')- continue+ let group = groups.get(chunk.interfaceId)+ if (!group) {+ group = {+ interfaceId: chunk.interfaceId,+ interfaceLabel: chunk.interfaceLabel,+ interfaceKind: chunk.interfaceKind,+ chunks: [],+ bytesDownloaded: 0,+ speedBytesPerSec: 0+ }+ groups.set(chunk.interfaceId, group)+ order.push(chunk.interfaceId)}- const seen = (seenByInterface.get(chunk.interfaceId) ?? 0) + 1- seenByInterface.set(chunk.interfaceId, seen)- suffixes.set(chunk.id, ` #${seen}`)+ group.chunks.push(chunk)+ group.bytesDownloaded += chunk.bytesDownloaded+ group.speedBytesPerSec += chunk.speedBytesPerSec}- return suffixes++ return order.map((interfaceId) => groups.get(interfaceId)!)}/** Shortens an absolute path under the user's home directory to a "~/..." form for display. */diff --git a/src/shared/ipc-channels.ts b/src/shared/ipc-channels.tsindex 9c9d91b..6593480 100644--- a/src/shared/ipc-channels.ts+++ b/src/shared/ipc-channels.ts@@ -2,6 +2,8 @@ export const IpcChannels = {listInterfaces: 'network:list-interfaces',pingInterfaces: 'network:ping-interfaces',openNetworkSettings: 'network:open-settings',+ getNetworkPreferences: 'network:get-preferences',+ setNetworkPreference: 'network:set-preference',probeUrl: 'download:probe',getInitialPaths: 'paths:get-initial',chooseDestinationFolder: 'dialog:choose-destination-folder',diff --git a/src/shared/types.ts b/src/shared/types.tsindex a35e062..c21af73 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -41,6 +41,8 @@ export interface ChunkState {speedBytesPerSec: numberstatus: ChunkStatuserror?: string+ /** Number of times this chunk's connection has been retried after a dropped/failed attempt. */+ retryCount: number}export interface DownloadState {@@ -59,6 +61,18 @@ export interface DownloadState {completedAt?: number}+/** User customization for one physical network, keyed by NetworkInterfaceInfo.id — lets a+ * cryptic OS device name (e.g. "feth0") get a real label, and a color distinct from its+ * kind's default. Persisted in the main process, independent of any single download. */+export interface NetworkPreference {+ customName?: string+ /** One of the app's curated swatch ids (see NETWORK_COLOR_SWATCHES) — not a raw hex, so every+ * swatch is guaranteed to have a legible on-solid text color already picked out for it. */+ colorId?: string+}++export type NetworkPreferences = Record<string, NetworkPreference>+export interface StartDownloadRequest {url: stringdestinationDir: string@@ -67,8 +81,8 @@ export interface StartDownloadRequest {totalBytes: numbersupportsRanges: booleaninterfaceIds: string[]- /** Total parallel connections to open, distributed round-robin across interfaceIds. */- connectionCount: number+ /** Total chunks to split the download into, distributed round-robin across interfaceIds. */+ chunkCount: numberetag: string | nulllastModified: string | null}