import Relay from '@/components/Relay' import PrimaryPageLayout from '@/layouts/PrimaryPageLayout' import { normalizeUrl, simplifyUrl } from '@/lib/url' import { useRelayAdmin } from '@/providers/RelayAdminProvider' import { TPageRef } from '@/types' import { Server, Shield } from 'lucide-react' import { forwardRef, lazy, Suspense, useMemo } from 'react' const RelayAdminPanel = lazy(() => import('./admin')) const RelayPage = forwardRef(({ url }: { url?: string }, ref) => { const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url]) const { isEmbedded, isAdmin, isLoading } = useRelayAdmin() const showAdmin = isEmbedded && isAdmin && !normalizedUrl return ( } displayScrollToTopButton ref={ref} > {normalizedUrl ? ( ) : showAdmin ? ( Loading admin... } > ) : isEmbedded && !isLoading ? (
Log in as admin to access relay management.
) : (
Select a relay to view its information.
)}
) }) RelayPage.displayName = 'RelayPage' export default RelayPage function RelayPageTitlebar({ url, showAdmin }: { url?: string; showAdmin?: boolean }) { return (
{showAdmin ? : }
{showAdmin ? 'Relay Admin' : simplifyUrl(url ?? '')}
) }