Skip to content

Commit

Permalink
feat: rewrite nav as TS instead of HTML (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenFluin authored Nov 11, 2023
1 parent ea65a9a commit 2d88010
Show file tree
Hide file tree
Showing 3 changed files with 355 additions and 232 deletions.
277 changes: 45 additions & 232 deletions src/layouts/Navigation.astro
Original file line number Diff line number Diff line change
@@ -1,241 +1,54 @@
---
import { getNavigation } from "./navigation.ts";
const section = Astro.url.pathname?.match(/\/([^\/]*)\//)?.[1];
const navigation = getNavigation(section);
// #TODO rewrite this more functionally
// Right now it supports 2 layers of nesting via nested ifs
// Due to limitations in Astro template syntax
---

<div class="mobile nav-header">
<a href="/dev/intro">Developers</a>
<a href="/node/config-node">Node Operators</a>
<a href="/validator/setup/overview">Validators</a>
<hr>
<a href="/dev/intro">Developers</a>
<a href="/node/config-node">Node Operators</a>
<a href="/validator/setup/overview">Validators</a>
<hr />
</div>

{
section == "dev" && (
<div>
<div class="nav-header">Developers</div>
<a href="/dev/intro">Introduction</a>
<span>Send Tokens</span>
<div class="group">
<a href="/dev/send-tokens/overview">Overview</a>
<a href="/dev/send-tokens/interchain-tokens">
Interchain Tokens
</a>
</div>
<span>General Message Passing</span>
<div class="group">
<a href="/dev/general-message-passing/overview">Overview</a>
<a href="/dev/general-message-passing/local-dev">
Local Development
</a>
<a href="/dev/general-message-passing/examples">Examples</a>
<a href="/dev/general-message-passing/gmp-messages">
Send Messages
</a>
<a href="/dev/general-message-passing/gmp-tokens-with-messages">
Send Messages with Tokens
</a>
<span>Gas Services</span>
<div class="group">
<a href="/dev/general-message-passing/gas-services/intro">
Introduction
</a>
<a href="/dev/general-message-passing/gas-services/pay-gas">
Pay Gas
</a>
<a href="/dev/general-message-passing/gas-services/increase-gas">
Increase Gas
</a>
<a href="/dev/general-message-passing/gas-services/refund">
Refund
</a>
</div>
<span>Debugging</span>
<div class="group">
<a href="/dev/general-message-passing/debug/error-debugging">
Error messages
</a>
<a href="/dev/general-message-passing/debug/debugging-your-smart-contract">
Smart Contract
</a>
<a href="/dev/general-message-passing/debug/fork-mainnet">
Forking Mainnet
</a>
</div>
<a href="/dev/general-message-passing/recovery">Recovery</a>
<a href="/dev/general-message-passing/monitoring">Monitoring</a>
<a href="/dev/general-message-passing/solidity-utilities">
Solidity Utilities
</a>
<a href="/dev/general-message-passing/axelar-sandbox/intro">
Sandbox
</a>
<a href="/dev/general-message-passing/cosmos-gmp">Cosmos GMP</a>
<a href="/dev/general-message-passing/example-usdc-cctp">
USDC CCTP
</a>
</div>
<span>AxelarJS SDK</span>
<div class="group">
<a href="/dev/axelarjs-sdk/intro">Introduction</a>
<a href="/dev/axelarjs-sdk/token-transfer-dep-addr">
Token Transfer via Deposit Address
</a>
<a href="/dev/axelarjs-sdk/tx-status-query-recovery">
GMP transaction status and recovery
</a>
<a href="/dev/axelarjs-sdk/axelar-query-api">
Axelar Query API
</a>
</div>
<span>Reference</span>
<div class="group">
<a href="/dev/reference/mainnet-chain-names">
Mainnet Chain Names
</a>
<a href="/dev/reference/mainnet-contract-addresses">
Mainnet Contract Addresses
</a>
<a href="/dev/reference/testnet-chain-names">
Testnet Chain Names
</a>
<a href="/dev/reference/testnet-contract-addresses">
Testnet Contract Addresses
</a>
<a href="/dev/reference/pricing">Transaction Pricing</a>
<a href="/dev/reference/glossary">Glossary</a>
</div>
</div>
)
}
{
section == "node" && (
<div>
<div class="nav-header">Node Operators</div>
<a href="/node/config-node">Node configuration</a>
<a href="/node/join">Quick sync</a>
<a href="/node/join-genesis">Genesis sync</a>
<a href="/node/basic">Basic node management</a>
<a href="/node/config-cli">CLI configuration</a>
<a href="/node/keyring">Keyring backend</a>
</div>
)
}
{
section == "learn" && (
<div>
<div class="nav-header">Learn</div>
</div>
)
}
{
section == "validator" && (
<div>
<div class="nav-header">Validators</div>
<span>Setup</span>
<div class="group">
<a href="/validator/setup/overview">Overview</a>
<a href="/validator/setup/config">
Configure companion processes
</a>
<a href="/validator/setup/backup">Create and backup accounts</a>
<a href="/validator/setup/vald-tofnd">
Launch companion processes
</a>
<a href="/validator/setup/register-broadcaster">
Register broadcaster proxy
</a>
<a href="/validator/setup/stake-axl">Stake AXL tokens</a>
<a href="/validator/setup/health-check">Health check</a>
<a href="/validator/setup/manual">Manual setup</a>
</div>
<span>Support External Chains</span>
<div class="group">
<a href="/validator/external-chains/overview">Overview</a>
<a href="/validator/external-chains/arbitrum">Arbitrum</a>
<a href="/validator/external-chains/avalanche">Avalanche</a>
<a href="/validator/external-chains/base">Base</a>
<a href="/validator/external-chains/binance">Binance</a>
<a href="/validator/external-chains/celo">Celo</a>
<a href="/validator/external-chains/centrifuge">Centrifuge</a>
<a href="/validator/external-chains/ethereum">Ethereum</a>
<a href="/validator/external-chains/fantom">Fantom</a>
<a href="/validator/external-chains/filecoin">Filecoin</a>
<a href="/validator/external-chains/kava">Kava</a>
<a href="/validator/external-chains/linea">Linea</a>
<a href="/validator/external-chains/mantle">Mantle</a>
<a href="/validator/external-chains/moonbeam">Moonbeam</a>
<a href="/validator/external-chains/optimism">Optimism</a>
<a href="/validator/external-chains/polygon">Polygon</a>
<a href="/validator/external-chains/scroll">Scroll</a>
<a href="/validator/external-chains/aurora">Aurora</a>
<a href="/validator/external-chains/hero">Hero</a>
</div>
<span>Operations</span>
<div class="group">
<a href="/validator/operations/mnemonic-rotation">
Rotating mnemonics
</a>
<a href="/validator/operations/monitoring">Monitoring</a>
</div>
<span>Troubleshoot</span>
<div class="group">
<a href="/validator/troubleshoot/startup">Start-up issues</a>
<a href="/validator/troubleshoot/missed-too-many-blocks">Missed too many blocks</a>
<a href="/validator/troubleshoot/unjail">Unjail your validator</a>
<a href="/validator/troubleshoot/leave">Leave the network</a>
</div>
</div>
)
}
{
section == "resources" && (
<div>
<div class="nav-header">Resources</div>
</div>
)
}
{
!section && (
<div>
<div class="nav-header">Docs</div>
</div>
)
}
<div>
{section != "resources" && <span>Resources</span>}
<div class="group">
<a href="/resources/">Resources</a>
<a href="/resources/mainnet">Mainnet</a>
<a href="/resources/testnet">Testnet</a>
<a href="/resources/governance/community-pool-proposals"
>Community Pool Proposals</a
>
<a href="/resources/satellite">Satellite</a>
<a href="/resources/metamask">Metamask</a>
<a href="/resources/keplr">Add Network to Keplr Wallet</a>
<a href="/resources/wrapped-tokens">Wrap/unwrap tokens</a>
<a href="/resources/lava-iprpc">Using ipRPC (Free Public RPC)</a>
<a href="/bug-bounty">Bug Bounty</a>
</div>

<span>Learn more about Axelar</span>
<div class="group">
<a href="/learn/network/flow">Crosschain Message Flow</a>
<a href="/learn/axlusdc">axlUSDC</a>
<a href="/learn/validators"
>Registering external chains for validators</a
>
<a href="/learn/security">Security Overview</a>
<a href="/learn/txduration">Interchain Transaction Duration</a>

<span>CLI</span>
<div class="group">
<a href="/learn/cli/">Introduction</a>
<a href="/learn/cli/reference">Reference</a>
<a href="/learn/cli/ust-to-evm">Send UST to an EVM chain</a>
<a href="/learn/cli/ust-from-evm">Redeem UST from an EVM chain</a>
<a href="/learn/cli/axl-to-evm">Send AXL to an EVM chain</a>
<a href="/learn/cli/axl-from-evm">Redeem AXL from an EVM chain</a>
</div>
navigation.map((section) => (
<div>
<div class="nav-header">{section.header}</div>
{section.children.map((item) =>
item.children ? (
<span>{item.title}</span>
<div class="group">
{item.children.map((child) =>
child.children ? (
<span>{child.title}</span>
<div class="group">
{child.children.map((grandchild) => (
grandchild.children ? (
<span>{grandchild.title}</span>
<div class="group">
{grandchild.children.map((greatGrandchild) => (
<a href={greatGrandchild.href}>{greatGrandchild.title}</a>
))}
</div>
) : (
<a href={grandchild.href}>{grandchild.title}</a>
)
))}
</div>
) : (
<a href={child.href}>{child.title}</a>
)
)}
</div>
) : (
<a href={item.href}>{item.title}</a>
)
)}
</div>
</div>
))
}
Loading

1 comment on commit 2d88010

@vercel
Copy link

@vercel vercel bot commented on 2d88010 Nov 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.