From 4bed70f68097466a738f3efedefe8e85506a7052 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 May 2024 11:13:22 +0300 Subject: [PATCH] explorer: link network select to appStore --- .../__snapshots__/Navbar.spec.js.snap | 4 +-- explorer/src/lib/components/navbar/Navbar.css | 1 + .../src/lib/components/navbar/Navbar.svelte | 28 +++++++++++-------- .../statistics-panel/StatisticsPanel.svelte | 5 +++- explorer/src/routes/+page.svelte | 7 +++-- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/explorer/src/lib/components/__tests__/__snapshots__/Navbar.spec.js.snap b/explorer/src/lib/components/__tests__/__snapshots__/Navbar.spec.js.snap index db01359ef..af8d5d09e 100644 --- a/explorer/src/lib/components/__tests__/__snapshots__/Navbar.spec.js.snap +++ b/explorer/src/lib/components/__tests__/__snapshots__/Navbar.spec.js.snap @@ -52,13 +52,13 @@ exports[`Navbar > renders the Navbar component 1`] = ` diff --git a/explorer/src/lib/components/navbar/Navbar.css b/explorer/src/lib/components/navbar/Navbar.css index 054e9dd2a..caafb1a52 100644 --- a/explorer/src/lib/components/navbar/Navbar.css +++ b/explorer/src/lib/components/navbar/Navbar.css @@ -58,6 +58,7 @@ .dusk-navbar__menu--network { order: 3; + text-transform: uppercase; } .dusk-navbar__menu--network select { diff --git a/explorer/src/lib/components/navbar/Navbar.svelte b/explorer/src/lib/components/navbar/Navbar.svelte index f08c30203..06a608593 100644 --- a/explorer/src/lib/components/navbar/Navbar.svelte +++ b/explorer/src/lib/components/navbar/Navbar.svelte @@ -6,6 +6,7 @@ import { Button, NavList, Select } from "$lib/dusk/components"; import { AppAnchor, AppImage, SearchNotification } from "$lib/components"; import { SearchField } from "$lib/containers"; + import { appStore } from "$lib/stores"; import "./Navbar.css"; @@ -36,17 +37,6 @@ }, ]; - const networks = [ - { - label: "testnet", - value: `${import.meta.env.VITE_DUSK_TESTNET_NODE}`, - }, - { - label: "devnet", - value: `${import.meta.env.VITE_DUSK_DEVNET_NODE}`, - }, - ]; - const dispatch = createEventDispatcher(); async function createEmptySpace() { @@ -56,10 +46,20 @@ )[0]?.clientHeight; } + /** + * @param {Event} e + */ + function handleChange(e) { + // @ts-ignore + appStore.setNetwork(e.target.value); + } + afterNavigate(() => { hidden = true; showSearchNotification = false; }); + + $: ({ networks } = $appStore);