import { useState, useEffect } from "react"; import { Eye, EyeOff, Copy, Check } from "lucide-react"; import Box from "../components/Box.tsx"; import { getUser } from "../utils/api/users.ts"; import type { User } from "../utils/types.ts"; import { formatLocalDate } from "../utils/utils.ts"; const Profile = () => { const [user, setUser] = useState(null); const [keyVisible, setKeyVisible] = useState(false); const [copied, setCopied] = useState(false); useEffect(() => { getUser().then(setUser).catch(console.error); }, []); const handleCopy = () => { if (!user?.streamKey) return; navigator.clipboard.writeText(user.streamKey); setCopied(true); setTimeout(() => setCopied(false), 2000); }; if (!user) { return (
Please log in to view your profile.
); } return (

Profile

Profile picture

{user.name}

@{user.username}

{user.email}

Member since {formatLocalDate(user.createdAt)}

Stream Key

Use this key in OBS or any RTMP-compatible software to start streaming. Keep it private — anyone with this key can stream to your account.

{keyVisible ? user.streamKey : "•".repeat(user.streamKey.length)}
); }; export default Profile;