mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Fix and optimize navigation
This commit is contained in:
parent
678e193ba0
commit
98fea9aa3a
5 changed files with 39 additions and 43 deletions
|
@ -1,23 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { navs } from './navs';
|
import { adminNavs } from './navs';
|
||||||
import { getDrawerStore } from '@skeletonlabs/skeleton';
|
import { getDrawerStore } from '@skeletonlabs/skeleton';
|
||||||
|
|
||||||
const drawerStore = getDrawerStore();
|
const drawerStore = getDrawerStore();
|
||||||
|
$: style = (/** @type {string} */ href) =>
|
||||||
function drawerClose() {
|
|
||||||
drawerStore.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
$: classesActive = (/** @type {string} */ href) =>
|
|
||||||
$page.url.pathname.startsWith(href) ? 'bg-primary-500' : '';
|
$page.url.pathname.startsWith(href) ? 'bg-primary-500' : '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="list-nav p-4">
|
<nav class="list-nav p-4">
|
||||||
<ul>
|
<ul>
|
||||||
{#each navs as nav}
|
{#each adminNavs as nav}
|
||||||
<li>
|
<li>
|
||||||
<a href={nav.path} class={classesActive(nav.path)} on:click={drawerClose}>{nav.name}</a>
|
<a href={nav.path} class={style(nav.path)} on:click={() => drawerStore.close()}
|
||||||
|
>{nav.name}</a
|
||||||
|
>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { navs } from './navs';
|
import { adminNavs } from './navs';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<aside
|
<aside
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
>
|
>
|
||||||
<div class="h-full overflow-y-auto px-3 pb-4">
|
<div class="h-full overflow-y-auto px-3 pb-4">
|
||||||
<ul class="space-y-2 font-medium list-none" data-sveltekit-preload-data="false">
|
<ul class="space-y-2 font-medium list-none" data-sveltekit-preload-data="false">
|
||||||
{#each navs as nav}
|
{#each adminNavs as nav}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={nav.path}
|
href={nav.path}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { navs } from './navs';
|
||||||
import { LightSwitch, getDrawerStore } from '@skeletonlabs/skeleton';
|
import { LightSwitch, getDrawerStore } from '@skeletonlabs/skeleton';
|
||||||
|
|
||||||
const drawerStore = getDrawerStore();
|
const drawerStore = getDrawerStore();
|
||||||
|
|
||||||
function drawerOpen() {
|
|
||||||
drawerStore.open({});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="fixed w-full z-20 top-0 start-0 bg-surface-100-800-token shadow-2xl">
|
<nav class="fixed w-full z-20 top-0 start-0 bg-surface-100-800-token shadow-2xl">
|
||||||
|
@ -22,7 +19,7 @@
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm mr-4 md:hidden"
|
class="btn btn-sm mr-4 md:hidden"
|
||||||
aria-label="Mobile Drawer Button"
|
aria-label="Mobile Drawer Button"
|
||||||
on:click={drawerOpen}
|
on:click={() => drawerStore.open({})}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<svg viewBox="0 0 100 80" class="fill-token h-4 w-4">
|
<svg viewBox="0 0 100 80" class="fill-token h-4 w-4">
|
||||||
|
@ -44,19 +41,16 @@
|
||||||
aria-current={$page.url.pathname === '/' ? 'page' : undefined}>Home</a
|
aria-current={$page.url.pathname === '/' ? 'page' : undefined}>Home</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
{#each navs as nav}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="/remote-nodes"
|
href={nav.path}
|
||||||
class={$page.url.pathname.startsWith('/remote-nodes') ? 'active' : 'nav-link'}
|
class={$page.url.pathname.startsWith(nav.path) ? 'active' : 'nav-link'}
|
||||||
>Remote Nodes</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="/add-node"
|
|
||||||
class={$page.url.pathname.startsWith('/add-node') ? 'active' : 'nav-link'}>Add Node</a
|
|
||||||
>
|
>
|
||||||
|
{nav.name}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { navs } from './navs';
|
||||||
import { getDrawerStore } from '@skeletonlabs/skeleton';
|
import { getDrawerStore } from '@skeletonlabs/skeleton';
|
||||||
|
|
||||||
const drawerStore = getDrawerStore();
|
const drawerStore = getDrawerStore();
|
||||||
|
$: classes = (/** @type {string} */ href) =>
|
||||||
function drawerClose() {
|
|
||||||
drawerStore.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
$: classesActive = (/** @type {string} */ href) =>
|
|
||||||
$page.url.pathname.startsWith(href) ? 'bg-primary-500' : '';
|
$page.url.pathname.startsWith(href) ? 'bg-primary-500' : '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="list-nav p-4">
|
<nav class="list-nav p-4">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="/" class={$page.url.pathname === '/' ? 'bg-primary-500' : ''} on:click={drawerClose}
|
<a
|
||||||
>Home</a
|
href="/"
|
||||||
|
class={$page.url.pathname === '/' ? 'bg-primary-500' : ''}
|
||||||
|
on:click={() => drawerStore.close()}>Home</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/dib" class={classesActive('/dib')} on:click={drawerClose}>Data</a></li>
|
{#each navs as nav}
|
||||||
<li><a href="/tools" class={classesActive('/tools')} on:click={drawerClose}>Tools</a></li>
|
<li>
|
||||||
<li><a href="/asn" class={classesActive('/asn')} on:click={drawerClose}>ASN</a></li>
|
<a href={nav.path} class={classes(nav.path)} on:click={() => drawerStore.close()}
|
||||||
<li><a href="/proxy" class={classesActive('/proxy')} on:click={drawerClose}>Proxy</a></li>
|
>{nav.name}</a
|
||||||
<li><a href="/monero" class={classesActive('/monero')} on:click={drawerClose}>Monero</a></li>
|
>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
export const navs = [
|
export const adminNavs = [
|
||||||
{ name: 'Dashboard', path: '/app/dashboard/' },
|
{ name: 'Dashboard', path: '/app/dashboard/' },
|
||||||
{ name: 'Prober', path: '/app/prober/' },
|
{ name: 'Prober', path: '/app/prober/' },
|
||||||
{ name: 'Crons', path: '/app/crons/' }
|
{ name: 'Crons', path: '/app/crons/' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const navs = [
|
||||||
|
{ name: 'Remote Nodes', path: '/remote-nodes/' },
|
||||||
|
{ name: 'Add Node', path: '/add-node/' }
|
||||||
|
];
|
||||||
|
|
Loading…
Reference in a new issue