"use client"; import React, { useEffect } from "react"; import LazyLoadedImage from "./lazyLoadedImage"; import { Alert, AlertDescription, AlertTitle } from "./ui/alert"; import { OctagonXIcon } from "lucide-react"; import { RobloxPremiumSmall, RobloxVerifiedSmall } from "./RobloxTooltipStuff"; import { useCurrentAccount } from "@/hooks/roblox/useCurrentAccount"; import { Skeleton } from "./ui/skeleton"; import { useFriendsPresence } from "@/hooks/roblox/usePresence"; export function HomeLoggedInHeader() { const profile = useCurrentAccount(); if (profile === false) { return (
Failed to fetch account info Please make sure .ROBLOSECURITY is set! Is Roblox having an outage?
); } const presence = useFriendsPresence(profile ? [profile.id] : []); const userActivity = presence.find((b) => b.userId === profile?.id) const userPresence = userActivity?.userPresenceType; const borderColor = userPresence === 1 ? "border-blue bg-blue/50" : userPresence === 2 ? "border-green bg-green/50" : userPresence === 3 ? "border-yellow bg-yellow/50" : userPresence === 0 ? "border-surface2 bg-surface2/50" : "border-red bg-red/50"; return ( <> {/* */}
{!profile ? ( ) : ( )}
{profile ? ( <>Hello, {profile.displayName} ) : ( <> )} {/* TODO: Fetch the User's Roblox Premium subscription state */} {profile ? ( <> @{profile.name} {(!!userActivity && userPresence === 2) ? <> - {userActivity.lastLocation} : <> } ) : ( )}
); }