Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

Share one ScreenFooter and HeroBand across all screens

Anmol Kapilf55db52d38a6
diff --git a/src/renderer/src/components/HeroBand.tsx b/src/renderer/src/components/HeroBand.tsx
new file mode 100644
index 0000000..b8eec40
--- /dev/null
+++ b/src/renderer/src/components/HeroBand.tsx
@@ -0,0 +1,23 @@
+import { cn } from '../lib/utils'
+
+/** The dark panel every screen opens on — always this exact panel from the design regardless of
+ * the app's own light/dark theme, so its children (labels, diagrams, charts) stay legible no
+ * matter which OS appearance the rest of the window is following. */
+export function HeroBand({
+ className,
+ children
+}: {
+ className?: string
+ children: React.ReactNode
+}): React.JSX.Element {
+ return (
+ <div
+ className={cn(
+ 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px] text-foreground',
+ className
+ )}
+ >
+ {children}
+ </div>
+ )
+}
diff --git a/src/renderer/src/components/ScreenFooter.tsx b/src/renderer/src/components/ScreenFooter.tsx
new file mode 100644
index 0000000..e19cb31
--- /dev/null
+++ b/src/renderer/src/components/ScreenFooter.tsx
@@ -0,0 +1,22 @@
+import { cn } from '../lib/utils'
+
+/** The bottom bar every screen ends on — border, background and padding are fixed, `className`
+ * only tunes per-screen gap/alignment. */
+export function ScreenFooter({
+ className,
+ children
+}: {
+ className?: string
+ children: React.ReactNode
+}): React.JSX.Element {
+ return (
+ <div
+ className={cn(
+ 'flex items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]',
+ className
+ )}
+ >
+ {children}
+ </div>
+ )
+}
diff --git a/src/renderer/src/screens/CompleteScreen.tsx b/src/renderer/src/screens/CompleteScreen.tsx
index 9fd3c2c..07b0680 100644
--- a/src/renderer/src/screens/CompleteScreen.tsx
+++ b/src/renderer/src/screens/CompleteScreen.tsx
@@ -1,6 +1,8 @@
import { useState } from 'react'
import type { DownloadState } from '@shared/types'
import { CyclableChip } from '../components/CyclableChip'
+import { HeroBand } from '../components/HeroBand'
+import { ScreenFooter } from '../components/ScreenFooter'
import { ThroughputChart } from '../components/ThroughputChart'
import { Button } from '../components/ui/button'
import { useNetworkVisuals } from '../hooks/useNetworkVisuals'
@@ -14,7 +16,6 @@ import {
toDisplayPath
} from '../utils/format'
-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'
@@ -91,7 +92,7 @@ export function CompleteScreen({
return (
<div className="flex h-full flex-col bg-background">
- <div className={`${heroClass} text-foreground`}>
+ <HeroBand>
<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]" aria-hidden="true">
@@ -139,7 +140,7 @@ export function CompleteScreen({
)}
</div>
</div>
- </div>
+ </HeroBand>
<div className="mx-5 my-[18px] grid grid-cols-5 overflow-hidden rounded-[10px] border-[0.5px] border-border bg-card">
{[
@@ -203,7 +204,7 @@ export function CompleteScreen({
</div>
</div>
- <div className="flex items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <ScreenFooter>
<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'
@@ -216,7 +217,7 @@ export function CompleteScreen({
<Button type="button" onClick={handleReveal}>
{window.plexo.platform === 'darwin' ? 'Reveal in Finder' : 'Show in folder'}
</Button>
- </div>
+ </ScreenFooter>
</div>
)
}
diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsx
index 6912b8b..5ed8321 100644
--- a/src/renderer/src/screens/DownloadingScreen.tsx
+++ b/src/renderer/src/screens/DownloadingScreen.tsx
@@ -4,7 +4,9 @@ import { BlockGrid } from '../components/BlockGrid'
import { ColorBadge } from '../components/ColorBadge'
import { CombineDiagram } from '../components/CombineDiagram'
import { CyclableChip } from '../components/CyclableChip'
+import { HeroBand } from '../components/HeroBand'
import { NetworkRow } from '../components/NetworkRow'
+import { ScreenFooter } from '../components/ScreenFooter'
import { ThroughputChart } from '../components/ThroughputChart'
import { TruncatedText } from '../components/TruncatedText'
import {
@@ -36,13 +38,6 @@ import {
toDisplayPath
} from '../utils/format'
-// The hero band is always this exact dark panel from the design, regardless of the app's own
-// light/dark theme — scoping the theme variables it reads (--text, --border, ...) to these
-// literal values keeps its own children (labels, the combine diagram, the chart) legible no
-// matter which OS appearance the rest of the window is following.
-const heroClass =
- 'border-b border-b-[var(--hero-border)] bg-[image:var(--hero-bg)] px-5 py-[18px] text-foreground'
-
/** Inline "·" separator between adjacent stats. `shrink` pins it at its natural width inside a
* flex row that might otherwise squeeze it (footer rows), matching each call site's prior style. */
function Dot({ shrink }: { shrink?: boolean }): React.JSX.Element {
@@ -229,7 +224,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
return (
<div className="flex h-full flex-col bg-background">
- <div className={heroClass}>
+ <HeroBand>
<div className="flex items-center gap-[14px]">
<CombineDiagram
networks={groups.map((group, index) => ({
@@ -303,7 +298,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
/>
</div>
</div>
- </div>
+ </HeroBand>
<div className="flex flex-col gap-3 p-[16px_20px_18px]">
<div className="flex items-center gap-[14px]">
@@ -406,7 +401,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
</div>
</div>
- <div className="flex items-center gap-3 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <ScreenFooter>
<div className="flex min-w-0 flex-1 items-center gap-[7px] overflow-hidden font-mono text-[11px] leading-[1.4] text-muted-foreground">
<Tooltip>
<TooltipTrigger
@@ -465,7 +460,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
- </div>
+ </ScreenFooter>
</div>
)
}
diff --git a/src/renderer/src/screens/ErrorScreen.tsx b/src/renderer/src/screens/ErrorScreen.tsx
index e3b3918..4af174e 100644
--- a/src/renderer/src/screens/ErrorScreen.tsx
+++ b/src/renderer/src/screens/ErrorScreen.tsx
@@ -1,5 +1,6 @@
import type { DownloadState } from '@shared/types'
import { useState } from 'react'
+import { ScreenFooter } from '../components/ScreenFooter'
import { TruncatedText } from '../components/TruncatedText'
import { Button } from '../components/ui/button'
import { describeError, fileExtensionBadge, formatBytes } from '../utils/format'
@@ -140,7 +141,7 @@ export function ErrorScreen({
</div>
{/* Footer with properly constrained, non-overflowing URL */}
- <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]">
+ <ScreenFooter className="min-w-0">
<div className="min-w-0 flex-1 font-mono text-[11px] leading-none text-muted-foreground">
<TruncatedText text={download.url} />
</div>
@@ -153,7 +154,7 @@ export function ErrorScreen({
>
{copied ? 'Copied' : 'Copy URL'}
</button>
- </div>
+ </ScreenFooter>
</div>
)
}
diff --git a/src/renderer/src/screens/IdleScreen.tsx b/src/renderer/src/screens/IdleScreen.tsx
index 19b58e2..7c308ee 100644
--- a/src/renderer/src/screens/IdleScreen.tsx
+++ b/src/renderer/src/screens/IdleScreen.tsx
@@ -2,6 +2,7 @@ import type { ProbeResult } from '@shared/types'
import { AlertTriangle, ClipboardPaste } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import { NetworkCard } from '../components/NetworkCard'
+import { ScreenFooter } from '../components/ScreenFooter'
import { Alert, AlertDescription } from '../components/ui/alert'
import { Button } from '../components/ui/button'
import { ToggleGroup, ToggleGroupItem } from '../components/ui/toggle-group'
@@ -336,9 +337,9 @@ export function IdleScreen(): React.JSX.Element {
</div>
</div>
- <div className="flex items-center gap-2.5 border-t border-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <ScreenFooter className="gap-2.5">
<div className="font-mono text-[11px] text-muted-foreground">{footerParts.join(' · ')}</div>
- </div>
+ </ScreenFooter>
</div>
)
}
diff --git a/src/renderer/src/screens/NoConnectionsScreen.tsx b/src/renderer/src/screens/NoConnectionsScreen.tsx
index de3d9ed..a05c04e 100644
--- a/src/renderer/src/screens/NoConnectionsScreen.tsx
+++ b/src/renderer/src/screens/NoConnectionsScreen.tsx
@@ -1,4 +1,5 @@
import { CombineDiagram } from '../components/CombineDiagram'
+import { ScreenFooter } from '../components/ScreenFooter'
import { Button } from '../components/ui/button'
import { useNetworkPolling } from '../hooks/useNetworkPolling'
import { useAppStore } from '../store/useAppStore'
@@ -41,7 +42,7 @@ export function NoConnectionsScreen(): React.JSX.Element {
</div>
</div>
- <div className="flex items-center gap-2.5 border-t-[0.5px] border-t-[var(--footer-border)] bg-secondary px-5 py-[11px]">
+ <ScreenFooter className="gap-2.5">
<div className="font-mono text-[11px] leading-[1.4] text-muted-foreground">
0 networks · watching for changes
</div>
@@ -49,7 +50,7 @@ export function NoConnectionsScreen(): React.JSX.Element {
<Button type="button" disabled>
Start
</Button>
- </div>
+ </ScreenFooter>
</div>
)
}