import type { RelayClientDeviceRecord } from "@t3tools/contracts/relay"; import { SmartphoneIcon } from "lucide-react"; import { useManagedRelayDevices } from "../../cloud/managedRelayState"; import { Badge } from "../ui/badge"; import { Button } from "../ui/button"; import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty"; import { Skeleton } from "../ui/skeleton"; import { mobileClientNotificationDetail, mobileClientPlatformLabel, mobileClientUpdatedAtLabel, } from "./MobileClientsUserProfilePage.logic"; import { ClerkUserProfilePage, ClerkUserProfileRefreshButton, ClerkUserProfileRow, } from "./ClerkUserProfilePage"; const MOBILE_CLIENT_SKELETON_ROWS = ["primary", "secondary"] as const; function MobileClientStatusBadge({ enabled, label, }: { readonly enabled: boolean; readonly label: string; }) { return ( {label}: {enabled ? "On" : "Off"} ); } function MobileClientRow({ device }: { readonly device: RelayClientDeviceRecord }) { return ( }>

{device.label}

{mobileClientPlatformLabel(device)}

{mobileClientUpdatedAtLabel(device.updatedAt)}

{mobileClientNotificationDetail(device)}

); } function MobileClientsSkeleton() { return (
{MOBILE_CLIENT_SKELETON_ROWS.map((row) => (
))}
); } function EmptyMobileClients() { return ( No mobile clients Sign in to T3 Code on your iPhone to register it for push notifications and Live Activities. ); } export function MobileClientsUserProfilePage() { const devicesState = useManagedRelayDevices(); const devices = devicesState.data ?? []; const isInitialLoad = !devicesState.accountId || (devicesState.data === null && !devicesState.error); const hasErrorWithoutData = devicesState.error !== null && devicesState.data === null; return ( } >
{devicesState.error ? (

Could not load mobile clients

{devicesState.error}

) : null} {isInitialLoad ? ( ) : hasErrorWithoutData ? null : devices.length > 0 ? (
    {devices.map((device) => ( ))}
) : ( )}
); }