Skip to content

Commit 71fdd43

Browse files
authored
Merge pull request #3523 from ava-labs/fix/mobile-nav-explorer-sync
fix: add Explorer to mobile nav and sync with desktop navigation
2 parents fc1c201 + 788b722 commit 71fdd43

File tree

2 files changed

+122
-59
lines changed

2 files changed

+122
-59
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/**
2+
* Shared navigation configuration - Single Source of Truth
3+
*
4+
* This file defines navigation items in a simple format that can be used by:
5+
* - Mobile dropdown (navbar-dropdown.tsx)
6+
* - Desktop nav (via transformation to fumadocs format in layout.config.tsx)
7+
*
8+
* IMPORTANT: When adding/removing nav items, update this file ONLY.
9+
* Both mobile and desktop navigation will automatically sync.
10+
*/
11+
12+
export interface NavItem {
13+
text: string;
14+
href: string;
15+
external?: boolean;
16+
}
17+
18+
export interface NavSection {
19+
title: string;
20+
href: string;
21+
items: NavItem[];
22+
}
23+
24+
/**
25+
* Navigation sections with dropdown menus
26+
* These appear as expandable sections in mobile and dropdown menus on desktop
27+
*/
28+
export const menuSections: NavSection[] = [
29+
{
30+
title: 'Academy',
31+
href: '/academy',
32+
items: [
33+
{ text: 'Avalanche L1 Academy', href: '/academy?path=avalanche-l1' },
34+
{ text: 'Entrepreneur Academy', href: '/academy?path=entrepreneur' },
35+
{ text: 'Blockchain Academy', href: '/academy?path=blockchain' },
36+
],
37+
},
38+
{
39+
title: 'Documentation',
40+
href: '/docs/primary-network',
41+
items: [
42+
{ text: 'Primary Network', href: '/docs/primary-network' },
43+
{ text: 'Node RPCs', href: '/docs/rpcs/c-chain' },
44+
{ text: 'Data APIs', href: '/docs/api-reference/data-api' },
45+
{ text: 'ACPs', href: '/docs/acps' },
46+
{ text: 'Developer Tools', href: '/docs/tooling' },
47+
],
48+
},
49+
{
50+
title: 'Console',
51+
href: '/console',
52+
items: [
53+
{ text: 'Console', href: '/console' },
54+
{ text: 'Interchain Messaging Tools', href: '/console/icm/setup' },
55+
{ text: 'Interchain Token Transfer Tools', href: '/console/ictt/setup' },
56+
{ text: 'Testnet Faucet', href: '/console/primary-network/faucet' },
57+
],
58+
},
59+
{
60+
title: 'Events',
61+
href: '/hackathons',
62+
items: [
63+
{ text: 'Hackathons', href: '/hackathons' },
64+
{ text: 'Avalanche Calendar', href: 'https://lu.ma/calendar/cal-Igl2DB6quhzn7Z4', external: true },
65+
{ text: 'Community Driven Events', href: 'https://lu.ma/Team1?utm_source=builder_hub', external: true },
66+
{ text: 'Campus Connect', href: '/university' },
67+
],
68+
},
69+
{
70+
title: 'Grants',
71+
href: '/grants',
72+
items: [
73+
{ text: 'Codebase', href: '/codebase' },
74+
{ text: 'InfraBUIDL', href: '/grants/infrabuidl' },
75+
{ text: 'InfraBUIDL (AI)', href: '/grants/infrabuidlai' },
76+
{ text: 'Retro9000', href: 'https://retro9000.avax.network', external: true },
77+
{ text: 'Blizzard Fund', href: 'https://www.blizzard.fund/', external: true },
78+
],
79+
},
80+
{
81+
title: 'Blog',
82+
href: '/guides',
83+
items: [
84+
{ text: 'Latest Articles', href: '/guides' },
85+
{ text: 'Browse All Posts', href: '/guides' },
86+
],
87+
},
88+
{
89+
title: 'Stats',
90+
href: '/stats/overview',
91+
items: [
92+
{ text: 'Playground', href: '/stats/playground' },
93+
{ text: 'Avalanche L1s', href: '/stats/overview' },
94+
{ text: 'C-Chain', href: '/stats/l1/c-chain' },
95+
{ text: 'Primary Network Validators', href: '/stats/validators' },
96+
],
97+
},
98+
{
99+
title: 'Integrations',
100+
href: '/integrations',
101+
items: [
102+
{ text: 'Wallet SDKs', href: '/integrations#Wallet%20SDKs' },
103+
{ text: 'Block Explorers', href: '/integrations#Block%20Explorers' },
104+
{ text: 'Blockchain-as-a-Service', href: '/integrations#Blockchain%20as%20a%20Service' },
105+
{ text: 'Data Feeds', href: '/integrations#Data%20Feeds' },
106+
{ text: 'Indexers', href: '/integrations#Indexers' },
107+
{ text: 'Browse All Integrations', href: '/integrations' },
108+
],
109+
},
110+
];
111+
112+
/**
113+
* Single navigation items (no dropdown)
114+
* These appear as simple links in both mobile and desktop navigation
115+
*/
116+
export const singleItems: NavItem[] = [
117+
{ text: 'Explorer', href: '/explorer' },
118+
];

components/navigation/navbar-dropdown.tsx

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import { useEffect, useRef, useState } from 'react';
44
import { usePathname } from 'next/navigation';
55
import Link from 'next/link';
66
import { ChevronDown, CircleUserRound, Moon, Sun } from 'lucide-react';
7+
import { menuSections, singleItems } from './nav-config';
78

89
/**
910
* Custom navbar dropdown menu for tablet/mobile breakpoints (≤1023px)
1011
* Replaces fumadocs' default dropdown to ensure all menu items are visible
12+
*
13+
* IMPORTANT: Navigation items are defined in nav-config.ts (Single Source of Truth)
14+
* Do NOT add navigation items here - update nav-config.ts instead.
1115
*/
1216
export function NavbarDropdown() {
1317
const [isOpen, setIsOpen] = useState(false);
@@ -36,65 +40,6 @@ export function NavbarDropdown() {
3640
};
3741
}, [isOpen]);
3842

39-
const menuSections = [
40-
{
41-
title: 'Academy',
42-
href: '/academy',
43-
items: [
44-
{ text: 'Avalanche L1 Academy', href: '/academy' },
45-
{ text: 'Blockchain Academy', href: '/academy' },
46-
{ text: 'Entrepreneur Academy', href: '/academy' },
47-
],
48-
},
49-
{
50-
title: 'Documentation',
51-
href: '/docs/primary-network',
52-
items: [
53-
{ text: 'Primary Network', href: '/docs/primary-network' },
54-
{ text: 'Avalanche L1s', href: '/docs/avalanche-l1s' },
55-
{ text: 'Nodes & Validators', href: '/docs/nodes' },
56-
{ text: 'Interoperability', href: '/docs/cross-chain' },
57-
],
58-
},
59-
{
60-
title: 'Console',
61-
href: '/console',
62-
items: [
63-
{ text: 'Console', href: '/console' },
64-
{ text: 'Interchain Messaging Tools', href: '/console/icm/setup' },
65-
{ text: 'Interchain Token Transfer Tools', href: '/console/ictt/setup' },
66-
{ text: 'Testnet Faucet', href: '/console/primary-network/faucet' },
67-
],
68-
},
69-
{
70-
title: 'Events',
71-
href: '/hackathons',
72-
items: [
73-
{ text: 'Hackathons', href: '/hackathons' },
74-
{ text: 'Avalanche Calendar', href: 'https://lu.ma/calendar/cal-Igl2DB6quhzn7Z4', external: true },
75-
{ text: 'Community Driven Events', href: 'https://lu.ma/Team1?utm_source=builder_hub', external: true },
76-
],
77-
},
78-
{
79-
title: 'Grants',
80-
href: '/grants',
81-
items: [
82-
{ text: 'Codebase', href: '/codebase' },
83-
{ text: 'InfraBUIDL', href: '/grants/infrabuidl' },
84-
{ text: 'InfraBUIDL (AI)', href: '/grants/infrabuidlai' },
85-
{ text: 'Retro9000', href: 'https://retro9000.avax.network', external: true },
86-
{ text: 'Blizzard Fund', href: 'https://www.blizzard.fund/', external: true },
87-
],
88-
},
89-
];
90-
91-
const singleItems = [
92-
{ text: 'University', href: '/university' },
93-
{ text: 'Integrations', href: '/integrations' },
94-
{ text: 'Blog', href: '/guides' },
95-
{ text: 'Stats', href: '/stats/overview' },
96-
];
97-
9843
return (
9944
<div className="relative" data-navbar-dropdown ref={dropdownRef}>
10045
{/* Dropdown trigger */}

0 commit comments

Comments
 (0)