11"use client" ;
22
3+ import { usePathname } from "next/navigation" ;
34import type { ReactNode } from "react" ;
5+ import { useMemo } from "react" ;
46import { baseOptions } from "@/app/layout.config" ;
57import {
68 ArbitrumIcon ,
@@ -21,67 +23,87 @@ interface DocsLayoutClientProps {
2123
2224export function DocsLayoutClient ( { children } : DocsLayoutClientProps ) {
2325 const currentTree = useNavigationTree ( ) ;
26+ const pathname = usePathname ( ) ;
27+
28+ // Determine if shared paths should be included in Stellar tab based on sessionStorage
29+ const tabs = useMemo ( ( ) => {
30+ const isSharedPath =
31+ pathname . startsWith ( "/monitor" ) || pathname . startsWith ( "/relayer" ) ;
32+ const lastEcosystem =
33+ typeof window !== "undefined"
34+ ? sessionStorage . getItem ( "lastEcosystem" )
35+ : null ;
36+
37+ // Include shared paths in Stellar tab only if coming from Stellar context
38+ const stellarUrls =
39+ isSharedPath && lastEcosystem === "stellar"
40+ ? new Set ( [ "/stellar-contracts" , "/monitor" , "/relayer" ] )
41+ : new Set ( [ "/stellar-contracts" ] ) ;
42+
43+ return [
44+ {
45+ title : "Ethereum & EVM" ,
46+ url : "/contracts" ,
47+ icon : < EthereumIcon className = "w-5 h-5" /> ,
48+ urls : new Set ( [
49+ "/contracts" ,
50+ "/community-contracts" ,
51+ "/upgrades-plugins" ,
52+ "/wizard" ,
53+ "/relayer" ,
54+ "/monitor" ,
55+ "/ui-builder" ,
56+ "/upgrades" ,
57+ "/defender" ,
58+ "/tools" ,
59+ ] ) ,
60+ } ,
61+ {
62+ title : "Arbitrum Stylus" ,
63+ url : "/contracts-stylus" ,
64+ icon : < ArbitrumIcon className = "w-5 h-5" /> ,
65+ } ,
66+ {
67+ title : "Starknet" ,
68+ url : "/contracts-cairo" ,
69+ icon : < StarknetIcon className = "w-5 h-5" /> ,
70+ } ,
71+ {
72+ title : "Stellar" ,
73+ url : "/stellar-contracts" ,
74+ icon : < StellarIcon className = "w-5 h-5" /> ,
75+ urls : stellarUrls ,
76+ } ,
77+ {
78+ title : "Midnight" ,
79+ url : "/contracts-compact" ,
80+ icon : < MidnightIcon className = "w-5 h-5" /> ,
81+ } ,
82+ {
83+ title : "Polkadot" ,
84+ url : "/substrate-runtimes" ,
85+ icon : < PolkadotIcon className = "w-5 h-5" /> ,
86+ } ,
87+ {
88+ title : "Uniswap Hooks" ,
89+ url : "/uniswap-hooks" ,
90+ icon : < UniswapIcon className = "w-5 h-5" /> ,
91+ } ,
92+ {
93+ title : "Zama FHEVM" ,
94+ url : "/confidential-contracts" ,
95+ icon : < ZamaIcon className = "w-5 h-5" /> ,
96+ } ,
97+ ] ;
98+ } , [ pathname ] ) ;
2499
25100 return (
26101 < DocsLayout
27102 tree = { currentTree }
28103 nav = { { ...baseOptions , mode : "top" , transparentMode : "none" } }
29104 { ...baseOptions }
30105 sidebar = { {
31- tabs : [
32- {
33- title : "Ethereum & EVM" ,
34- url : "/contracts" ,
35- icon : < EthereumIcon className = "w-5 h-5" /> ,
36- urls : new Set ( [
37- "/contracts" ,
38- "/community-contracts" ,
39- "/upgrades-plugins" ,
40- "/wizard" ,
41- "/relayer" ,
42- "/monitor" ,
43- "/ui-builder" ,
44- "/upgrades" ,
45- "/defender" ,
46- "/tools" ,
47- ] ) ,
48- } ,
49- {
50- title : "Arbitrum Stylus" ,
51- url : "/contracts-stylus" ,
52- icon : < ArbitrumIcon className = "w-5 h-5" /> ,
53- } ,
54- {
55- title : "Starknet" ,
56- url : "/contracts-cairo" ,
57- icon : < StarknetIcon className = "w-5 h-5" /> ,
58- } ,
59- {
60- title : "Stellar" ,
61- url : "/stellar-contracts" ,
62- icon : < StellarIcon className = "w-5 h-5" /> ,
63- } ,
64- {
65- title : "Midnight" ,
66- url : "/contracts-compact" ,
67- icon : < MidnightIcon className = "w-5 h-5" /> ,
68- } ,
69- {
70- title : "Polkadot" ,
71- url : "/substrate-runtimes" ,
72- icon : < PolkadotIcon className = "w-5 h-5" /> ,
73- } ,
74- {
75- title : "Uniswap Hooks" ,
76- url : "/uniswap-hooks" ,
77- icon : < UniswapIcon className = "w-5 h-5" /> ,
78- } ,
79- {
80- title : "Zama FHEVM" ,
81- url : "/confidential-contracts" ,
82- icon : < ZamaIcon className = "w-5 h-5" /> ,
83- } ,
84- ] ,
106+ tabs,
85107 } }
86108 >
87109 { children }
0 commit comments