"use client"; import { useEffect, useRef, useState } from "react"; import { contact } from "@/lib/portfolio"; type CopyTarget = "email"; type CopyStatus = "idle" | "copied" | "failed"; const rows = [ { label: "EMAIL", value: contact.email, kind: "copy" as const, target: "email" as CopyTarget }, { label: "GIT", value: contact.git, kind: "link" as const }, { label: "LINKEDIN", value: contact.linkedIn, kind: "link" as const }, ]; export function ContactTerminal() { const [copyState, setCopyState] = useState>({ email: "idle", }); const resetTimers = useRef>>>({}); useEffect(() => { const timers = resetTimers.current; return () => { Object.values(timers).forEach((timer) => { if (timer) { clearTimeout(timer); } }); }; }, []); async function copyValue(target: CopyTarget, value: string) { if (resetTimers.current[target]) { clearTimeout(resetTimers.current[target]); } try { await navigator.clipboard.writeText(value); setCopyState((current) => ({ ...current, [target]: "copied" })); } catch { setCopyState((current) => ({ ...current, [target]: "failed" })); } resetTimers.current[target] = setTimeout(() => { setCopyState((current) => ({ ...current, [target]: "idle" })); }, 2000); } return (

CONTACT /.07

Send signal.

{rows.map((row) => (

{row.label}

{row.kind === "copy" ? ( ) : ( {row.value} )}
))}
); }