11"use client" ;
22
3- import { LoaderIcon } from "lucide-react" ;
3+ import { BadgeCheckIcon , LoaderIcon } from "lucide-react" ;
44import Link from "next/link" ;
5- import { usePathname } from "next/navigation" ;
5+ import { useParams , usePathname } from "next/navigation" ;
6+ import { Address } from "viem" ;
7+ import { useChain } from "../app/(explorer)/hooks/useChain" ;
68import { useReadOnly } from "../app/(explorer)/hooks/useReadOnly" ;
79import { useWorldUrl } from "../app/(explorer)/hooks/useWorldUrl" ;
810import { useWorldAbiQuery } from "../app/(explorer)/queries/useWorldAbiQuery" ;
11+ import { useVerifiedWorldsQuery } from "../app/(explorer)/queries/useWorldsQuery" ;
912import { LatestBlock } from "../components/LatestBlock" ;
1013import { Separator } from "../components/ui/Separator" ;
1114import { cn } from "../utils" ;
1215import { ChainSwitch } from "./ChainSwitch" ;
1316import { ConnectButton } from "./ConnectButton" ;
17+ import { CopyButton } from "./CopyButton" ;
18+ import { TruncatedHex } from "./ui/TruncatedHex" ;
1419
1520function NavigationLink ( { href, children } : { href : string ; children : React . ReactNode } ) {
1621 const pathname = usePathname ( ) ;
@@ -32,6 +37,28 @@ function NavigationLink({ href, children }: { href: string; children: React.Reac
3237 ) ;
3338}
3439
40+ function WorldTitle ( ) {
41+ const chain = useChain ( ) ;
42+ const { worldAddress } = useParams < { worldAddress : Address } > ( ) ;
43+ const { data : verifiedWorlds } = useVerifiedWorldsQuery ( chain ) ;
44+ const verifiedWorld = verifiedWorlds ?. get ( worldAddress ) ;
45+
46+ return (
47+ < div className = "flex items-center gap-x-2 text-sm" >
48+ < span className = "mx-2 opacity-30" > |</ span >
49+ { verifiedWorld && (
50+ < span className = "flex items-center gap-x-2 text-sm font-semibold" >
51+ { verifiedWorld } < BadgeCheckIcon className = "h-4 w-4 text-green-500" />
52+ </ span >
53+ ) }
54+ < span className = "text-white/70" >
55+ < TruncatedHex hex = { worldAddress } />
56+ </ span >
57+ < CopyButton value = { worldAddress } />
58+ </ div >
59+ ) ;
60+ }
61+
3562export function Navigation ( ) {
3663 const isReadOnly = useReadOnly ( ) ;
3764 const { data, isFetched } = useWorldAbiQuery ( ) ;
@@ -44,6 +71,7 @@ export function Navigation() {
4471 { ! isReadOnly && < NavigationLink href = "interact" > Interact</ NavigationLink > }
4572 < NavigationLink href = "observe" > Observe</ NavigationLink >
4673 < NavigationLink href = "decode" > Decode</ NavigationLink >
74+ < WorldTitle />
4775 </ div >
4876
4977 { isFetched && ! data ?. isWorldDeployed && (
0 commit comments