import { issueStateTone } from "~/ui/tones"; import { useHovercards } from "~/hooks/use-hovercards"; import type { HovercardProfile } from "~/hooks/use-hovercards"; import { Avatar } from "~/ui/Avatar"; import { Badge } from "~/ui/Badge"; import { panelClass } from "~/ui/Panel"; const JOINED_FORMAT = new Intl.DateTimeFormat(undefined, { month: "short", year: "numeric" }); function ProfileStats({ profile }: { profile: HovercardProfile }) { const stats = [ { label: profile.followers === 1 ? "follower" : "followers", value: profile.followers }, { label: profile.repos === 1 ? "repository" : "repositories", value: profile.repos }, ]; return (
{stats.map((stat) => ( {stat.value} {stat.label} ))} Joined {JOINED_FORMAT.format(profile.joinedAt)}
); } /** Floating preview for issue, user, team and commit references; mount once near the app root. */ export function HovercardLayer() { const state = useHovercards(); if (!state) return null; const { card } = state; return (
{card.profile ? (

{card.title}

{card.subtitle}

) : ( <>

{card.subtitle}

{card.title}

)} {card.state && {card.state}} {card.body &&

{card.body}

} {card.profile?.website &&

{card.profile.website}

} {card.profile && }
); }