import type { ReactNode } from 'react'; import type { Torrent } from '../shared'; import { Check, Copy } from 'lucide-react'; import { useState } from 'react'; import { formatDate, formatDuration, formatEta, formatPercent, formatRatio, formatSize, formatSpeed, PRIORITY_LABELS, statusLabel, } from '../format'; import { copyToClipboard } from 'helpers/clipboard'; // The "what is this torrent" tab: transfer numbers, then the immutable facts from the metainfo. type GeneralTabProps = { torrent: Torrent }; export const GeneralTab = ({ torrent: t }: GeneralTabProps) => (
{t.error !== 0 && t.errorString && (

{t.errorString}

)}
= 1 ? '—' : formatEta(t.eta)} /> {/* Corrupt bytes are re-downloaded silently, so this is the only place a failing disk or a bad peer shows up before the ratio quietly goes wrong. */}
{t.labels.length > 0 && } {t.comment && }
{t.peersFrom && (
)}
); const Section = ({ title, children, columns = 2 }: { title: string; children: ReactNode; columns?: number }) => (

{title}

{children}
); type FieldProps = { label: string; value: string; mono?: boolean; truncate?: boolean; copy?: string }; const Field = ({ label, value, mono, truncate, copy }: FieldProps) => (
{label}
{value}
{copy && }
); const CopyButton = ({ value }: { value: string }) => { const [copied, setCopied] = useState(false); return ( ); };