Skip to content

The only tool you need to know what is happening and how to fix it.

progress (#266)

narrow-adventure6fa894b062e1
diff --git a/frontend/src/lib/components/app-sidebar.svelte b/frontend/src/lib/components/app-sidebar.svelte
index 35c70fc4..2188b146 100644
--- a/frontend/src/lib/components/app-sidebar.svelte
+++ b/frontend/src/lib/components/app-sidebar.svelte
@@ -18,10 +18,15 @@
KeyRound
} from '@lucide/svelte';
import { themeState } from '$lib/state/theme.svelte';
- import { projectsState, isFrontendFramework, isCloudflareFramework } from '$lib/state/projects.svelte';
+ import {
+ projectsState,
+ isFrontendFramework,
+ isCloudflareFramework
+ } from '$lib/state/projects.svelte';
import { LayoutDashboard } from '@lucide/svelte';
import { page } from '$app/state';
import { createRowClickHandler } from '$lib/utils/navigation';
+ import { cn } from '$lib/utils';
interface SidebarItem {
Icon: typeof LayoutDashboard;
@@ -32,7 +37,15 @@
external?: boolean;
}
- const hiddenForFrontend = new Set(['Dashboard', 'Logs', 'Endpoints', 'Tasks', 'Profiles', 'Metrics', 'AI Traces']);
+ const hiddenForFrontend = new Set([
+ 'Dashboard',
+ 'Logs',
+ 'Endpoints',
+ 'Tasks',
+ 'Profiles',
+ 'Metrics',
+ 'AI Traces'
+ ]);
const hiddenForCloudflare = new Set(['Metrics']);
// Items that only make sense for frontend (browser) projects - dropped from
// the sidebar for any other framework, so a Go backend project doesn't
@@ -47,7 +60,12 @@
{ Icon: ListEnd, href: '/tasks', title: 'Tasks', stickyParams: ['preset', 'from', 'to'] },
{ Icon: Flame, href: '/profiles', title: 'Profiles', stickyParams: ['preset', 'from', 'to'] },
{ Icon: Film, href: '/sessions', title: 'Sessions', stickyParams: ['preset', 'from', 'to'] },
- { Icon: Workflow, href: '/ai-traces', title: 'AI Traces', stickyParams: ['preset', 'from', 'to'] },
+ {
+ Icon: Workflow,
+ href: '/ai-traces',
+ title: 'AI Traces',
+ stickyParams: ['preset', 'from', 'to']
+ },
{
Icon: ChartNoAxesCombined,
href: '/metrics',
@@ -61,8 +79,11 @@
const sidebarItems = $derived(
projectsState.currentProject && isFrontendFramework(projectsState.currentProject.framework)
? allSidebarItems.filter((item) => !hiddenForFrontend.has(item.title))
- : projectsState.currentProject && isCloudflareFramework(projectsState.currentProject.framework)
- ? allSidebarItems.filter((item) => !hiddenForCloudflare.has(item.title) && !frontendOnly.has(item.title))
+ : projectsState.currentProject &&
+ isCloudflareFramework(projectsState.currentProject.framework)
+ ? allSidebarItems.filter(
+ (item) => !hiddenForCloudflare.has(item.title) && !frontendOnly.has(item.title)
+ )
: allSidebarItems.filter((item) => !frontendOnly.has(item.title))
);
@@ -83,25 +104,57 @@
);
const sidebar = useSidebar();
+
+ function navFlyoutProps(active: boolean) {
+ return {
+ sideOffset: 8,
+ arrowClasses: 'hidden',
+ class: cn(
+ 'flex h-9 items-center rounded-md border-border bg-popover px-3 text-sm font-medium text-popover-foreground shadow-md',
+ active && 'border-transparent bg-sidebar-accent text-sidebar-accent-foreground'
+ )
+ };
+ }
</script>
-<Sidebar.Sidebar>
- <Sidebar.SidebarHeader class="flex items-start p-4">
+<Sidebar.Sidebar collapsible="icon" class="dark:border-white/12">
+ <Sidebar.SidebarHeader
+ class="flex items-start overflow-hidden p-4 transition-[padding] duration-200 ease-linear group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-2.5"
+ >
{#if themeState.isDark}
- <img src="/traceway-logo-white.svg" alt="Traceway Logo" class="h-9 w-auto" />
+ <img
+ src="/traceway-logo-white.svg"
+ alt="Traceway Logo"
+ class="h-9 w-auto max-w-none shrink-0 group-data-[collapsible=icon]:hidden"
+ />
{:else}
- <img src="/traceway-logo.png" alt="Traceway Logo" class="h-9 w-auto" />
+ <img
+ src="/traceway-logo.png"
+ alt="Traceway Logo"
+ class="h-9 w-auto max-w-none shrink-0 group-data-[collapsible=icon]:hidden"
+ />
{/if}
+ <img
+ src="/traceway-mark.png"
+ alt="Traceway Logo"
+ class="mt-1 hidden size-9 shrink-0 object-contain group-data-[collapsible=icon]:block dark:invert"
+ />
</Sidebar.SidebarHeader>
<Sidebar.SidebarContent>
- <Sidebar.SidebarGroup class="p-4 pt-0 pb-0">
+ <Sidebar.SidebarGroup
+ class="p-4 pt-0 pb-0 transition-[padding] duration-200 ease-linear group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:pt-2"
+ >
<Sidebar.SidebarGroupContent>
<Sidebar.SidebarMenu>
{#each sidebarItems as sidebarItem}
+ {@const active =
+ page.url.pathname === sidebarItem.href ||
+ page.url.pathname.startsWith(sidebarItem.href + '/')}
<Sidebar.SidebarMenuItem>
<Sidebar.SidebarMenuButton
- isActive={page.url.pathname === sidebarItem.href ||
- page.url.pathname.startsWith(sidebarItem.href + '/')}
+ isActive={active}
+ tooltipContent={sidebarItem.title}
+ tooltipContentProps={navFlyoutProps(active)}
onclick={(e) => {
sidebar.setOpenMobile(false);
createRowClickHandler(sidebarItem.href, ...sidebarItem.stickyParams)(e);
@@ -119,13 +172,17 @@
{#if sidebarItemsBottom.length}
<div class="flex-1"></div>
- <Sidebar.SidebarGroup class="p-4 pt-0">
+ <Sidebar.SidebarGroup
+ class="p-4 pt-0 transition-[padding] duration-200 ease-linear group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:pb-2.5"
+ >
<Sidebar.SidebarGroupContent>
<Sidebar.SidebarMenu>
{#each sidebarItemsBottom as sidebarItem}
<Sidebar.SidebarMenuItem>
{#if sidebarItem.external}
<Sidebar.SidebarMenuButton
+ tooltipContent={sidebarItem.title}
+ tooltipContentProps={navFlyoutProps(false)}
onclick={() => {
sidebar.setOpenMobile(false);
window.open(sidebarItem.href, '_blank', 'noopener,noreferrer');
@@ -135,9 +192,13 @@
<span>{sidebarItem.title}</span>
</Sidebar.SidebarMenuButton>
{:else}
+ {@const active =
+ page.url.pathname === sidebarItem.href ||
+ page.url.pathname.startsWith(sidebarItem.href + '/')}
<Sidebar.SidebarMenuButton
- isActive={page.url.pathname === sidebarItem.href ||
- page.url.pathname.startsWith(sidebarItem.href + '/')}
+ isActive={active}
+ tooltipContent={sidebarItem.title}
+ tooltipContentProps={navFlyoutProps(active)}
onclick={(e) => {
sidebar.setOpenMobile(false);
createRowClickHandler(sidebarItem.href, ...sidebarItem.stickyParams)(e);
@@ -155,6 +216,12 @@
{/if}
</Sidebar.SidebarContent>
<Sidebar.SidebarFooter class="flex flex-row justify-center border-t border-border py-1 italic">
- <span class="text-xs text-muted-foreground">Traceway - v{__APP_VERSION__}</span>
+ <div class="hidden group-data-[collapsible=icon]:block">
+ <span class="text-xs text-muted-foreground">&nbsp;</span>
+ </div>
+
+ <div class="group-data-[collapsible=icon]:hidden">
+ <span class="text-xs text-muted-foreground">Traceway - v{__APP_VERSION__}</span>
+ </div>
</Sidebar.SidebarFooter>
</Sidebar.Sidebar>
diff --git a/frontend/src/lib/components/ui/sidebar/constants.ts b/frontend/src/lib/components/ui/sidebar/constants.ts
index 4de44351..c5ce32ea 100644
--- a/frontend/src/lib/components/ui/sidebar/constants.ts
+++ b/frontend/src/lib/components/ui/sidebar/constants.ts
@@ -2,5 +2,5 @@ export const SIDEBAR_COOKIE_NAME = "sidebar:state";
export const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
export const SIDEBAR_WIDTH = "16rem";
export const SIDEBAR_WIDTH_MOBILE = "18rem";
-export const SIDEBAR_WIDTH_ICON = "3rem";
+export const SIDEBAR_WIDTH_ICON = "3.5rem";
export const SIDEBAR_KEYBOARD_SHORTCUT = "b";
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
index 2f94b4a8..d00f7ef6 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
@@ -2,7 +2,7 @@
import { tv, type VariantProps } from "tailwind-variants";
export const sidebarMenuButtonVariants = tv({
- base: "peer/menu-button ring-sidebar-ring data-[active=false]:hover:bg-foreground/5 dark:data-[active=false]:hover:bg-white/8 active:bg-sidebar-accent data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:data-[active=false]:hover:bg-foreground/5 dark:data-[state=open]:data-[active=false]:hover:bg-white/8 flex w-full items-center gap-2.5 overflow-hidden rounded-md p-2 text-start text-[15px] font-medium outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-5 [&>svg]:shrink-0",
+ base: "peer/menu-button ring-sidebar-ring data-[active=false]:hover:bg-foreground/5 dark:data-[active=false]:hover:bg-white/8 active:bg-sidebar-accent data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:data-[active=false]:hover:bg-foreground/5 dark:data-[state=open]:data-[active=false]:hover:bg-white/8 flex w-full items-center gap-2.5 overflow-hidden rounded-md p-2 text-start text-[15px] font-medium outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-9! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:whitespace-nowrap [&>svg]:size-5 [&>svg]:shrink-0",
variants: {
variant: {
default: "data-[active=false]:hover:bg-foreground/5 dark:data-[active=false]:hover:bg-white/8",
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index b08b75c7..8857ea35 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -31,6 +31,9 @@
let { children } = $props();
let showAddProjectModal = $state(false);
let showEditProjectModal = $state(false);
+
+ const SIDEBAR_OPEN_KEY = 'traceway_sidebar_open';
+ let sidebarOpen = $state(localStorage.getItem(SIDEBAR_OPEN_KEY) !== 'false');
let CrossSiteNotificationBanner = $state<Component<{ organizationId: number }> | null>(null);
const bannerOrganizationId = $derived(projectsState.currentProject?.organizationId ?? null);
@@ -139,7 +142,10 @@
<!-- This is not ideal, but because our layout is a top level route it can end up showing sidebar on the login page (after the login before the transition). -->
<!-- We could consider moving this to a lower level layout for the actual app, for now it's just a path check -->
{#if authState.isAuthenticated && !isPublicPath(page.url.pathname)}
- <Sidebar.SidebarProvider>
+ <Sidebar.SidebarProvider
+ bind:open={sidebarOpen}
+ onOpenChange={(open) => localStorage.setItem(SIDEBAR_OPEN_KEY, String(open))}
+ >
<AppSidebar />
<Sidebar.SidebarInset>
<header class="flex h-12 shrink-0 items-center gap-2 border-b bg-white px-2 dark:bg-transparent">
diff --git a/frontend/static/traceway-mark.png b/frontend/static/traceway-mark.png
new file mode 100644
index 00000000..6df1013c
Binary files /dev/null and b/frontend/static/traceway-mark.png differ