Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

Stop the throughput chart and status badges from resizing their rows

Anmol Kapil43dfcc7789c2
diff --git a/src/renderer/src/components/ColorBadge.tsx b/src/renderer/src/components/ColorBadge.tsx
index 904730a..fdd8aeb 100644
--- a/src/renderer/src/components/ColorBadge.tsx
+++ b/src/renderer/src/components/ColorBadge.tsx
@@ -30,7 +30,11 @@ export function ColorBadge({
} as React.CSSProperties
}
className={cn(
- 'rounded-[4px] border-[var(--badge-border)] bg-[var(--badge-bg)] text-[var(--badge-text)]',
+ // `leading-none` because `Badge`'s base `text-xs` also sets a 1rem line-height, and a
+ // call site that shrinks the font with `text-[9px]` doesn't shrink that. On a badge left
+ // at the base `h-5` that's invisible, but on an `h-auto` one it makes the box ~20px tall
+ // next to 13px siblings — so the badge appearing (ACTIVE, PAUSED) grew its whole row.
+ 'rounded-[4px] border-[var(--badge-border)] bg-[var(--badge-bg)] text-[var(--badge-text)] leading-none',
className
)}
{...props}
diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsx
index 6783e3a..2de8209 100644
--- a/src/renderer/src/components/NetworkRow.tsx
+++ b/src/renderer/src/components/NetworkRow.tsx
@@ -230,7 +230,11 @@ export function NetworkRow({
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]"
+ // Height is pinned, not `h-auto`: this badge swaps in and out as a stream
+ // goes active, and the cell is only as tall as "Stream #N" (13.2px). Left to
+ // size itself the badge came out taller than that and grew the row on every
+ // swap. 13px keeps it under, whatever line-height it ends up inheriting.
+ className="h-[13px] rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em]"
>
ACTIVE
</ColorBadge>
diff --git a/src/renderer/src/components/ThroughputChart.tsx b/src/renderer/src/components/ThroughputChart.tsx
index 0bb66e6..631816f 100644
--- a/src/renderer/src/components/ThroughputChart.tsx
+++ b/src/renderer/src/components/ThroughputChart.tsx
@@ -13,18 +13,21 @@ interface ThroughputChartProps {
export function ThroughputChart({
order,
historyByInterface
-}: ThroughputChartProps): React.JSX.Element | null {
+}: ThroughputChartProps): React.JSX.Element {
const length = Math.max(
0,
...order.map((entry) => historyByInterface[entry.interfaceId]?.length ?? 0)
)
- if (length < 2) return null
const totals = Array.from({ length }, (_, i) =>
order.reduce((sum, entry) => sum + (historyByInterface[entry.interfaceId]?.[i] ?? 0), 0)
)
const max = Math.max(1, ...totals)
- const xStep = WIDTH / (length - 1)
+ // Fewer than two samples draws no area at all — but the empty gridlines still render, so the
+ // chart keeps its height. It's the tallest thing in the hero band, and bailing out to `null`
+ // for the first second of a download (or after a resume re-keys the history) collapsed the
+ // band and shoved the whole screen up, then back down again.
+ const xStep = length > 1 ? WIDTH / (length - 1) : WIDTH
const toY = (value: number): number => HEIGHT - (value / max) * HEIGHT
interface Layer {
diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsx
index 15f640f..452c60b 100644
--- a/src/renderer/src/screens/DownloadingScreen.tsx
+++ b/src/renderer/src/screens/DownloadingScreen.tsx
@@ -332,7 +332,11 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
bg={statusBadge.palette.bg}
border={statusBadge.palette.border}
text={statusBadge.palette.text}
- className="h-auto rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]"
+ // Pinned for the same reason as the stream row's ACTIVE badge: sizing itself,
+ // it pushed this text block past the 44px file-type icon beside it and nudged
+ // everything below down. At h-4 the block stays under the icon, so the row
+ // height is the icon's either way.
+ className="h-4 rounded-[3.5px] px-[7px] py-0.5 text-[9.5px] font-semibold tracking-[0.08em]"
>
{statusBadge.label}
</ColorBadge>