Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

Finish Tailwind/shadcn migration and architecture cleanup for remaining screens

Anmol Kapil3dfdfdfa31f0
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index bcfd8d4..c0c0a9a 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -83,9 +83,9 @@ function App(): React.JSX.Element {
return (
<TooltipProvider>
- <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
+ <div className="flex h-full flex-col">
<TitleBar status={titleBarStatus} />
- <div style={{ flex: 1, minHeight: 0 }}>{screen}</div>
+ <div className="min-h-0 flex-1">{screen}</div>
<DevToolsPanel />
</div>
</TooltipProvider>
diff --git a/src/renderer/src/components/BlockGrid.tsx b/src/renderer/src/components/BlockGrid.tsx
index 1b038b8..04c11c9 100644
--- a/src/renderer/src/components/BlockGrid.tsx
+++ b/src/renderer/src/components/BlockGrid.tsx
@@ -1,6 +1,6 @@
import type { BlockState, BlockStatus } from '@shared/types'
import { useCallback, useRef, useState } from 'react'
-import { FONT_MONO, type NetworkVisual } from '../theme'
+import type { NetworkVisual } from '../theme'
import { formatBytes, type NetworkGroup } from '../utils/format'
// The grid is a byte-space map of the file: one square per chunk, running left-to-right,
@@ -240,81 +240,32 @@ export function BlockGrid({
).offsets
return (
- <div
- style={{
- background: 'var(--bg-secondary)',
- border: '0.5px solid var(--border)',
- borderRadius: 9,
- padding: '10px 14px 11px',
- display: 'flex',
- flexDirection: 'column',
- gap: 9
- }}
- >
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 14,
- flexWrap: 'wrap'
- }}
- >
+ <div className="flex flex-col gap-[9px] rounded-[9px] border-[0.5px] border-border bg-card px-[14px] pt-[10px] pb-[11px]">
+ <div className="flex flex-wrap items-center gap-[14px]">
{groups.map((group, idx) => {
const visual = visuals[idx]
return (
<div
key={group.interfaceId}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 5.5,
- font: `500 10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)'
- }}
+ className="flex items-center gap-[5.5px] font-mono text-[10.5px] leading-none font-medium text-[var(--text-secondary)]"
>
<span
- style={{
- width: 7,
- height: 7,
- borderRadius: '50%',
- background: visual.solid,
- flexShrink: 0
- }}
+ className="size-[7px] shrink-0 rounded-full"
+ style={{ background: visual.solid }}
/>
- <span style={{ color: 'var(--text)', fontWeight: 600 }}>{visual.name}</span>
+ <span className="font-semibold text-foreground">{visual.name}</span>
</div>
)
})}
{assembling && (
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 5.5,
- font: `500 10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)'
- }}
- >
- <span
- style={{
- width: 7,
- height: 7,
- borderRadius: '50%',
- background: ASSEMBLED_SOLID,
- flexShrink: 0
- }}
- />
- <span style={{ color: 'var(--text)', fontWeight: 600 }}>Assembled</span>
+ <div className="flex items-center gap-[5.5px] font-mono text-[10.5px] leading-none font-medium text-[var(--text-secondary)]">
+ <span className="size-[7px] shrink-0 rounded-full bg-[var(--text)]" />
+ <span className="font-semibold text-foreground">Assembled</span>
</div>
)}
{cells.length > 0 && chunkBytes > 0 && (
<div
- style={{
- marginLeft: 'auto',
- font: `500 10px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)',
- fontVariantNumeric: 'tabular-nums'
- }}
+ className="ml-auto font-mono text-[10px] leading-none font-medium tabular-nums text-muted-foreground"
title={`This file downloads as ${blocks.length} chunks of ${formatBytes(chunkBytes)}, one per square.${
rows > MAX_VISIBLE_ROWS ? ' Scroll the grid to see the rest.' : ''
}`}
@@ -468,17 +419,7 @@ export function BlockGrid({
// Fallback for single stream / non-splittable download: clean horizontal bar
return (
- <div
- style={{
- height: 10,
- borderRadius: 5,
- background: 'var(--track-bg)',
- overflow: 'hidden',
- display: 'flex',
- gap: 2,
- border: '0.5px solid var(--border-strong)'
- }}
- >
+ <div className="flex h-2.5 gap-0.5 overflow-hidden rounded-[5px] border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)]">
{knownSize ? (
<>
{groups.map((group, index) => (
@@ -493,7 +434,7 @@ export function BlockGrid({
<div style={{ flex: remainingBytes || 0.0001 }} />
</>
) : (
- <div style={{ width: '100%', background: 'var(--color-accent)' }} />
+ <div className="w-full bg-primary" />
)}
</div>
)
diff --git a/src/renderer/src/components/ColorBadge.tsx b/src/renderer/src/components/ColorBadge.tsx
new file mode 100644
index 0000000..904730a
--- /dev/null
+++ b/src/renderer/src/components/ColorBadge.tsx
@@ -0,0 +1,39 @@
+import { cn } from '../lib/utils'
+import { Badge } from './ui/badge'
+
+/** A `Badge` tinted with an arbitrary bg/border/text triple — for the many places a status or
+ * network-kind label needs colors that come from `resolveNetworkVisual`/`KIND_PALETTE` at
+ * runtime rather than from a fixed shadcn variant. The triple travels as CSS custom properties
+ * (not a `style` object with literal color properties) so `className` can still win normal
+ * Tailwind specificity fights, same trick this replaces from NetworkCard. */
+export function ColorBadge({
+ bg,
+ border,
+ text,
+ className,
+ style,
+ ...props
+}: {
+ bg: string
+ border: string
+ text: string
+} & React.ComponentProps<typeof Badge>): React.JSX.Element {
+ return (
+ <Badge
+ variant="outline"
+ style={
+ {
+ ...style,
+ '--badge-bg': bg,
+ '--badge-border': border,
+ '--badge-text': text
+ } as React.CSSProperties
+ }
+ className={cn(
+ 'rounded-[4px] border-[var(--badge-border)] bg-[var(--badge-bg)] text-[var(--badge-text)]',
+ className
+ )}
+ {...props}
+ />
+ )
+}
diff --git a/src/renderer/src/components/CombineDiagram.tsx b/src/renderer/src/components/CombineDiagram.tsx
index eb8a780..b0c8afc 100644
--- a/src/renderer/src/components/CombineDiagram.tsx
+++ b/src/renderer/src/components/CombineDiagram.tsx
@@ -1,4 +1,3 @@
-import { FONT_MONO } from '../theme'
import { formatSpeed } from '../utils/format'
const ROW_HEIGHT = 36
@@ -58,7 +57,8 @@ export function CombineDiagram({
return (
<svg
viewBox={`0 0 ${WIDTH} ${height}`}
- style={{ width: WIDTH, height, display: 'block', flexShrink: 0 }}
+ className="block shrink-0"
+ style={{ width: WIDTH, height }}
>
<g fill="none" strokeWidth={3} strokeLinecap="round">
{networks.map((network, index) => {
@@ -137,7 +137,7 @@ export function CombineDiagram({
y={y - 5.5}
textAnchor="end"
fill={muted ? 'var(--icon-muted)' : 'var(--text-tertiary)'}
- style={{ font: `500 8.5px ${FONT_MONO}`, letterSpacing: '0.08em' }}
+ className="font-mono text-[8.5px] font-medium tracking-[0.08em]"
>
<title>{network.label}</title>
{label}
@@ -148,10 +148,7 @@ export function CombineDiagram({
y={y + 7.5}
textAnchor="end"
fill={hasSpeed ? network.solid : 'var(--text-tertiary)'}
- style={{
- font: `600 11px ${FONT_MONO}`,
- fontVariantNumeric: 'tabular-nums'
- }}
+ className="font-mono text-[11px] font-semibold tabular-nums"
>
{speedText}
</text>
@@ -165,10 +162,7 @@ export function CombineDiagram({
y={midY - 11}
textAnchor="end"
fill={paused ? 'var(--color-usb)' : 'var(--text-tertiary)'}
- style={{
- font: `${paused ? '600' : '500'} 8.5px ${FONT_MONO}`,
- letterSpacing: '0.12em'
- }}
+ className={`font-mono text-[8.5px] tracking-[0.12em] ${paused ? 'font-semibold' : 'font-medium'}`}
>
{paused ? 'PAUSED' : 'COMBINED'}
</text>
diff --git a/src/renderer/src/components/CyclableChip.tsx b/src/renderer/src/components/CyclableChip.tsx
new file mode 100644
index 0000000..4e8065c
--- /dev/null
+++ b/src/renderer/src/components/CyclableChip.tsx
@@ -0,0 +1,38 @@
+/** A small pill that cycles through a set of comparison stats on click (e.g. "1.4x WIFI ALONE"
+ * -> "+40% VS WIFI"), used by CompleteScreen and DownloadingScreen. Shows the ⇄ hint only when
+ * there's actually more than one option to cycle to. */
+export function CyclableChip({
+ label,
+ tooltip,
+ bg,
+ border,
+ color,
+ cyclable,
+ onClick
+}: {
+ label: string
+ tooltip: string
+ bg: string
+ border: string
+ color: string
+ cyclable: boolean
+ onClick: () => void
+}): React.JSX.Element {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ title={tooltip}
+ className="inline-flex w-fit items-center gap-1.5 rounded-[5px] border-[0.5px] px-2.5 py-1 font-mono text-[10.5px] font-semibold whitespace-nowrap select-none"
+ style={{
+ background: bg,
+ borderColor: border,
+ color,
+ cursor: cyclable ? 'pointer' : 'default'
+ }}
+ >
+ <span>{label}</span>
+ {cyclable && <span className="text-[8.5px] opacity-55">⇄</span>}
+ </button>
+ )
+}
diff --git a/src/renderer/src/components/DevToolsPanel.tsx b/src/renderer/src/components/DevToolsPanel.tsx
index deca377..59bd400 100644
--- a/src/renderer/src/components/DevToolsPanel.tsx
+++ b/src/renderer/src/components/DevToolsPanel.tsx
@@ -1,16 +1,9 @@
import type { NetworkInterfaceKind, SimulatedNetworkConfig } from '@shared/types'
import { useEffect, useState } from 'react'
import { useAppStore } from '../store/useAppStore'
-import {
- DANGER,
- FONT_MONO,
- FONT_UI,
- dangerButtonStyle,
- disabledPrimaryButtonStyle,
- primaryButtonStyle,
- secondaryButtonStyle
-} from '../theme'
import { describeError, toDisplayPath } from '../utils/format'
+import { Button } from './ui/button'
+import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group'
const KIND_OPTIONS: NetworkInterfaceKind[] = ['wifi', 'usb', 'ethernet', 'bridge', 'other']
const PRESET_CONNECTIONS = [1, 2, 4, 8] as const
@@ -37,20 +30,14 @@ const DEFAULT_NETWORKS: SimNetworkDraft[] = [
makeDraft('usb', 'Simulated USB', 12)
]
-const fieldLabelStyle: React.CSSProperties = {
- font: `500 9.5px/1 ${FONT_MONO}`,
- letterSpacing: '0.12em',
- color: 'var(--text-tertiary)'
-}
+const fieldLabelClass =
+ 'font-mono text-[9.5px] leading-none font-medium tracking-[0.12em] text-muted-foreground'
-const rowInputStyle: React.CSSProperties = {
- border: '0.5px solid var(--border-strong)',
- borderRadius: 6,
- background: 'var(--input-bg)',
- color: 'var(--text)',
- font: `12px/1.3 ${FONT_MONO}`,
- padding: '5px 7px'
-}
+const rowInputClass =
+ 'rounded-[6px] border-[0.5px] border-[var(--border-strong)] bg-[var(--input-bg)] px-[7px] py-[5px] font-mono text-[12px] leading-[1.3] text-foreground'
+
+const draftBoxClass =
+ 'flex flex-col gap-1.5 rounded-lg border-[0.5px] border-border bg-background p-2'
/**
* Dev-only panel that exercises the whole download pipeline against a file already on disk —
@@ -146,152 +133,80 @@ export function DevToolsPanel(): React.JSX.Element | null {
<>
{open && (
<div
- style={{
- position: 'fixed',
- inset: 0,
- zIndex: 999,
- background: 'rgba(0,0,0,0.35)',
- display: 'flex',
- alignItems: 'flex-end',
- justifyContent: 'flex-start',
- padding: 14
- }}
+ className="fixed inset-0 z-[999] flex items-end justify-start bg-black/35 p-3.5"
onClick={(event) => {
if (event.target === event.currentTarget) setOpen(false)
}}
>
- <div
- style={{
- width: 380,
- maxHeight: 'calc(100% - 60px)',
- overflowY: 'auto',
- background: 'var(--bg-secondary)',
- border: '0.5px solid var(--border-strong)',
- borderRadius: 12,
- padding: 16,
- display: 'flex',
- flexDirection: 'column',
- gap: 12,
- boxShadow: '0 8px 30px rgba(0,0,0,0.4)'
- }}
- >
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between'
- }}
- >
- <div style={{ font: `700 13px/1.2 ${FONT_UI}`, color: 'var(--text)' }}>
+ <div className="flex max-h-[calc(100%-60px)] w-[380px] flex-col gap-3 overflow-y-auto rounded-[12px] border-[0.5px] border-[var(--border-strong)] bg-card p-4 shadow-[0_8px_30px_rgba(0,0,0,0.4)]">
+ <div className="flex items-center justify-between">
+ <div className="font-sans text-[13px] leading-[1.2] font-bold text-foreground">
Simulate a download
</div>
<button
type="button"
onClick={() => setOpen(false)}
- style={{
- border: 'none',
- background: 'none',
- color: 'var(--text-tertiary)',
- cursor: 'pointer',
- font: `600 14px/1 ${FONT_UI}`
- }}
+ aria-label="Close"
+ className="border-none bg-transparent font-sans text-sm leading-none font-semibold text-muted-foreground"
>
×
</button>
</div>
- <div style={{ font: `11.5px/1.4 ${FONT_UI}`, color: 'var(--text-tertiary)' }}>
+ <div className="font-sans text-[11.5px] leading-[1.4] text-muted-foreground">
Pick a file already on disk to &quot;download&quot; it through the real pipeline —
chunking, the block grid, pause/resume, retries, assembling — against fake networks
you control.
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
- <div style={fieldLabelStyle}>SOURCE FILE</div>
- <div style={{ display: 'flex', gap: 6 }}>
+ <div className="flex flex-col gap-[5px]">
+ <div className={fieldLabelClass}>SOURCE FILE</div>
+ <div className="flex gap-1.5">
<div
- style={{
- ...rowInputStyle,
- flex: 1,
- minWidth: 0,
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- color: sourceFilePath ? 'var(--text)' : 'var(--text-tertiary)'
- }}
+ className={`${rowInputClass} min-w-0 flex-1 truncate ${
+ sourceFilePath ? 'text-foreground' : 'text-muted-foreground'
+ }`}
title={sourceFilePath ?? undefined}
>
{sourceFilePath ? toDisplayPath(sourceFilePath, homeDir) : 'No file chosen'}
</div>
- <button type="button" onClick={handleChooseFile} style={secondaryButtonStyle}>
+ <Button type="button" variant="secondary" onClick={handleChooseFile}>
Choose…
- </button>
+ </Button>
</div>
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
- <div style={fieldLabelStyle}>DESTINATION</div>
- <div style={{ display: 'flex', gap: 6 }}>
+ <div className="flex flex-col gap-[5px]">
+ <div className={fieldLabelClass}>DESTINATION</div>
+ <div className="flex gap-1.5">
<div
- style={{
- ...rowInputStyle,
- flex: 1,
- minWidth: 0,
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap'
- }}
+ className={`${rowInputClass} min-w-0 flex-1 truncate`}
title={effectiveDestinationDir}
>
{toDisplayPath(effectiveDestinationDir, homeDir)}
</div>
- <button
- type="button"
- onClick={handleChooseDestination}
- style={secondaryButtonStyle}
- >
+ <Button type="button" variant="secondary" onClick={handleChooseDestination}>
Browse…
- </button>
+ </Button>
</div>
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 7 }}>
- <div
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
- >
- <div style={fieldLabelStyle}>SIMULATED NETWORKS</div>
- <button
+ <div className="flex flex-col gap-[7px]">
+ <div className="flex items-center justify-between">
+ <div className={fieldLabelClass}>SIMULATED NETWORKS</div>
+ <Button
type="button"
+ variant="link"
+ size="xs"
onClick={addNetwork}
disabled={networks.length >= MAX_SIM_NETWORKS}
- style={{
- border: 'none',
- background: 'none',
- color:
- networks.length >= MAX_SIM_NETWORKS
- ? 'var(--text-tertiary)'
- : 'var(--color-accent)',
- font: `600 10.5px/1 ${FONT_MONO}`,
- cursor: networks.length >= MAX_SIM_NETWORKS ? 'not-allowed' : 'pointer'
- }}
>
+ Add network
- </button>
+ </Button>
</div>
{networks.map((network) => (
- <div
- key={network.key}
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: 6,
- padding: 8,
- borderRadius: 8,
- border: '0.5px solid var(--border)',
- background: 'var(--bg)'
- }}
- >
- <div style={{ display: 'flex', gap: 6, alignItems: 'center' }}>
+ <div key={network.key} className={draftBoxClass}>
+ <div className="flex items-center gap-1.5">
<select
value={network.kind}
onChange={(event) =>
@@ -299,7 +214,7 @@ export function DevToolsPanel(): React.JSX.Element | null {
kind: event.target.value as NetworkInterfaceKind
})
}
- style={{ ...rowInputStyle, flexShrink: 0 }}
+ className={`${rowInputClass} shrink-0`}
>
{KIND_OPTIONS.map((kind) => (
<option key={kind} value={kind}>
@@ -313,36 +228,23 @@ export function DevToolsPanel(): React.JSX.Element | null {
onChange={(event) =>
updateNetwork(network.key, { label: event.target.value })
}
- style={{ ...rowInputStyle, flex: 1, minWidth: 0 }}
+ className={`${rowInputClass} min-w-0 flex-1`}
/>
- <button
+ <Button
type="button"
+ variant="ghost"
+ size="icon-xs"
onClick={() => removeNetwork(network.key)}
disabled={networks.length <= 1}
title="Remove network"
- style={{
- border: 'none',
- background: 'none',
- color: networks.length <= 1 ? 'var(--text-tertiary)' : DANGER,
- cursor: networks.length <= 1 ? 'not-allowed' : 'pointer',
- font: `600 13px/1 ${FONT_UI}`,
- flexShrink: 0
- }}
+ aria-label="Remove network"
+ className="text-destructive hover:text-destructive"
>
×
- </button>
+ </Button>
</div>
- <div style={{ display: 'flex', gap: 10 }}>
- <label
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 5,
- flex: 1,
- font: `10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)'
- }}
- >
+ <div className="flex gap-2.5">
+ <label className="flex flex-1 items-center gap-[5px] font-mono text-[10.5px] leading-none text-muted-foreground">
Speed
<input
type="number"
@@ -354,19 +256,12 @@ export function DevToolsPanel(): React.JSX.Element | null {
speedMbps: Number(event.target.value) || 1
})
}
- style={{ ...rowInputStyle, width: 56 }}
+ className={`${rowInputClass} w-14`}
/>
Mbps
</label>
<label
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 5,
- flex: 1,
- font: `10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)'
- }}
+ className="flex flex-1 items-center gap-[5px] font-mono text-[10.5px] leading-none text-muted-foreground"
title="Chance a chunk attempt on this network fails outright, to exercise retry/error handling"
>
Faults
@@ -380,7 +275,7 @@ export function DevToolsPanel(): React.JSX.Element | null {
faultRatePercent: Number(event.target.value) || 0
})
}
- style={{ ...rowInputStyle, width: 48 }}
+ className={`${rowInputClass} w-12`}
/>
%
</label>
@@ -389,56 +284,35 @@ export function DevToolsPanel(): React.JSX.Element | null {
))}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
- <div style={fieldLabelStyle}>CONNECTIONS PER NETWORK</div>
- <div style={{ display: 'flex', gap: 4 }}>
- {PRESET_CONNECTIONS.map((preset) => {
- const isSelected = connectionsPerNetwork === preset
- return (
- <button
- key={preset}
- type="button"
- onClick={() => setConnectionsPerNetwork(preset)}
- style={{
- border: isSelected
- ? '0.5px solid var(--color-accent)'
- : '0.5px solid var(--border)',
- borderRadius: 5,
- background: isSelected ? 'var(--color-usb-bg)' : 'var(--track-bg)',
- color: isSelected ? 'var(--color-usb-text)' : 'var(--text-secondary)',
- font: `600 10.5px/1 ${FONT_MONO}`,
- padding: '4px 8px',
- cursor: 'pointer'
- }}
- >
- {preset}×
- </button>
- )
- })}
+ <div className="flex flex-col gap-[5px]">
+ <div id="devtools-connections-label" className={fieldLabelClass}>
+ CONNECTIONS PER NETWORK
</div>
- </div>
-
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: 6,
- padding: 8,
- borderRadius: 8,
- border: '0.5px solid var(--border)',
- background: 'var(--bg)'
- }}
- >
- <label
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 7,
- font: `11px/1.3 ${FONT_UI}`,
- color: 'var(--text)',
- cursor: 'pointer'
+ <ToggleGroup
+ value={[String(connectionsPerNetwork)]}
+ onValueChange={(values) => {
+ if (values.length === 0) return
+ setConnectionsPerNetwork(Number(values[0]))
}}
+ aria-labelledby="devtools-connections-label"
+ variant="default"
+ spacing={1}
>
+ {PRESET_CONNECTIONS.map((preset) => (
+ <ToggleGroupItem
+ key={preset}
+ value={String(preset)}
+ size="sm"
+ className="h-5 border border-border bg-muted px-1.5 font-mono text-[10px] font-semibold text-[var(--text-secondary)] aria-pressed:!border-primary aria-pressed:!bg-primary aria-pressed:!text-primary-foreground"
+ >
+ {preset}×
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
+ </div>
+
+ <div className={draftBoxClass}>
+ <label className="flex cursor-pointer items-center gap-[7px] font-sans text-[11px] leading-[1.3] text-foreground">
<input
type="checkbox"
checked={slowAssemble}
@@ -446,21 +320,13 @@ export function DevToolsPanel(): React.JSX.Element | null {
/>
Simulate the assembling step
</label>
- <div style={{ font: `10.5px/1.4 ${FONT_UI}`, color: 'var(--text-tertiary)' }}>
+ <div className="font-sans text-[10.5px] leading-[1.4] text-muted-foreground">
Reassembly normally finishes in a blink — this throttles it so the
&quot;assembling&quot; screen (the block grid sweep, the pulsing combine line) stays
on screen long enough to actually watch.
</div>
{slowAssemble && (
- <label
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 5,
- font: `10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)'
- }}
- >
+ <label className="flex items-center gap-[5px] font-mono text-[10.5px] leading-none text-muted-foreground">
Assemble speed
<input
type="number"
@@ -468,27 +334,26 @@ export function DevToolsPanel(): React.JSX.Element | null {
max={500}
value={assembleSpeedMBps}
onChange={(event) => setAssembleSpeedMBps(Number(event.target.value) || 1)}
- style={{ ...rowInputStyle, width: 56 }}
+ className={`${rowInputClass} w-14`}
/>
MB/s
</label>
)}
</div>
- {error && <div style={{ font: `11.5px/1.4 ${FONT_UI}`, color: DANGER }}>⚠ {error}</div>}
+ {error && (
+ <div className="font-sans text-[11.5px] leading-[1.4] text-destructive">
+ ⚠ {error}
+ </div>
+ )}
- <div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end' }}>
- <button type="button" onClick={() => setOpen(false)} style={dangerButtonStyle}>
+ <div className="flex justify-end gap-2">
+ <Button type="button" variant="destructive" onClick={() => setOpen(false)}>
Cancel
- </button>
- <button
- type="button"
- onClick={handleStart}
- disabled={!canStart}
- style={canStart ? primaryButtonStyle : disabledPrimaryButtonStyle}
- >
+ </Button>
+ <Button type="button" onClick={handleStart} disabled={!canStart}>
{starting ? 'Starting…' : 'Start simulated download'}
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/src/renderer/src/components/KindBadge.tsx b/src/renderer/src/components/KindBadge.tsx
deleted file mode 100644
index 50d85df..0000000
--- a/src/renderer/src/components/KindBadge.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { NetworkInterfaceKind } from '@shared/types'
-import { FONT_MONO, KIND_PALETTE } from '../theme'
-
-export function KindBadge({ kind }: { kind: NetworkInterfaceKind }): React.JSX.Element {
- const palette = KIND_PALETTE[kind]
- return (
- <div
- style={{
- width: 38,
- textAlign: 'center',
- borderRadius: 4,
- background: palette.bg,
- color: palette.text,
- font: `600 9.5px/1 ${FONT_MONO}`,
- letterSpacing: '0.04em',
- padding: '4px 0',
- flexShrink: 0
- }}
- >
- {palette.label}
- </div>
- )
-}
diff --git a/src/renderer/src/components/NetworkCard.tsx b/src/renderer/src/components/NetworkCard.tsx
index cb05f81..c01058e 100644
--- a/src/renderer/src/components/NetworkCard.tsx
+++ b/src/renderer/src/components/NetworkCard.tsx
@@ -1,9 +1,9 @@
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 { resolveNetworkVisual, type NetworkColorId } from '../theme'
+import { ColorBadge } from './ColorBadge'
import { NetworkEditorFields } from './NetworkEditorFields'
-import { Badge } from './ui/badge'
import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'
@@ -26,36 +26,15 @@ function Checkbox({
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
- }}
+ className="flex size-[15px] shrink-0 items-center justify-center rounded-[4px] font-sans text-[9px] leading-none font-bold shadow-[inset_0_0_0_0.5px_var(--checkbox-shadow)]"
+ style={{ background: color, color: onColor }}
>
✓
</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
- }}
- />
+ <div className="size-[15px] shrink-0 rounded-[4px] border-[0.5px] border-[var(--icon-muted-strong)] bg-[var(--input-bg)] shadow-[inset_0_1px_1px_var(--checkbox-inset-shadow)]" />
)
}
@@ -73,45 +52,23 @@ export function NetworkCard({
return (
<div
+ className="flex flex-col gap-[11px] rounded-[11px] border-[0.5px] p-[15px]"
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
+ borderColor: selected ? visual.border : 'var(--border)'
}}
>
- <div style={{ display: 'flex', alignItems: 'center', gap: 9 }}>
+ <div className="flex items-center gap-[9px]">
<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'
- }}
+ className="flex min-w-0 flex-1 items-center gap-[9px] border-none bg-transparent p-0 text-left [font:inherit] text-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
- }}
+ className={`min-w-0 truncate font-sans text-[13px] leading-none font-semibold ${
+ selected ? 'text-foreground' : 'text-[var(--text-secondary)]'
+ }`}
>
{visual.name}
</div>
@@ -124,15 +81,8 @@ export function NetworkCard({
render={
<button
type="button"
- style={{
- border: 'none',
- background: 'none',
- color: 'var(--text-tertiary)',
- font: `700 12px/1 ${FONT_UI}`,
- cursor: 'pointer',
- padding: '2px 4px',
- flexShrink: 0
- }}
+ aria-label="Rename or recolor this network"
+ className="shrink-0 border-none bg-transparent px-1 py-0.5 font-sans text-xs font-bold text-muted-foreground"
>
⋯
</button>
@@ -154,59 +104,34 @@ export function NetworkCard({
/>
</PopoverContent>
</Popover>
- <Badge
- variant="outline"
- style={
- {
- '--badge-bg': selected ? visual.bg : 'transparent',
- '--badge-border': selected ? visual.border : 'var(--border)',
- '--badge-text': selected ? visual.text : 'var(--text-tertiary)'
- } as React.CSSProperties
- }
- className="rounded-[4px] border-[var(--badge-border)] bg-[var(--badge-bg)] font-mono text-[10px] tracking-[0.1em] text-[var(--badge-text)]"
+ <ColorBadge
+ bg={selected ? visual.bg : 'transparent'}
+ border={selected ? visual.border : 'var(--border)'}
+ text={selected ? visual.text : 'var(--text-tertiary)'}
+ className="font-mono text-[10px] tracking-[0.1em]"
>
{visual.label}
- </Badge>
+ </ColorBadge>
</div>
- <div
- style={{
- font: `10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)',
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis'
- }}
- >
+ <div className="truncate font-mono text-[10.5px] leading-none text-muted-foreground">
{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)'
- }}
- >
+ <div className="flex items-end justify-between">
+ <div className="flex flex-col gap-[5px]">
+ <div className="font-mono text-[9px] leading-none font-medium tracking-[0.12em] text-muted-foreground">
PING
</div>
<div
- style={{
- font: `500 13px/1 ${FONT_MONO}`,
- color: online && selected ? visual.text : 'var(--text-secondary)'
- }}
+ className="font-mono text-[13px] leading-none font-medium"
+ style={{ 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
- }}
+ className={`size-[7px] shrink-0 rounded-full ${
+ online ? 'bg-[var(--color-success)]' : 'bg-[var(--icon-muted)]'
+ }`}
/>
</div>
</div>
diff --git a/src/renderer/src/components/NetworkEditorFields.tsx b/src/renderer/src/components/NetworkEditorFields.tsx
index db8d147..5d64353 100644
--- a/src/renderer/src/components/NetworkEditorFields.tsx
+++ b/src/renderer/src/components/NetworkEditorFields.tsx
@@ -1,12 +1,7 @@
import type { NetworkInterfaceKind } from '@shared/types'
import { useRef } from 'react'
-import {
- FONT_MONO,
- FONT_UI,
- NETWORK_COLOR_SWATCHES,
- resolveNetworkVisual,
- type NetworkColorId
-} from '../theme'
+import { NETWORK_COLOR_SWATCHES, resolveNetworkVisual, type NetworkColorId } from '../theme'
+import { Button } from './ui/button'
export interface NetworkEditorFieldsProps {
name: string
@@ -18,6 +13,9 @@ export interface NetworkEditorFieldsProps {
onDone: () => void
}
+const fieldLabelClass =
+ 'font-mono text-[9px] leading-none font-medium tracking-[0.12em] text-muted-foreground uppercase'
+
/** Rename + recolor fields for a physical network, rendered inside a shadcn `PopoverContent` (see
* NetworkCard) — real-time preview and keyboard support, positioning/portal/dismissal all handled
* by the Popover primitive rather than by hand here. */
@@ -38,29 +36,13 @@ export function NetworkEditorFields({
})
return (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 11 }}>
- <div
- style={{
- font: `600 9.5px/1 ${FONT_MONO}`,
- letterSpacing: '0.14em',
- color: 'var(--text-tertiary)',
- textTransform: 'uppercase'
- }}
- >
+ <div className="flex flex-col gap-[11px]">
+ <div className="font-mono text-[9.5px] leading-none font-semibold tracking-[0.14em] text-muted-foreground uppercase">
Edit Network
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
- <label
- style={{
- font: `500 9px/1 ${FONT_MONO}`,
- letterSpacing: '0.12em',
- color: 'var(--text-tertiary)',
- textTransform: 'uppercase'
- }}
- >
- Display Name
- </label>
+ <div className="flex flex-col gap-[5px]">
+ <label className={fieldLabelClass}>Display Name</label>
<input
ref={inputRef}
type="text"
@@ -71,67 +53,33 @@ export function NetworkEditorFields({
}}
placeholder={namePlaceholder}
autoFocus
- style={{
- border: '0.5px solid var(--border-strong)',
- borderRadius: 6,
- background: 'var(--bg)',
- outline: 'none',
- padding: '6px 9px',
- font: `500 12px/1.3 ${FONT_UI}`,
- color: 'var(--text)'
- }}
+ className="rounded-[6px] border border-input bg-background px-[9px] py-1.5 font-sans text-[12px] leading-[1.3] font-medium text-foreground outline-none"
/>
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
- <span
- style={{
- font: `500 9px/1 ${FONT_MONO}`,
- letterSpacing: '0.12em',
- color: 'var(--text-tertiary)',
- textTransform: 'uppercase'
- }}
- >
- Color
- </span>
+ <div className="flex flex-col gap-[6px]">
+ <div className="flex items-center justify-between">
+ <span className={fieldLabelClass}>Color</span>
{colorId && (
<button
type="button"
onClick={() => onColorSelect(undefined)}
- style={{
- border: 'none',
- background: 'none',
- color: 'var(--color-accent)',
- font: `500 9.5px/1 ${FONT_MONO}`,
- cursor: 'pointer',
- padding: 0
- }}
+ className="border-none bg-transparent p-0 font-mono text-[9.5px] leading-none font-medium text-primary"
>
Reset to default
</button>
)}
</div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 7, padding: '2px 0' }}>
+ <div className="flex items-center gap-[7px] py-0.5">
<button
type="button"
onClick={() => onColorSelect(undefined)}
title="Default color for this network kind"
- style={{
- width: 19,
- height: 19,
- borderRadius: '50%',
- border: !colorId ? '2px solid var(--text)' : '1px solid var(--border-strong)',
- background: 'var(--bg)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- cursor: 'pointer',
- padding: 0,
- flexShrink: 0
- }}
+ className={`flex size-[19px] shrink-0 items-center justify-center rounded-full bg-background p-0 ${
+ !colorId ? 'border-2 border-foreground' : 'border border-input'
+ }`}
>
- <span style={{ fontSize: 9, color: 'var(--text-tertiary)', lineHeight: 1 }}>✕</span>
+ <span className="text-[9px] leading-none text-muted-foreground">✕</span>
</button>
{NETWORK_COLOR_SWATCHES.map((swatch) => {
const isSelected = colorId === swatch.id
@@ -141,71 +89,32 @@ export function NetworkEditorFields({
type="button"
onClick={() => onColorSelect(swatch.id)}
title={swatch.label}
- style={{
- width: 19,
- height: 19,
- borderRadius: '50%',
- border: isSelected ? '2px solid var(--text)' : '1px solid transparent',
- background: swatch.solid,
- cursor: 'pointer',
- padding: 0,
- flexShrink: 0,
- transform: isSelected ? 'scale(1.1)' : 'scale(1)'
- }}
+ className={`size-[19px] shrink-0 rounded-full p-0 ${
+ isSelected ? 'scale-110 border-2 border-foreground' : 'border border-transparent'
+ }`}
+ style={{ background: swatch.solid }}
/>
)
})}
</div>
</div>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- paddingTop: 8,
- borderTop: '0.5px solid var(--border)',
- marginTop: 2
- }}
- >
- <div style={{ display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 }}>
+ <div className="mt-0.5 flex items-center justify-between border-t-[0.5px] border-border pt-2">
+ <div className="flex min-w-0 items-center gap-[6px]">
<div
- style={{
- width: 7,
- height: 7,
- borderRadius: '50%',
- background: previewVisual.solid,
- flexShrink: 0
- }}
+ className="size-[7px] shrink-0 rounded-full"
+ style={{ background: previewVisual.solid }}
/>
<span
- style={{
- font: `600 11px/1 ${FONT_UI}`,
- color: previewVisual.text,
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- maxWidth: 155
- }}
+ className="max-w-[155px] truncate font-sans text-[11px] leading-none font-semibold"
+ style={{ color: previewVisual.text }}
>
{previewVisual.name}
</span>
</div>
- <button
- type="button"
- onClick={onDone}
- style={{
- border: 'none',
- borderRadius: 6,
- background: 'var(--color-accent)',
- color: 'var(--color-accent-onsolid)',
- font: `600 11px/1 ${FONT_UI}`,
- padding: '5px 13px',
- cursor: 'pointer'
- }}
- >
+ <Button type="button" size="xs" onClick={onDone}>
Done
- </button>
+ </Button>
</div>
</div>
)
diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsx
index bebc8ba..b82247a 100644
--- a/src/renderer/src/components/NetworkRow.tsx
+++ b/src/renderer/src/components/NetworkRow.tsx
@@ -3,14 +3,13 @@ import { useAppStore } from '../store/useAppStore'
import type { BlockState } from '@shared/types'
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 { ColorBadge } from './ColorBadge'
import { NetworkEditorFields } from './NetworkEditorFields'
import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'
@@ -45,38 +44,20 @@ export function NetworkRow({
return (
// A subgrid, not its own independent grid — it inherits the exact column tracks the parent
- // (networkTableGridStyle in DownloadingScreen) computed for the header and every other row,
- // rather than recomputing its own from the same column list and hoping they match.
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: 'subgrid',
- gridColumn: '1 / -1',
- gap: 12,
- alignItems: 'center',
- padding: '11px 0',
- borderTop: '0.5px solid var(--border-subtle)'
- }}
- >
+ // grid (DownloadingScreen's networks table, using the same NETWORK_ROW_GRID_COLUMNS) computed
+ // for the header and every other row, rather than recomputing its own and hoping they match.
+ <div className="col-span-full grid grid-cols-subgrid items-center gap-3 border-t-[0.5px] border-[var(--border-subtle)] py-[11px]">
<div
+ className="size-2 rounded-full"
style={{
- width: 8,
- height: 8,
- borderRadius: '50%',
background: hasError ? DANGER : visual.solid,
animation: isActive ? 'plexo-glow 1.8s infinite' : undefined,
opacity: isActive || hasError ? 1 : 0.65
}}
/>
- <div style={{ minWidth: 0, display: 'flex', alignItems: 'center', gap: 6 }}>
+ <div className="flex min-w-0 items-center gap-[6px]">
<span
- style={{
- font: `600 12.5px/1.2 ${FONT_UI}`,
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- color: 'var(--text)'
- }}
+ className="truncate font-sans text-[12.5px] leading-[1.2] font-semibold text-foreground"
title={visual.name}
>
{visual.name}
@@ -85,24 +66,12 @@ export function NetworkRow({
type="button"
onClick={() => setExpanded((v) => !v)}
title={expanded ? 'Collapse streams' : 'Expand streams'}
- style={{
- display: 'inline-flex',
- alignItems: 'center',
- gap: 3,
- padding: '2px 6px',
- borderRadius: 4,
- background: expanded ? 'var(--bg-tertiary)' : 'var(--bg-secondary)',
- border: '0.5px solid var(--border)',
- font: `500 10px/1 ${FONT_MONO}`,
- color: expanded ? 'var(--text)' : 'var(--text-secondary)',
- cursor: 'pointer',
- flexShrink: 0,
- userSelect: 'none',
- lineHeight: 1
- }}
+ className={`inline-flex shrink-0 cursor-pointer items-center gap-[3px] rounded-[4px] border-[0.5px] border-border px-1.5 py-0.5 font-mono text-[10px] leading-none font-medium select-none ${
+ expanded ? 'bg-secondary text-foreground' : 'bg-card text-[var(--text-secondary)]'
+ }`}
>
<span>{group.chunks.length} streams</span>
- <span style={{ fontSize: 7.5, opacity: 0.75 }}>{expanded ? '▲' : '▼'}</span>
+ <span className="text-[7.5px] opacity-75">{expanded ? '▲' : '▼'}</span>
</button>
<Popover open={editing} onOpenChange={setEditing}>
<PopoverTrigger
@@ -110,15 +79,8 @@ export function NetworkRow({
<button
type="button"
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
- }}
+ aria-label="Rename or recolor this network"
+ className="shrink-0 border-none bg-transparent px-1 py-0.5 font-sans text-xs font-bold text-muted-foreground"
>
⋯
</button>
@@ -137,74 +99,37 @@ export function NetworkRow({
</PopoverContent>
</Popover>
</div>
- <div style={{ display: 'flex', alignItems: 'center', minWidth: 0 }}>
- <div
- style={{
- flex: 1,
- height: 6,
- borderRadius: 999,
- background: 'var(--track-bg)',
- border: '0.5px solid var(--border-strong)',
- overflow: 'hidden'
- }}
- >
+ <div className="flex min-w-0 items-center">
+ <div className="h-1.5 flex-1 overflow-hidden rounded-full border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)]">
<div
+ className="h-full rounded-full transition-[width] duration-[250ms] ease-out"
style={{
- height: '100%',
width:
totalBytes && totalBytes > 0
? `${Math.min(100, Math.max(0, (group.bytesDownloaded / totalBytes) * 100))}%`
: '0%',
- background: visual.solid,
- borderRadius: 999,
- transition: 'width 0.25s ease-out'
+ background: visual.solid
}}
/>
</div>
</div>
<div
- style={{
- textAlign: 'right',
- font: `500 11.5px/1 ${FONT_MONO}`,
- color: sharePercent > 0 ? 'var(--text)' : 'var(--text-tertiary)',
- fontVariantNumeric: 'tabular-nums'
- }}
+ className="text-right font-mono text-[11.5px] leading-none font-medium tabular-nums"
+ style={{ color: sharePercent > 0 ? 'var(--text)' : 'var(--text-tertiary)' }}
>
{groupShareDisplay}
</div>
<div
- style={{
- textAlign: 'right',
- font: `600 12.5px/1 ${FONT_MONO}`,
- color: isActive ? visual.text : 'var(--text-tertiary)',
- fontVariantNumeric: 'tabular-nums'
- }}
+ className="text-right font-mono text-[12.5px] leading-none font-semibold tabular-nums"
+ style={{ color: isActive ? visual.text : 'var(--text-tertiary)' }}
>
{isActive ? formatSpeed(group.speedBytesPerSec) : '—'}
</div>
- <div
- style={{
- textAlign: 'right',
- font: `11.5px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)',
- fontVariantNumeric: 'tabular-nums'
- }}
- >
+ <div className="text-right font-mono text-[11.5px] leading-none text-[var(--text-secondary)] tabular-nums">
{formatBytes(group.bytesDownloaded)}
</div>
{expanded && group.chunks.length > 0 && (
- <div
- style={{
- gridColumn: '1 / -1',
- padding: '6px 20px 10px',
- display: 'flex',
- flexDirection: 'column',
- gap: 6,
- background: 'var(--bg-secondary)',
- borderTop: '0.5px solid var(--border-subtle)',
- borderBottom: '0.5px solid var(--border-subtle)'
- }}
- >
+ <div className="col-span-full flex flex-col gap-1.5 border-y-[0.5px] border-[var(--border-subtle)] bg-card px-5 pt-1.5 pb-2.5">
{group.chunks.map((chunk, index) => {
const isChunkActive = chunk.status === 'downloading'
const isChunkDone = chunk.status === 'completed'
@@ -246,21 +171,13 @@ export function NetworkRow({
return (
<div
key={chunk.id}
- style={{
- display: 'grid',
- gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS,
- gap: 12,
- alignItems: 'center',
- padding: '3px 0',
- font: `11px/1.2 ${FONT_MONO}`
- }}
+ className="grid items-center gap-3 py-[3px] font-mono text-[11px] leading-[1.2]"
+ style={{ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS }}
>
- <div style={{ display: 'flex', justifyContent: 'center' }}>
+ <div className="flex justify-center">
<div
+ className="size-[5px] rounded-full"
style={{
- width: 5,
- height: 5,
- borderRadius: '50%',
background: isChunkError
? DANGER
: isCurrentBlockDone
@@ -273,96 +190,41 @@ export function NetworkRow({
/>
</div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 }}>
- <span
- style={{
- color: 'var(--text)',
- fontWeight: 500,
- whiteSpace: 'nowrap'
- }}
- >
+ <div className="flex min-w-0 items-center gap-[6px]">
+ <span className="font-medium whitespace-nowrap text-foreground">
Stream #{index + 1}
</span>
{currentBlock && (
<span
- style={{
- font: `500 9px/1 ${FONT_MONO}`,
- color: 'var(--text-tertiary)',
- background: 'var(--bg-tertiary)',
- padding: '1.5px 4.5px',
- borderRadius: 3,
- border: '0.5px solid var(--border)',
- whiteSpace: 'nowrap'
- }}
+ className="rounded-[3px] border-[0.5px] border-border bg-secondary px-[4.5px] py-[1.5px] font-mono text-[9px] leading-none whitespace-nowrap text-muted-foreground"
title={`Range: ${currentBlock.rangeStart} – ${currentBlock.rangeEnd ?? 'end'}`}
>
Chunk #{currentBlock.index + 1}
</span>
)}
{isChunkActive ? (
- <span
- style={{
- padding: '1px 5px',
- borderRadius: 3,
- background: visual.bg,
- border: `0.5px solid ${visual.border}`,
- color: visual.text,
- fontSize: '9px',
- fontWeight: 600,
- letterSpacing: '0.04em'
- }}
+ <ColorBadge
+ bg={visual.bg}
+ border={visual.border}
+ text={visual.text}
+ className="h-auto rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em]"
>
ACTIVE
- </span>
+ </ColorBadge>
) : isCurrentBlockDone ? (
- <span
- style={{
- color: 'var(--text-tertiary)',
- fontSize: '9.5px'
- }}
- >
- Done
- </span>
+ <span className="text-[9.5px] text-muted-foreground">Done</span>
) : chunk.status === 'paused' ? (
- <span
- style={{
- color: 'var(--text-tertiary)',
- fontSize: '9.5px'
- }}
- >
- Paused
- </span>
+ <span className="text-[9.5px] text-muted-foreground">Paused</span>
) : chunk.status === 'retrying' ? (
- <span
- style={{
- color: DANGER,
- fontSize: '9.5px'
- }}
- >
- Retrying…
- </span>
+ <span className="text-[9.5px] text-destructive">Retrying…</span>
) : (
- <span
- style={{
- color: 'var(--text-tertiary)',
- fontSize: '9.5px'
- }}
- >
- Waiting
- </span>
+ <span className="text-[9.5px] text-muted-foreground">Waiting</span>
)}
</div>
- <div style={{ display: 'flex', alignItems: 'center', minWidth: 0 }}>
+ <div className="flex min-w-0 items-center">
<div
- style={{
- flex: 1,
- height: 5,
- borderRadius: 999,
- background: 'var(--track-bg)',
- border: '0.5px solid var(--border-strong)',
- overflow: 'hidden'
- }}
+ className="h-[5px] flex-1 overflow-hidden rounded-full border-[0.5px] border-[var(--border-strong)] bg-[var(--track-bg)]"
title={
chunkSize > 0
? `Chunk progress: ${formatBytes(chunkBytesDownloaded)} of ${formatBytes(chunkSize)} (${Math.round(chunkPercent)}%)`
@@ -370,51 +232,37 @@ export function NetworkRow({
}
>
<div
+ className="h-full rounded-full transition-[width] duration-200 ease-out"
style={{
- height: '100%',
width: isCurrentBlockDone ? '100%' : `${chunkPercent}%`,
- background: isChunkError ? DANGER : visual.solid,
- borderRadius: 999,
- transition: 'width 0.2s ease-out'
+ background: isChunkError ? DANGER : visual.solid
}}
/>
</div>
</div>
<div
+ className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"
style={{
- textAlign: 'right',
- font: `500 11px/1 ${FONT_MONO}`,
color: isCurrentBlockDone
? visual.text
: isChunkActive
? 'var(--text)'
- : 'var(--text-tertiary)',
- fontVariantNumeric: 'tabular-nums'
+ : 'var(--text-tertiary)'
}}
>
{Math.round(chunkPercent)}%
</div>
<div
- style={{
- textAlign: 'right',
- font: `500 11px/1 ${FONT_MONO}`,
- color: isChunkActive ? visual.text : 'var(--text-tertiary)',
- fontVariantNumeric: 'tabular-nums'
- }}
+ className="text-right font-mono text-[11px] leading-none font-medium tabular-nums"
+ style={{ color: isChunkActive ? visual.text : 'var(--text-tertiary)' }}
>
{isChunkActive ? formatSpeed(chunk.speedBytesPerSec) : '—'}
</div>
<div
- style={{
- textAlign: 'right',
- font: `11px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)',
- fontVariantNumeric: 'tabular-nums',
- whiteSpace: 'nowrap'
- }}
+ className="text-right font-mono text-[11px] leading-none whitespace-nowrap text-[var(--text-secondary)] tabular-nums"
title={
chunkSize > 0
? `${formatBytes(chunkBytesDownloaded)} of ${formatBytes(chunkSize)}`
diff --git a/src/renderer/src/components/ThemeToggle.tsx b/src/renderer/src/components/ThemeToggle.tsx
index 8f02c75..2ed221e 100644
--- a/src/renderer/src/components/ThemeToggle.tsx
+++ b/src/renderer/src/components/ThemeToggle.tsx
@@ -73,20 +73,7 @@ export function ThemeToggle(): React.JSX.Element {
type="button"
title={`${current.label} — click to change`}
onClick={cycle}
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- width: 26,
- height: 26,
- border: '0.5px solid var(--border)',
- borderRadius: 6,
- background: 'var(--bg-tertiary)',
- color: 'var(--text-secondary)',
- cursor: 'pointer',
- WebkitAppRegion: 'no-drag',
- flexShrink: 0
- }}
+ className="flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-[6px] border-[0.5px] border-border bg-secondary text-[var(--text-secondary)] [-webkit-app-region:no-drag]"
>
{current.icon}
</button>
diff --git a/src/renderer/src/components/ThroughputChart.tsx b/src/renderer/src/components/ThroughputChart.tsx
index 834393a..c782543 100644
--- a/src/renderer/src/components/ThroughputChart.tsx
+++ b/src/renderer/src/components/ThroughputChart.tsx
@@ -50,7 +50,7 @@ export function ThroughputChart({
<svg
viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
preserveAspectRatio="none"
- style={{ width: '100%', height: 104, display: 'block', marginTop: 7 }}
+ className="mt-[7px] block h-[104px] w-full"
>
<g stroke="var(--border)" strokeWidth={1}>
<line x1={0} y1={HEIGHT * 0.33} x2={WIDTH} y2={HEIGHT * 0.33} />
diff --git a/src/renderer/src/components/TitleBar.tsx b/src/renderer/src/components/TitleBar.tsx
index 00ae6f9..5a9cd1c 100644
--- a/src/renderer/src/components/TitleBar.tsx
+++ b/src/renderer/src/components/TitleBar.tsx
@@ -1,4 +1,4 @@
-import { FONT_UI, TITLE_BAR_HEIGHT, pillStyle } from '../theme'
+import { ColorBadge } from './ColorBadge'
import { ThemeToggle } from './ThemeToggle'
export type TitleBarStatus =
@@ -10,84 +10,77 @@ export type TitleBarStatus =
const isMac = window.plexo.platform === 'darwin'
+const pillClass =
+ 'h-auto flex items-center gap-[7px] rounded-full px-2.5 py-1 font-mono text-[10px] leading-none font-semibold tracking-[0.08em] uppercase whitespace-nowrap'
+const pillDotClass = 'size-1.5 shrink-0 rounded-full'
+
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,
+ className={`flex h-11 shrink-0 items-center gap-[13px] border-b-[0.5px] border-border bg-card pr-3.5 [-webkit-app-region:drag] ${
// 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'
- }}
+ isMac ? 'pl-[94px]' : 'pl-3.5'
+ }`}
>
<div
- style={{
- // Matches the "LOCKUP · horizontal" wordmark spec from the final icon design.
- font: `700 13px/1 ${FONT_UI}`,
- letterSpacing: '-0.02em',
- color: dimmed ? 'var(--text-tertiary)' : 'var(--text)'
- }}
+ // Matches the "LOCKUP · horizontal" wordmark spec from the final icon design.
+ className={`font-sans text-[13px] leading-none font-bold tracking-[-0.02em] ${
+ dimmed ? 'text-muted-foreground' : 'text-foreground'
+ }`}
>
Plexo
</div>
- <div style={{ flex: 1 }} />
+ <div className="flex-1" />
{status.kind === 'combined' && (
- <div style={pillStyle('positive')}>
+ <ColorBadge
+ bg="var(--color-wifi-bg)"
+ border="var(--color-wifi-border)"
+ text="var(--color-wifi-text)"
+ className={pillClass}
+ >
<div
- style={{
- width: 6,
- height: 6,
- borderRadius: '50%',
- background: 'var(--color-wifi)',
- animation: 'plexo-glow 2s ease-in-out infinite'
- }}
+ className={`${pillDotClass} bg-[var(--color-wifi)] animate-[plexo-glow_2s_ease-in-out_infinite]`}
/>
{status.networkCount} {status.networkCount === 1 ? 'network' : 'networks'} combined
- </div>
+ </ColorBadge>
)}
{status.kind === 'assembling' && (
- <div style={pillStyle('assembling')}>
+ <ColorBadge
+ bg="var(--color-ethernet-bg)"
+ border="var(--color-ethernet-border)"
+ text="var(--color-ethernet-text)"
+ className={pillClass}
+ >
<div
- style={{
- width: 6,
- height: 6,
- borderRadius: '50%',
- background: 'var(--color-ethernet)',
- animation: 'plexo-glow 1s ease-in-out infinite'
- }}
+ className={`${pillDotClass} bg-[var(--color-ethernet)] animate-[plexo-glow_1s_ease-in-out_infinite]`}
/>
Assembling file…
- </div>
+ </ColorBadge>
)}
{status.kind === 'paused' && (
- <div style={pillStyle('paused')}>
- <div
- style={{
- width: 6,
- height: 6,
- borderRadius: '50%',
- background: 'var(--color-usb)'
- }}
- />
+ <ColorBadge
+ bg="var(--color-usb-bg)"
+ border="var(--color-usb-border)"
+ text="var(--color-usb-text)"
+ className={pillClass}
+ >
+ <div className={`${pillDotClass} bg-[var(--color-usb)]`} />
{status.networkCount} {status.networkCount === 1 ? 'network' : 'networks'} · Paused
- </div>
+ </ColorBadge>
)}
{status.kind === 'offline' && (
- <div style={pillStyle('negative')}>
- <div
- style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--color-danger)' }}
- />
+ <ColorBadge
+ bg="var(--color-danger-bg)"
+ border="var(--color-danger-border)"
+ text="var(--color-danger)"
+ className={pillClass}
+ >
+ <div className={`${pillDotClass} bg-[var(--color-danger)]`} />
Offline
- </div>
+ </ColorBadge>
)}
<ThemeToggle />
</div>
diff --git a/src/renderer/src/screens/CompleteScreen.tsx b/src/renderer/src/screens/CompleteScreen.tsx
index 619d586..74b8368 100644
--- a/src/renderer/src/screens/CompleteScreen.tsx
+++ b/src/renderer/src/screens/CompleteScreen.tsx
@@ -1,21 +1,10 @@
import { useState } from 'react'
import type { DownloadState } from '@shared/types'
+import { CyclableChip } from '../components/CyclableChip'
import { ThroughputChart } from '../components/ThroughputChart'
+import { Button } from '../components/ui/button'
import { useAppStore } from '../store/useAppStore'
-import {
- FONT_MONO,
- FONT_UI,
- accentChipStyle,
- footerStyle,
- footerTextStyle,
- primaryButtonStyle,
- resolveNetworkVisual,
- secondaryButtonStyle,
- sectionHeaderLabelStyle,
- statGridStyle,
- statLabelStyle,
- statValueStyle
-} from '../theme'
+import { resolveNetworkVisual } from '../theme'
import {
dirnameOf,
formatBytes,
@@ -25,11 +14,9 @@ import {
toDisplayPath
} from '../utils/format'
-const heroScopeStyle: React.CSSProperties = {
- padding: '18px 20px',
- background: 'var(--hero-bg)',
- borderBottom: '1px solid var(--hero-border)'
-}
+const heroClass = 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px]'
+const sectionHeaderClass =
+ 'font-mono text-[10px] leading-none tracking-[0.16em] text-muted-foreground uppercase'
export function CompleteScreen({
download,
@@ -107,26 +94,11 @@ export function CompleteScreen({
const handleReveal = (): void => void window.plexo.revealInFolder(download.destinationPath)
return (
- <div
- className="bg-background"
- style={{ display: 'flex', flexDirection: 'column', height: '100%' }}
- >
- <div className="text-foreground" style={heroScopeStyle}>
- <div style={{ display: 'flex', alignItems: 'center', gap: 18 }}>
- <div
- style={{
- width: 44,
- height: 44,
- borderRadius: '50%',
- background: 'var(--color-wifi-bg)',
- border: '1px solid var(--color-wifi-border)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0
- }}
- >
- <svg viewBox="0 0 24 24" style={{ width: 21, height: 21 }}>
+ <div className="flex h-full flex-col bg-background">
+ <div className={`${heroClass} text-foreground`}>
+ <div className="flex items-center gap-[18px]">
+ <div className="flex size-11 shrink-0 items-center justify-center rounded-full border border-[var(--color-wifi-border)] bg-[var(--color-wifi-bg)]">
+ <svg viewBox="0 0 24 24" className="size-[21px]">
<path
d="M5,13 L10,18 L19,7"
fill="none"
@@ -137,88 +109,43 @@ export function CompleteScreen({
/>
</svg>
</div>
- <div style={{ minWidth: 0, flex: 1 }}>
- <div
- style={{
- font: `700 16px/1.2 ${FONT_UI}`,
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis'
- }}
- >
+ <div className="min-w-0 flex-1">
+ <div className="truncate font-sans text-[16px] leading-[1.2] font-bold">
{download.fileName}
</div>
- <div
- className="text-muted-foreground"
- style={{
- marginTop: 5,
- font: `11.5px/1.3 ${FONT_MONO}`,
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis'
- }}
- >
+ <div className="mt-[5px] truncate font-mono text-[11.5px] leading-[1.3] text-muted-foreground">
{formatBytes(finalSize)} ·{' '}
{toDisplayPath(dirnameOf(download.destinationPath), homeDir)}
</div>
</div>
- <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 5 }}>
- <div
- className="text-muted-foreground"
- style={{
- font: `500 9px/1 ${FONT_MONO}`,
- letterSpacing: '0.16em'
- }}
- >
+ <div className="flex flex-col items-end gap-[5px]">
+ <div className="font-mono text-[9px] leading-none font-medium tracking-[0.16em] text-muted-foreground">
AVERAGE
</div>
- <div style={{ display: 'flex', alignItems: 'baseline', gap: 6 }}>
- <div
- className="text-foreground"
- style={{
- font: `600 26px/0.9 ${FONT_MONO}`,
- letterSpacing: '-0.02em',
- fontVariantNumeric: 'tabular-nums'
- }}
- >
+ <div className="flex items-baseline gap-1.5">
+ <div className="font-mono text-[26px] leading-[0.9] font-semibold tracking-[-0.02em] tabular-nums text-foreground">
{formatSpeed(avgSpeed).split(' ')[0]}
</div>
- <div className="text-muted-foreground" style={{ font: `500 11px/1 ${FONT_MONO}` }}>
+ <div className="font-mono text-[11px] leading-none font-medium text-muted-foreground">
MB/s
</div>
</div>
{activeChipOption && (
- <button
- type="button"
+ <CyclableChip
+ label={activeChipOption.label}
+ tooltip={`${activeChipOption.tooltip} (click to toggle)`}
+ bg="var(--color-usb-bg)"
+ border="var(--color-usb-border)"
+ color="var(--color-usb-text)"
+ cyclable
onClick={() => setChipModeIndex((i) => (i + 1) % chipOptions.length)}
- title={`${activeChipOption.tooltip} (click to toggle)`}
- style={{
- ...accentChipStyle,
- display: 'inline-flex',
- alignItems: 'center',
- gap: 5,
- cursor: 'pointer',
- userSelect: 'none',
- border: '0.5px solid var(--color-usb-border)',
- background: 'var(--color-usb-bg)',
- color: 'var(--color-usb-text)'
- }}
- >
- <span>{activeChipOption.label}</span>
- <span style={{ opacity: 0.55, fontSize: 8.5 }}>⇄</span>
- </button>
+ />
)}
</div>
</div>
</div>
- <div
- style={{
- margin: '18px 20px',
- ...statGridStyle,
- gridTemplateColumns: 'repeat(5, minmax(0, 1fr))'
- }}
- >
+ <div className="mx-5 my-[18px] grid grid-cols-5 overflow-hidden rounded-[10px] border-[0.5px] border-border bg-card">
{[
{ label: 'Size', value: formatBytes(finalSize) },
{ label: 'Time', value: formatDuration(elapsedSeconds) },
@@ -228,42 +155,31 @@ export function CompleteScreen({
].map((stat, index) => (
<div
key={stat.label}
- className={index > 0 ? 'border-l-[0.5px] border-border' : undefined}
- style={{
- padding: '11px 14px',
- display: 'flex',
- flexDirection: 'column',
- gap: 5
- }}
+ className={`flex flex-col gap-[5px] p-[11px_14px] ${
+ index > 0 ? 'border-l-[0.5px] border-border' : ''
+ }`}
>
- <div style={statLabelStyle}>{stat.label}</div>
- <div style={statValueStyle}>{stat.value}</div>
+ <div className="font-mono text-[9px] leading-none font-medium tracking-[0.14em] text-muted-foreground uppercase">
+ {stat.label}
+ </div>
+ <div className="font-mono text-[14px] leading-none font-medium tabular-nums">
+ {stat.value}
+ </div>
</div>
))}
</div>
- <div style={{ margin: '0 20px 16px', display: 'flex', flexDirection: 'column', gap: 8 }}>
- <div style={sectionHeaderLabelStyle}>Speed over the download</div>
+ <div className="mx-5 mb-4 flex flex-col gap-2">
+ <div className={sectionHeaderClass}>Speed over the download</div>
<ThroughputChart
order={groups.map((g, i) => ({ interfaceId: g.interfaceId, solid: visuals[i].solid }))}
historyByInterface={speedHistoryByInterface}
/>
</div>
- <div
- style={{ margin: '0 20px 20px', display: 'flex', flexDirection: 'column', gap: 9, flex: 1 }}
- >
- <div style={sectionHeaderLabelStyle}>Contribution by network</div>
- <div
- className="bg-muted"
- style={{
- display: 'flex',
- height: 10,
- borderRadius: 999,
- overflow: 'hidden',
- gap: 2
- }}
- >
+ <div className="mx-5 mb-5 flex flex-1 flex-col gap-[9px]">
+ <div className={sectionHeaderClass}>Contribution by network</div>
+ <div className="flex h-2.5 gap-0.5 overflow-hidden rounded-full bg-muted">
{groups.map((group, index) => (
<div
key={group.interfaceId}
@@ -271,20 +187,18 @@ export function CompleteScreen({
/>
))}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>
+ <div className="flex flex-col gap-[9px]">
{groups.map((group, index) => (
- <div key={group.interfaceId} style={{ display: 'flex', alignItems: 'center', gap: 9 }}>
+ <div key={group.interfaceId} className="flex items-center gap-[9px]">
<div
- style={{
- width: 7,
- height: 7,
- borderRadius: '50%',
- background: visuals[index].solid
- }}
+ className="size-[7px] shrink-0 rounded-full"
+ style={{ background: visuals[index].solid }}
/>
- <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)' }}>
+ <div className="font-sans text-[12px] leading-none font-medium">
+ {visuals[index].name}
+ </div>
+ <div className="flex-1" />
+ <div className="font-mono text-[11.5px] leading-none text-[var(--text-secondary)]">
{formatBytes(group.bytesDownloaded)} ·{' '}
{Math.round((group.bytesDownloaded / totalWeight) * 100)}%
</div>
@@ -293,19 +207,19 @@ export function CompleteScreen({
</div>
</div>
- <div style={footerStyle}>
- <div style={footerTextStyle}>
+ <div className="flex items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <div className="shrink-0 font-mono text-[11px] leading-[1.4] whitespace-nowrap text-muted-foreground">
{`reassembled from ${totalChunkCount} chunks · ${totalRetries} ${
totalRetries === 1 ? 'retry' : 'retries'
}`}
</div>
- <div style={{ flex: 1 }} />
- <button type="button" onClick={onNewDownload} style={secondaryButtonStyle}>
+ <div className="flex-1" />
+ <Button type="button" variant="secondary" onClick={onNewDownload}>
New Download
- </button>
- <button type="button" onClick={handleReveal} style={primaryButtonStyle}>
+ </Button>
+ <Button type="button" onClick={handleReveal}>
{window.plexo.platform === 'darwin' ? 'Reveal in Finder' : 'Show in folder'}
- </button>
+ </Button>
</div>
</div>
)
diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsx
index 30c9fbb..f5a105d 100644
--- a/src/renderer/src/screens/DownloadingScreen.tsx
+++ b/src/renderer/src/screens/DownloadingScreen.tsx
@@ -1,26 +1,15 @@
import type { DownloadState } from '@shared/types'
import { useEffect, useState } from 'react'
import { BlockGrid } from '../components/BlockGrid'
+import { ColorBadge } from '../components/ColorBadge'
import { CombineDiagram } from '../components/CombineDiagram'
+import { CyclableChip } from '../components/CyclableChip'
import { NetworkRow } from '../components/NetworkRow'
import { ThroughputChart } from '../components/ThroughputChart'
+import { Button } from '../components/ui/button'
import { useNetworkPolling } from '../hooks/useNetworkPolling'
import { useAppStore } from '../store/useAppStore'
-import {
- FONT_MONO,
- FONT_UI,
- accentChipStyle,
- dangerButtonStyle,
- footerStyle,
- footerTextStyle,
- networkTableGridStyle,
- networkTableHeaderStyle,
- primaryButtonStyle,
- resolveNetworkVisual,
- secondaryButtonStyle,
- sectionHeaderLabelStyle,
- sectionHeaderMetaStyle
-} from '../theme'
+import { NETWORK_ROW_GRID_COLUMNS, resolveNetworkVisual } from '../theme'
import {
dirnameOf,
fileExtensionBadge,
@@ -37,11 +26,9 @@ import {
// light/dark theme — scoping the theme variables it reads (--text, --border, ...) to these
// literal values keeps its own children (labels, the combine diagram, the chart) legible no
// matter which OS appearance the rest of the window is following.
-const heroScopeStyle: React.CSSProperties = {
- padding: '18px 20px',
- background: 'var(--hero-bg)',
- borderBottom: '1px solid var(--hero-border)'
-}
+const heroClass = 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px]'
+const sectionHeaderClass =
+ 'font-mono text-[10px] leading-none tracking-[0.16em] text-muted-foreground uppercase'
// Build list of toggleable comparison metrics for active networks (only "X× [NETWORK] ALONE").
interface SpeedChipOption {
@@ -55,7 +42,7 @@ interface SpeedChipOption {
/** Inline "·" separator between adjacent stats. `shrink` pins it at its natural width inside a
* flex row that might otherwise squeeze it (footer rows), matching each call site's prior style. */
function Dot({ shrink }: { shrink?: boolean }): React.JSX.Element {
- return <span style={{ opacity: 0.35, flexShrink: shrink ? 0 : undefined }}>·</span>
+ return <span className={`opacity-35 ${shrink ? 'shrink-0' : ''}`}>·</span>
}
function InlineStat({ label, value }: { label: string; value: string }): React.JSX.Element {
@@ -66,36 +53,6 @@ function InlineStat({ label, value }: { label: string; value: string }): React.J
)
}
-/** The small "PAUSED"/"ASSEMBLING" tag next to the file name — shape is fixed, only the label
- * and its network-kind color tokens vary between the two call sites. */
-function StatusPill({
- label,
- color,
- bg,
- border
-}: {
- label: string
- color: string
- bg: string
- border: string
-}): React.JSX.Element {
- return (
- <span
- style={{
- font: `600 9.5px/1 ${FONT_MONO}`,
- letterSpacing: '0.08em',
- color,
- background: bg,
- border: `0.5px solid ${border}`,
- padding: '2px 7px',
- borderRadius: 3.5
- }}
- >
- {label}
- </span>
- )
-}
-
export function DownloadingScreen({ download }: { download: DownloadState }): React.JSX.Element {
useNetworkPolling(true)
@@ -243,8 +200,8 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
return (
<div className="flex h-full flex-col bg-background">
- <div style={heroScopeStyle} className="text-foreground">
- <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
+ <div className={`${heroClass} text-foreground`}>
+ <div className="flex items-center gap-[14px]">
<CombineDiagram
networks={groups.map((group, index) => ({
solid: visuals[index].solid,
@@ -255,136 +212,74 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
assembling={isAssembling}
/>
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: 7,
- minWidth: 130,
- flexShrink: 0
- }}
- >
+ <div className="flex min-w-[130px] shrink-0 flex-col gap-[7px]">
{isAssembling ? (
<>
- <div
- className="text-muted-foreground"
- style={{ font: `500 10px/1 ${FONT_MONO}`, letterSpacing: '0.2em' }}
- >
+ <div className="font-mono text-[10px] leading-none font-medium tracking-[0.2em] text-muted-foreground">
ASSEMBLING
</div>
- <div style={{ display: 'flex', alignItems: 'baseline', gap: 7 }}>
- <div
- style={{
- font: `600 38px/0.88 ${FONT_MONO}`,
- letterSpacing: '-0.03em',
- color: 'var(--color-ethernet)',
- fontVariantNumeric: 'tabular-nums'
- }}
- >
+ <div className="flex items-baseline gap-[7px]">
+ <div className="font-mono text-[38px] leading-[0.88] font-semibold tracking-[-0.03em] tabular-nums text-[var(--color-ethernet)]">
{assemblePercent}
</div>
- <div
- className="text-muted-foreground"
- style={{ font: `500 12px/1 ${FONT_MONO}` }}
- >
+ <div className="font-mono text-[12px] leading-none font-medium text-muted-foreground">
%
</div>
</div>
</>
) : (
<>
- <div
- className="text-muted-foreground"
- style={{
- font: `500 10px/1 ${FONT_MONO}`,
- letterSpacing: '0.2em',
- display: 'flex',
- alignItems: 'center',
- gap: 6
- }}
- >
+ <div className="flex items-center gap-1.5 font-mono text-[10px] leading-none font-medium tracking-[0.2em] text-muted-foreground">
<span>TOTAL SPEED</span>
{isPaused && (
- <span
- style={{
- font: `600 9px/1 ${FONT_MONO}`,
- letterSpacing: '0.08em',
- color: 'var(--color-usb)',
- background: 'var(--color-usb-bg)',
- border: '0.5px solid var(--color-usb-border)',
- padding: '2px 5px',
- borderRadius: 3
- }}
+ <ColorBadge
+ bg="var(--color-usb-bg)"
+ border="var(--color-usb-border)"
+ text="var(--color-usb)"
+ className="h-auto rounded-[3px] px-[5px] py-0.5 text-[9px] font-semibold tracking-[0.08em]"
>
PAUSED
- </span>
+ </ColorBadge>
)}
</div>
- <div style={{ display: 'flex', alignItems: 'baseline', gap: 7 }}>
+ <div className="flex items-baseline gap-[7px]">
<div
- className={isPaused ? 'text-muted-foreground' : 'text-foreground'}
- style={{
- font: `600 38px/0.88 ${FONT_MONO}`,
- letterSpacing: '-0.03em',
- fontVariantNumeric: 'tabular-nums'
- }}
+ className={`font-mono text-[38px] leading-[0.88] font-semibold tracking-[-0.03em] tabular-nums ${
+ isPaused ? 'text-muted-foreground' : 'text-foreground'
+ }`}
>
{isPaused ? '—' : speed.value}
</div>
{!isPaused && (
- <div
- className="text-muted-foreground"
- style={{ font: `500 12px/1 ${FONT_MONO}` }}
- >
+ <div className="font-mono text-[12px] leading-none font-medium text-muted-foreground">
{speed.unit}/s
</div>
)}
</div>
- <div
- className="text-muted-foreground"
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- font: `500 10px/1 ${FONT_MONO}`,
- fontVariantNumeric: 'tabular-nums'
- }}
- >
+ <div className="flex items-center gap-2 font-mono text-[10px] leading-none font-medium tabular-nums text-muted-foreground">
<InlineStat label="AVG" value={formatSpeed(avgSpeedBytesPerSec)} />
<Dot />
<InlineStat label="PEAK" value={formatSpeed(peakSpeedBytesPerSec)} />
</div>
{isPaused ? (
<div
- className={download.error ? 'text-destructive' : 'text-muted-foreground'}
- style={{ font: `500 11px/1.2 ${FONT_UI}`, marginTop: 2 }}
+ className={`mt-0.5 font-sans text-[11px] leading-[1.2] font-medium ${
+ download.error ? 'text-destructive' : 'text-muted-foreground'
+ }`}
>
{download.error ?? 'Download paused'}
</div>
) : (
activeChipOption && (
- <button
- type="button"
+ <CyclableChip
+ label={activeChipOption.label}
+ tooltip={`${activeChipOption.tooltip}${chipOptions.length > 1 ? ' (click to toggle)' : ''}`}
+ bg={activeChipOption.bg}
+ border={activeChipOption.border}
+ color={activeChipOption.color}
+ cyclable={chipOptions.length > 1}
onClick={() => setChipModeIndex((i) => (i + 1) % chipOptions.length)}
- title={`${activeChipOption.tooltip}${chipOptions.length > 1 ? ' (click to toggle)' : ''}`}
- style={{
- ...accentChipStyle,
- display: 'inline-flex',
- alignItems: 'center',
- gap: 5,
- cursor: chipOptions.length > 1 ? 'pointer' : 'default',
- userSelect: 'none',
- border: `0.5px solid ${activeChipOption.border}`,
- background: activeChipOption.bg,
- color: activeChipOption.color,
- width: 'fit-content'
- }}
- >
- <span>{activeChipOption.label}</span>
- {chipOptions.length > 1 && (
- <span style={{ opacity: 0.55, fontSize: 8.5 }}>⇄</span>
- )}
- </button>
+ />
)
)}
</>
@@ -392,17 +287,11 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
</div>
<div
- style={{
- flex: 1,
- minWidth: 0,
- opacity: isPaused || isAssembling ? 0.45 : 1,
- transition: 'opacity 0.2s'
- }}
+ className={`min-w-0 flex-1 transition-opacity duration-200 ${
+ isPaused || isAssembling ? 'opacity-45' : 'opacity-100'
+ }`}
>
- <div
- className="text-muted-foreground"
- style={{ font: `500 9.5px/1 ${FONT_MONO}`, letterSpacing: '0.12em' }}
- >
+ <div className="font-mono text-[9.5px] leading-none font-medium tracking-[0.12em] text-muted-foreground">
THROUGHPUT · {throughputStatusLabel}
</div>
<ThroughputChart
@@ -416,52 +305,19 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
</div>
</div>
- <div
- style={{
- padding: '16px 20px 18px',
- display: 'flex',
- flexDirection: 'column',
- gap: 12
- }}
- >
- <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
- <div
- className="bg-card"
- style={{
- width: 44,
- height: 44,
- borderRadius: 10,
- border: '0.5px solid var(--border-strong)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- font: `700 10.5px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)',
- letterSpacing: '0.04em',
- flexShrink: 0
- }}
- >
+ <div className="flex flex-col gap-3 p-[16px_20px_18px]">
+ <div className="flex items-center gap-[14px]">
+ <div className="flex size-11 shrink-0 items-center justify-center rounded-[10px] border-[0.5px] border-[var(--border-strong)] bg-card font-mono text-[10.5px] leading-none font-bold tracking-[0.04em] text-[var(--text-secondary)]">
{fileExtensionBadge(download.fileName)}
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
+ <div className="min-w-0 flex-1">
<div
- className="truncate text-foreground"
- style={{ font: `600 15px/1.3 ${FONT_UI}`, letterSpacing: '-0.01em' }}
+ className="truncate font-sans text-[15px] leading-[1.3] font-semibold tracking-[-0.01em] text-foreground"
title={download.fileName}
>
{download.fileName}
</div>
- <div
- style={{
- marginTop: 4,
- font: `12.5px/1.2 ${FONT_MONO}`,
- color: 'var(--text-secondary)',
- fontVariantNumeric: 'tabular-nums',
- display: 'flex',
- alignItems: 'center',
- gap: 7
- }}
- >
+ <div className="mt-1 flex items-center gap-[7px] font-mono text-[12.5px] leading-[1.2] tabular-nums text-[var(--text-secondary)]">
<span>
{formatBytes(isAssembling ? assembledBytes : download.bytesDownloaded)}
{knownSize ? ` of ${formatBytes(download.totalBytes)}` : ''}
@@ -477,26 +333,30 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
{!isPaused && !isAssembling && knownSize && effectiveSpeed > 0 && (
<>
<Dot />
- <span style={{ color: 'var(--text-secondary)' }}>
+ <span className="text-[var(--text-secondary)]">
{formatEta(remainingBytes, effectiveSpeed)} left
</span>
</>
)}
{isPaused && (
- <StatusPill
- label="PAUSED"
- color="var(--color-usb)"
+ <ColorBadge
bg="var(--color-usb-bg)"
border="var(--color-usb-border)"
- />
+ text="var(--color-usb)"
+ className="h-auto rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]"
+ >
+ PAUSED
+ </ColorBadge>
)}
{isAssembling && (
- <StatusPill
- label="ASSEMBLING"
- color="var(--color-ethernet-text)"
+ <ColorBadge
bg="var(--color-ethernet-bg)"
border="var(--color-ethernet-border)"
- />
+ text="var(--color-ethernet-text)"
+ className="h-auto rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]"
+ >
+ ASSEMBLING
+ </ColorBadge>
)}
</div>
</div>
@@ -514,28 +374,24 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
/>
</div>
- <div style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden' }}>
- <div
- style={{
- display: 'flex',
- alignItems: 'baseline',
- justifyContent: 'space-between',
- padding: '0 20px 8px'
- }}
- >
- <div style={sectionHeaderLabelStyle}>Networks</div>
- <div style={sectionHeaderMetaStyle}>
+ <div className="flex-1 overflow-x-hidden overflow-y-auto">
+ <div className="flex items-baseline justify-between p-[0_20px_8px]">
+ <div className={sectionHeaderClass}>Networks</div>
+ <div className="shrink-0 font-mono text-[10.5px] leading-none text-muted-foreground">
{groups.length} combined · {download.chunks.length} streams · {networksStatusLabel}
</div>
</div>
- <div style={networkTableGridStyle}>
- <div style={networkTableHeaderStyle}>
+ <div
+ className="grid gap-x-3 px-5"
+ style={{ gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS }}
+ >
+ <div className="col-span-full grid grid-cols-subgrid gap-x-3 border-b border-border pt-2.5 pb-[7px] font-mono text-[9.5px] leading-none tracking-[0.12em] text-muted-foreground uppercase">
<div />
<div>Network</div>
<div>Progress</div>
- <div style={{ textAlign: 'right' }}>Share</div>
- <div style={{ textAlign: 'right' }}>Speed</div>
- <div style={{ textAlign: 'right' }}>Downloaded</div>
+ <div className="text-right">Share</div>
+ <div className="text-right">Speed</div>
+ <div className="text-right">Downloaded</div>
</div>
{groups.map((group) => {
const sharePercent =
@@ -556,56 +412,40 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
</div>
</div>
- <div style={footerStyle}>
- <div
- style={{
- ...footerTextStyle,
- flex: 1,
- minWidth: 0,
- overflow: 'hidden',
- display: 'flex',
- alignItems: 'center',
- gap: 7
- }}
- >
+ <div className="flex items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <div className="flex min-w-0 flex-1 items-center gap-[7px] overflow-hidden font-mono text-[11px] leading-[1.4] text-muted-foreground">
<span className="truncate" title={`Saving to: ${download.destinationPath}`}>
Saving to {toDisplayPath(dirnameOf(download.destinationPath), homeDir)}
</span>
<Dot shrink />
- <span style={{ flexShrink: 0 }}>Resumable</span>
+ <span className="shrink-0">Resumable</span>
{totalRetries > 0 && (
<>
<Dot shrink />
- <span style={{ color: 'var(--color-usb)', flexShrink: 0 }}>
+ <span className="shrink-0 text-[var(--color-usb)]">
{totalRetries} {totalRetries === 1 ? 'retry' : 'retries'}
</span>
</>
)}
</div>
- <button
+ <Button
type="button"
+ variant={isPaused ? 'default' : 'secondary'}
onClick={handlePauseResume}
disabled={isAssembling || resuming}
title={isAssembling ? "Can't pause while assembling the file" : undefined}
- style={{
- ...(isPaused ? primaryButtonStyle : secondaryButtonStyle),
- ...((isAssembling || resuming) && { opacity: 0.5, cursor: 'not-allowed' })
- }}
>
{pauseResumeLabel}
- </button>
- <button
+ </Button>
+ <Button
type="button"
+ variant="destructive"
onClick={handleCancel}
disabled={isAssembling}
title={isAssembling ? "Can't cancel while assembling the file" : undefined}
- style={{
- ...dangerButtonStyle,
- ...(isAssembling && { opacity: 0.5, cursor: 'not-allowed' })
- }}
>
Cancel
- </button>
+ </Button>
</div>
</div>
)
diff --git a/src/renderer/src/screens/ErrorScreen.tsx b/src/renderer/src/screens/ErrorScreen.tsx
index dbf030c..25778a2 100644
--- a/src/renderer/src/screens/ErrorScreen.tsx
+++ b/src/renderer/src/screens/ErrorScreen.tsx
@@ -1,14 +1,6 @@
import type { DownloadState } from '@shared/types'
import { useState } from 'react'
-import {
- DANGER,
- FONT_MONO,
- FONT_UI,
- footerStyle,
- footerTextStyle,
- primaryButtonStyle,
- secondaryButtonStyle
-} from '../theme'
+import { Button } from '../components/ui/button'
import { describeError, fileExtensionBadge, formatBytes } from '../utils/format'
export function ErrorScreen({
@@ -44,52 +36,19 @@ export function ErrorScreen({
}
return (
- <div
- className="bg-background"
- style={{ display: 'flex', flexDirection: 'column', height: '100%' }}
- >
- <div
- style={{
- flex: 1,
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- padding: '24px 20px'
- }}
- >
- <div
- className="bg-card"
- style={{
- maxWidth: 440,
- width: '100%',
- borderRadius: 14,
- padding: '28px 24px',
- border: '0.5px solid var(--border-strong)',
- boxShadow: '0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2)',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- gap: 18,
- textAlign: 'center'
- }}
- >
+ <div className="flex h-full flex-col bg-background">
+ <div className="flex flex-1 flex-col items-center justify-center px-5 py-6">
+ <div className="flex w-full max-w-[440px] flex-col items-center gap-[18px] rounded-[14px] border-[0.5px] border-[var(--border-strong)] bg-card p-[28px_24px] text-center shadow-[0_16px_40px_rgba(0,0,0,0.45),0_2px_8px_rgba(0,0,0,0.2)]">
{/* Status Icon */}
<div
- style={{
- width: 48,
- height: 48,
- borderRadius: '50%',
- background: cancelled ? 'var(--color-usb-bg)' : 'var(--color-danger-bg)',
- border: `1px solid ${cancelled ? 'var(--color-usb-border)' : 'var(--color-danger-border)'}`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0
- }}
+ className={`flex size-12 shrink-0 items-center justify-center rounded-full border ${
+ cancelled
+ ? 'border-[var(--color-usb-border)] bg-[var(--color-usb-bg)]'
+ : 'border-[var(--color-danger-border)] bg-[var(--color-danger-bg)]'
+ }`}
>
{cancelled ? (
- <svg viewBox="0 0 24 24" style={{ width: 22, height: 22 }}>
+ <svg viewBox="0 0 24 24" className="size-[22px]">
<circle
cx="12"
cy="12"
@@ -109,84 +68,52 @@ export function ErrorScreen({
/>
</svg>
) : (
- <svg viewBox="0 0 24 24" style={{ width: 22, height: 22 }}>
- <circle cx="12" cy="12" r="9" fill="none" stroke={DANGER} strokeWidth="2" />
+ <svg viewBox="0 0 24 24" className="size-[22px]">
+ <circle
+ cx="12"
+ cy="12"
+ r="9"
+ fill="none"
+ className="stroke-destructive"
+ strokeWidth="2"
+ />
<line
x1="12"
y1="8"
x2="12"
y2="12.5"
- stroke={DANGER}
+ className="stroke-destructive"
strokeWidth="2.4"
strokeLinecap="round"
/>
- <circle cx="12" cy="15.5" r="1.2" fill={DANGER} />
+ <circle cx="12" cy="15.5" r="1.2" className="fill-destructive" />
</svg>
)}
</div>
{/* Heading */}
- <div role="alert" style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
- <div className="text-foreground" style={{ font: `700 17px/1.2 ${FONT_UI}` }}>
+ <div role="alert" className="flex flex-col gap-[5px]">
+ <div className="font-sans text-[17px] leading-[1.2] font-bold text-foreground">
{heading}
</div>
- <div style={{ font: `12px/1.4 ${FONT_UI}`, color: 'var(--text-secondary)' }}>
+ <div className="font-sans text-[12px] leading-[1.4] text-[var(--text-secondary)]">
{description}
</div>
</div>
{/* File capsule */}
- <div
- className="bg-background"
- style={{
- width: '100%',
- borderRadius: 9,
- padding: '10px 12px',
- border: '0.5px solid var(--border)',
- display: 'flex',
- alignItems: 'center',
- gap: 11,
- textAlign: 'left'
- }}
- >
- <div
- className="bg-card"
- style={{
- width: 34,
- height: 34,
- borderRadius: 7,
- border: '0.5px solid var(--border-strong)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- font: `600 8.5px/1 ${FONT_MONO}`,
- color: 'var(--text-secondary)',
- flexShrink: 0
- }}
- >
+ <div className="flex w-full items-center gap-[11px] rounded-[9px] border-[0.5px] border-border bg-background p-[10px_12px] text-left">
+ <div className="flex size-[34px] shrink-0 items-center justify-center rounded-[7px] border-[0.5px] border-[var(--border-strong)] bg-card font-mono text-[8.5px] leading-none font-semibold text-[var(--text-secondary)]">
{fileExtensionBadge(download.fileName)}
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
+ <div className="min-w-0 flex-1">
<div
- className="text-foreground"
- style={{
- font: `600 12.5px/1.3 ${FONT_UI}`,
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- textOverflow: 'ellipsis'
- }}
+ className="truncate font-sans text-[12.5px] leading-[1.3] font-semibold text-foreground"
title={download.fileName}
>
{download.fileName}
</div>
- <div
- className="text-muted-foreground"
- style={{
- marginTop: 2,
- font: `11px/1 ${FONT_MONO}`,
- fontVariantNumeric: 'tabular-nums'
- }}
- >
+ <div className="mt-0.5 font-mono text-[11px] leading-none tabular-nums text-muted-foreground">
{download.bytesDownloaded > 0 ? (
<>
{formatBytes(download.bytesDownloaded)}
@@ -202,53 +129,21 @@ export function ErrorScreen({
</div>
{/* Action Buttons in Center */}
- <div
- style={{
- display: 'flex',
- gap: 10,
- width: '100%',
- justifyContent: 'center',
- marginTop: 4
- }}
- >
- <button
- type="button"
- onClick={onDownloadAgain}
- style={{
- ...primaryButtonStyle,
- padding: '9px 22px',
- display: 'inline-flex',
- alignItems: 'center',
- gap: 6
- }}
- >
- <span>Download Again</span>
- </button>
- <button
- type="button"
- onClick={onNewDownload}
- style={{
- ...secondaryButtonStyle,
- padding: '9px 18px'
- }}
- >
+ <div className="mt-1 flex w-full justify-center gap-2.5">
+ <Button type="button" onClick={onDownloadAgain}>
+ Download Again
+ </Button>
+ <Button type="button" variant="secondary" onClick={onNewDownload}>
New Download
- </button>
+ </Button>
</div>
</div>
</div>
{/* Footer with properly constrained, non-overflowing URL */}
- <div style={{ ...footerStyle, minWidth: 0 }}>
+ <div className="flex min-w-0 items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
<div
- style={{
- ...footerTextStyle,
- flex: 1,
- minWidth: 0,
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap'
- }}
+ className="min-w-0 flex-1 truncate font-mono text-[11px] leading-none text-muted-foreground"
title={download.url}
>
{download.url}
@@ -256,15 +151,9 @@ export function ErrorScreen({
<button
type="button"
onClick={handleCopyUrl}
- style={{
- border: 'none',
- background: 'none',
- font: `500 11px/1 ${FONT_MONO}`,
- color: copied ? 'var(--color-success)' : 'var(--color-accent)',
- cursor: 'pointer',
- padding: '2px 4px',
- flexShrink: 0
- }}
+ className={`shrink-0 border-none bg-transparent px-1 py-0.5 font-mono text-[11px] leading-none ${
+ copied ? 'text-[var(--color-success)]' : 'text-primary'
+ }`}
>
{copied ? 'Copied' : 'Copy URL'}
</button>
diff --git a/src/renderer/src/screens/NoConnectionsScreen.tsx b/src/renderer/src/screens/NoConnectionsScreen.tsx
index eccfc5a..de3d9ed 100644
--- a/src/renderer/src/screens/NoConnectionsScreen.tsx
+++ b/src/renderer/src/screens/NoConnectionsScreen.tsx
@@ -1,7 +1,7 @@
import { CombineDiagram } from '../components/CombineDiagram'
+import { Button } from '../components/ui/button'
import { useNetworkPolling } from '../hooks/useNetworkPolling'
import { useAppStore } from '../store/useAppStore'
-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.
@@ -17,67 +17,38 @@ export function NoConnectionsScreen(): React.JSX.Element {
const loadInterfaces = useAppStore((store) => store.loadInterfaces)
return (
- <div
- className="bg-background"
- style={{ display: 'flex', flexDirection: 'column', height: '100%' }}
- >
- <div
- style={{
- flex: 1,
- padding: '40px 20px 44px',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- gap: 16
- }}
- >
+ <div className="flex h-full flex-col bg-background">
+ <div className="flex flex-1 flex-col items-center justify-center gap-4 px-5 pt-10 pb-11">
<CombineDiagram networks={PLACEHOLDER_NETWORKS} muted />
- <div className="text-foreground" style={{ font: `700 16px/1.2 ${FONT_UI}` }}>
+ <div className="font-sans text-[16px] leading-[1.2] font-bold text-foreground">
No networks to combine
</div>
- <div
- style={{
- maxWidth: 380,
- textAlign: 'center',
- font: `12.5px/1.6 ${FONT_UI}`,
- color: 'var(--text-secondary)'
- }}
- >
+ <div className="max-w-[380px] text-center font-sans text-[12.5px] leading-[1.6] text-[var(--text-secondary)]">
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}>
+ <div className="mt-1 flex gap-2">
+ <Button type="button" variant="secondary" onClick={() => loadInterfaces()}>
Scan Again
- </button>
- <button
+ </Button>
+ <Button
type="button"
+ variant="secondary"
onClick={() => window.plexo.openNetworkSettings()}
- style={secondaryButtonStyle}
>
Network Settings…
- </button>
+ </Button>
</div>
</div>
- <div
- className="bg-secondary"
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 10,
- padding: '11px 20px',
- borderTop: '0.5px solid var(--footer-border)'
- }}
- >
- <div className="text-muted-foreground" style={{ font: `11px/1.4 ${FONT_MONO}` }}>
+ <div className="flex items-center gap-2.5 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <div className="font-mono text-[11px] leading-[1.4] text-muted-foreground">
0 networks · watching for changes
</div>
- <div style={{ flex: 1 }} />
- <button type="button" disabled style={disabledPrimaryButtonStyle}>
+ <div className="flex-1" />
+ <Button type="button" disabled>
Start
- </button>
+ </Button>
</div>
</div>
)
diff --git a/src/renderer/src/theme.ts b/src/renderer/src/theme.ts
index 6a9a9ac..e410489 100644
--- a/src/renderer/src/theme.ts
+++ b/src/renderer/src/theme.ts
@@ -1,8 +1,5 @@
import type { NetworkInterfaceKind, NetworkPreference } from '@shared/types'
-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: string
bg: string
@@ -36,169 +33,8 @@ export const KIND_PALETTE: Record<NetworkInterfaceKind, KindPalette> = {
}
// 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' | 'paused' | 'assembling',
- { bg: string; border: string; text: string }
-> = {
- positive: {
- bg: 'var(--color-wifi-bg)',
- border: 'var(--color-wifi-border)',
- text: 'var(--color-wifi-text)'
- },
- negative: {
- bg: 'var(--color-danger-bg)',
- border: 'var(--color-danger-border)',
- text: 'var(--color-danger)'
- },
- paused: {
- bg: 'var(--color-usb-bg)',
- border: 'var(--color-usb-border)',
- text: 'var(--color-usb-text)'
- },
- assembling: {
- bg: 'var(--color-ethernet-bg)',
- border: 'var(--color-ethernet-border)',
- text: 'var(--color-ethernet-text)'
- }
-}
-
-export function pillStyle(
- kind: 'positive' | 'negative' | 'paused' | 'assembling'
-): 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(--button-secondary-border)',
- borderRadius: 8,
- background: 'var(--button-secondary-bg)',
- whiteSpace: 'nowrap',
- flexShrink: 0,
- 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: 8,
- background: 'var(--color-accent)',
- boxShadow: '0 4px 14px var(--color-accent-shadow)',
- whiteSpace: 'nowrap',
- flexShrink: 0,
- 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: 8,
- whiteSpace: 'nowrap',
- flexShrink: 0,
- background: 'var(--button-disabled-bg)',
- 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: '11px 20px',
- borderTop: '0.5px solid var(--footer-border)',
- background: 'var(--bg-tertiary)'
-}
-
-export const footerTextStyle: React.CSSProperties = {
- whiteSpace: 'nowrap',
- flexShrink: 0,
- font: `11px/1.4 ${FONT_MONO}`,
- color: 'var(--text-tertiary)'
-}
-
-export const sectionHeaderLabelStyle: React.CSSProperties = {
- font: `500 10px/1 ${FONT_MONO}`,
- letterSpacing: '0.16em',
- textTransform: 'uppercase',
- color: 'var(--text-tertiary)'
-}
-
-export const sectionHeaderMetaStyle: React.CSSProperties = {
- whiteSpace: 'nowrap',
- flexShrink: 0,
- 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'
-}
-
// Network sizes to its content (name + streams pill + "⋯" button) instead of a guessed fixed
// px — `minmax(0, max-content)` grows it to fit whatever's actually in that cell (no dead
// trailing space before Progress) and, just as importantly, lets it shrink below that on a
@@ -209,44 +45,6 @@ export const statValueStyle: React.CSSProperties = {
// Progress's stays put.
export const NETWORK_ROW_GRID_COLUMNS = '10px minmax(0, max-content) 1fr 48px 78px 90px'
-// The header and every NetworkRow used to each be their own independent CSS grid with this same
-// column template — which happened to compute matching track widths most of the time, but wasn't
-// actually *guaranteed* to, since each grid resolves its own tracks independently. The real fix
-// is structural: one grid (this style, wrapping the header and every row) owns the column tracks,
-// and the header/rows below opt into those exact tracks via `gridTemplateColumns: 'subgrid'`
-// rather than each declaring the column list a second time — so "the columns line up" stops being
-// a coincidence of matching inputs and becomes a property the browser enforces.
-export const networkTableGridStyle: React.CSSProperties = {
- display: 'grid',
- gridTemplateColumns: NETWORK_ROW_GRID_COLUMNS,
- // A subgridded axis takes its gutters from whichever grid actually defines the tracks — this
- // one — not from the `gap` set on each subgrid item (the header row, each NetworkRow). Without
- // this, every column boundary on the subgridded axis collapses to 0, which is invisible on the
- // wider columns (their fixed/flexible track width still leaves visible space) but reads as the
- // status dot touching the network name, since that track has no slack to fall back on.
- columnGap: 12,
- // The horizontal inset lives here rather than as padding on the header/row subgrids: Chromium
- // clips a subgridded axis's outer tracks by the subgrid item's OWN horizontal padding (the
- // status dot's 10px column was measuring 0px wide with `padding: '11px 20px'` on the row),
- // so only this — the grid that actually owns the tracks — may carry left/right padding.
- padding: '0 20px'
-}
-
-export const networkTableHeaderStyle: React.CSSProperties = {
- display: 'grid',
- gridTemplateColumns: 'subgrid',
- gridColumn: '1 / -1',
- gap: 12,
- padding: '10px 0 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.