The sixth plugin out, immediately after photos. A sidecar, a proxy router and 29 web files; no db/ directory, because there are no tables. ── The one thing that is not self-contained ── The connection lives in `service_connections`, a CORE table, reached through getServiceConnection/saveServiceConnection/getServiceCredentials. This plugin declares no schema. Deliberate: that table is the app store's shared credential store, keyed on (user_id, service), already encrypted at rest and already read by app-store/effects.ts. A private copy of the same three columns would be a second place the same fact could live, and the runbook is explicit that a move plus a data-format change gives any failure two causes. The cost, stated rather than hidden: this plugin depends on a core facility it does not own, and would break if that table changed shape. Photos, by contrast, owns photos_config outright. ── 38 palette classes paid down, mapped by meaning ── blue downloading / download speed -> info cyan checking (verifying) -> busy emerald seeding / complete -> success amber queued / stalled / warnings -> warning Collapsing blue and cyan into one tone would have lost a real distinction in the status dot, so `checking` went to `busy` — in-progress work, which is what that tone is for. ── A near-miss worth recording ── The first copy globbed *.tsx and *.ts and silently missed detail/ and dialogs/ — ten components. tsgo caught it as ten "cannot find module" errors. Worth stating because it is quiet in the other direction: had those been imported lazily, the typecheck would have passed and the panels would have broken at runtime. Check the directory tree, not the file glob. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { ArrowDownToLine, ArrowUpFromLine, Waves } from 'lucide-react';
|
|
import { TRANSMISSION_SECTIONS } from './shared';
|
|
import { formatSpeed } from './format';
|
|
import { useTransmissionSection } from './useTransmissionSection';
|
|
import { useSession, useSessionStats } from './useTransmissionData';
|
|
|
|
// Panel header for the right (transmission-view) panel: which section, which daemon version, and the live
|
|
// totals — the one number you want visible no matter which section you are looking at.
|
|
|
|
export const TransmissionViewHeader = () => {
|
|
const section = useTransmissionSection();
|
|
const { stats } = useSessionStats();
|
|
const { session } = useSession();
|
|
const label = TRANSMISSION_SECTIONS.find((s) => s.id === section)?.label ?? 'Transmission';
|
|
|
|
return (
|
|
<>
|
|
<Waves className="h-3.5 w-3.5 shrink-0" />
|
|
<span className="flex-1 truncate text-xs font-medium">
|
|
{label}
|
|
{session?.version && <span className="ml-1.5 font-normal text-black/50">· {session.version}</span>}
|
|
</span>
|
|
{stats && (
|
|
<span className="flex shrink-0 items-center gap-2 text-[10px] tabular-nums text-black/60">
|
|
<span className="flex items-center gap-0.5">
|
|
<ArrowDownToLine className="h-3 w-3" />
|
|
{formatSpeed(stats.downloadSpeed) || '0'}
|
|
</span>
|
|
<span className="flex items-center gap-0.5">
|
|
<ArrowUpFromLine className="h-3 w-3" />
|
|
{formatSpeed(stats.uploadSpeed) || '0'}
|
|
</span>
|
|
</span>
|
|
)}
|
|
</>
|
|
);
|
|
};
|