Skip to content

Commit 625cca0

Browse files
committed
Improved mobile sidebar experience.
1 parent be8a3b0 commit 625cca0

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/Exceptionless.Web/ClientApp/src/routes/(app)/(components)/layouts/sidebar-organization-switcher.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
let activeOrganization = $derived(organizations?.find((organization) => organization.id === selected));
2525
2626
function onOrganizationSelected(organization: ViewOrganization): void {
27+
if (sidebar.isMobile) {
28+
sidebar.toggle();
29+
}
30+
2731
if (organization.id === selected) {
2832
return;
2933
}

src/Exceptionless.Web/ClientApp/src/routes/(app)/(components)/layouts/sidebar-user.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
2727
let { gravatar, isLoading, user, ...props }: Props = $props();
2828
const sidebar = useSidebar();
29+
30+
function onMenuClick() {
31+
if (sidebar.isMobile) {
32+
sidebar.toggle();
33+
}
34+
}
2935
</script>
3036

3137
{#if isLoading}
@@ -90,7 +96,7 @@
9096
<DropdownMenu.Group>
9197
<DropdownMenu.Item>
9298
<BadgeCheck />
93-
<A variant="ghost" href="/next/account/manage" class="w-full">Account</A>
99+
<A variant="ghost" href="/next/account/manage" class="w-full" onclick={onMenuClick}>Account</A>
94100
<DropdownMenu.Shortcut>⇧⌘ga</DropdownMenu.Shortcut>
95101
</DropdownMenu.Item>
96102
<!-- <DropdownMenu.Item>

src/Exceptionless.Web/ClientApp/src/routes/(app)/(components)/layouts/sidebar.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
const dashboardRoutes = routes.filter((route) => route.group === 'Dashboards');
1818
1919
const sidebar = useSidebar();
20+
21+
function onMenuClick() {
22+
if (sidebar.isMobile) {
23+
sidebar.toggle();
24+
}
25+
}
2026
</script>
2127

2228
<Sidebar.Root collapsible="icon" {...props}>
@@ -33,7 +39,7 @@
3339
<Sidebar.MenuItem>
3440
<Sidebar.MenuButton isActive={route.href === page.url.pathname}>
3541
{#snippet child({ props })}
36-
<a href={route.href} title={route.title} {...props}>
42+
<a href={route.href} title={route.title} onclick={onMenuClick} {...props}>
3743
<Icon />
3844
<span>{route.title}</span>
3945
</a>

0 commit comments

Comments
 (0)