Skip to content

Commit

Permalink
fix: add missing drawer translator function
Browse files Browse the repository at this point in the history
  • Loading branch information
V-ed committed Nov 23, 2023
1 parent 96d10d7 commit 9048b0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions client/src/i18n/en/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"links": {
"settings": "Settings"
}
},
"drawer": {
"header": "Navigation"
}
}
3 changes: 3 additions & 0 deletions client/src/i18n/fr/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"links": {
"settings": "Paramètres"
}
},
"drawer": {
"header": "Navigation"
}
}
11 changes: 7 additions & 4 deletions client/src/lib/components/nav/Drawer.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<script lang="ts">
import { page } from '$app/stores';
import { getI18n } from '$i18n';
import { getSessionUser, isDrawerHidden } from '$lib/stores';
import { navElements } from '$navigation/routes';
import { CloseButton, Drawer, Sidebar, SidebarDropdownWrapper, SidebarGroup, SidebarItem, SidebarWrapper } from 'flowbite-svelte';
import { sineIn } from 'svelte/easing';
import DarkMode from '../DarkMode.svelte';
import Icon from '../Icon.svelte';
import { isNavElemVisible } from './utils';
let i18n = getI18n();
$: ({ t } = $i18n);
let sessionUser = getSessionUser();
Expand All @@ -21,7 +24,7 @@
<div class="flex items-center">
<h5 id="drawer-label" class="inline-flex items-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400">
<Icon class="i-mdi-information mr-3" />
Navigation
{$t('navbar.drawer.header')}
</h5>
<CloseButton on:click={isDrawerHidden.toggle} class="mb-4" />
</div>
Expand All @@ -31,7 +34,7 @@
{#each navElements.filter((navElement) => isNavElemVisible(navElement, $sessionUser)) as navElement}
{#if 'url' in navElement}
<SidebarItem
label={navElement.title}
label={$t(navElement.title)}
active={$page.url.pathname == navElement.url}
href={navElement.url}
on:click={() => isDrawerHidden.set(true)}
Expand All @@ -44,7 +47,7 @@
</SidebarItem>
{:else}
<SidebarDropdownWrapper
label={navElement.title}
label={$t(navElement.title)}
isOpen={navElement.elements.some((navSubElement) => $page.url.pathname == navSubElement.url)}
>
<svelte:fragment slot="icon">
Expand All @@ -60,7 +63,7 @@
</svelte:fragment>
{#each navElement.elements.filter((navSubElement) => navSubElement.isPublic || $sessionUser) as navSubElement}
<SidebarItem
label={navSubElement.title}
label={$t(navSubElement.title)}
active={$page.url.pathname == navSubElement.url}
href={navSubElement.url}
class="pl-8"
Expand Down

0 comments on commit 9048b0a

Please sign in to comment.