ui: Make menu item active according to the visited scenario

This commit is contained in:
nemunaire 2024-03-16 10:15:18 +01:00
parent 4c29f2e53e
commit d234bbf272
2 changed files with 5 additions and 4 deletions

View File

@ -58,7 +58,7 @@
</div> </div>
{/if} {/if}
<div class="sticky-top"> <div class="sticky-top">
<Navbar color="dark" dark expand="md"> <Navbar color="primary" dark expand="md">
<NavbarToggler on:click={() => (isOpen = !isOpen)} /> <NavbarToggler on:click={() => (isOpen = !isOpen)} />
<Collapse {isOpen} navbar expand="md" on:update={handleUpdate}> <Collapse {isOpen} navbar expand="md" on:update={handleUpdate}>
<Nav navbar> <Nav navbar>

View File

@ -8,12 +8,13 @@
Icon, Icon,
} from '@sveltestrap/sveltestrap'; } from '@sveltestrap/sveltestrap';
import { current_exercice } from '$lib/stores/exercices';
import { my } from '$lib/stores/my.js'; import { my } from '$lib/stores/my.js';
import { max_solved } from '$lib/stores/themes.js'; import { current_theme, max_solved } from '$lib/stores/themes.js';
import { myThemes, themes } from '$lib/stores/mythemes.js'; import { myThemes, themes } from '$lib/stores/mythemes.js';
</script> </script>
<Dropdown nav inNavbar> <Dropdown nav inNavbar active={$current_theme}>
<DropdownToggle nav caret> <DropdownToggle nav caret>
<Icon name="tv" /> <Icon name="tv" />
Scenarii Scenarii
@ -21,7 +22,7 @@
<DropdownMenu class="niceborder"> <DropdownMenu class="niceborder">
<div> <div>
{#each $themes as th, index} {#each $themes as th, index}
<DropdownItem href="{th.urlid}"> <DropdownItem href="{th.urlid}" active={$current_theme && $current_theme.id == th.id}>
{th.name} {th.name}
{#if $max_solved > 1 && th.solved == $max_solved} {#if $max_solved > 1 && th.solved == $max_solved}
<Badge color="danger"> <Badge color="danger">