import type { ShortLink } from "../lib/types"; import { compactNumber, fullShortUrl, prettyHost, shortUrl } from "../lib/format"; import { Sparkline } from "./Sparkline"; import { CopyButton } from "./ui/CopyButton"; import { HoldToDelete } from "./ui/HoldToDelete"; import { Qr, Lock, Edit } from "./icons"; export interface LinkItemProps { link: ShortLink; onEdit: (link: ShortLink) => void; onDelete: (link: ShortLink) => void; onDeleteTap: () => void; onManagePin: (link: ShortLink) => void; onShowQr: (link: ShortLink) => void; } export const iconBtn = "press focusable grid h-8 w-8 place-items-center rounded-lg text-muted hover:bg-surface-2 hover:text-ink"; export function UrlRow({ link, onEdit, onDelete, onDeleteTap, onManagePin, onShowQr, }: LinkItemProps) { const weekTotal = link.last7Days.reduce((s, d) => s + d.count, 0); return (
{/* identity */}

{shortUrl(link.code)}

{link.hasPin && }

→ {prettyHost(link.longUrl)}

{/* stats */}

{compactNumber(link.totalClicks)} {weekTotal > 0 && ( +{compactNumber(weekTotal)} )}

{/* actions */}
onDelete(link)} onTap={onDeleteTap} className="h-8 w-8 rounded-lg hover:bg-surface-2" />
); }