🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor ExportButton and AppSidebar components for improved functionality and UI
Bill Yangf8f119d696d9
diff --git a/client/src/app/[site]/components/SubHeader/Export/ExportButton.tsx b/client/src/app/[site]/components/SubHeader/Export/ExportButton.tsxindex 2d18eb86b..9bed2f1d0 100644--- a/client/src/app/[site]/components/SubHeader/Export/ExportButton.tsx+++ b/client/src/app/[site]/components/SubHeader/Export/ExportButton.tsx@@ -75,10 +75,10 @@ export function ExportButton() {</TooltipContent></Tooltip><DropdownMenuContent align="end">- <DropdownMenuItem onClick={handleExportPdf} disabled={isExportingPdf}>+ {/* <DropdownMenuItem onClick={handleExportPdf} disabled={isExportingPdf}><FileText className="h-4 w-4 mr-2" />{isExportingPdf ? "Generating PDF..." : "Export as PDF Report"}- </DropdownMenuItem>+ </DropdownMenuItem> */}<DropdownMenuItem onClick={handleExportCsv} disabled={isExportingCsv}><FileArchive className="h-4 w-4 mr-2" />{isExportingCsv ? "Exporting..." : "Export as CSV (ZIP)"}diff --git a/client/src/components/AppSidebar.tsx b/client/src/components/AppSidebar.tsxindex 5c6fd9c09..cd570502d 100644--- a/client/src/components/AppSidebar.tsx+++ b/client/src/components/AppSidebar.tsx@@ -1,6 +1,6 @@"use client";-import { BarChart, ShieldUser, User } from "lucide-react";+import { BarChart, Building2, LogOut, Settings, ShieldUser, User } from "lucide-react";import Link from "next/link";import { usePathname } from "next/navigation";import { Suspense, useState } from "react";@@ -69,13 +69,42 @@ function AppSidebarContent() {<div className={cn("flex items-center w-full px-0.5", isExpanded ? "justify-start" : "hidden")}><ThemeSwitcher /></div>- <SidebarLink- href="/settings/account"- icon={<User className="w-5 h-5" />}- label="Account"- active={pathname.startsWith("/settings/account")}- expanded={isExpanded}- />++ {isExpanded ? (+ <>+ <SidebarLink+ href="/settings/account"+ icon={<User className="w-5 h-5" />}+ label="Account"+ active={pathname.startsWith("/settings/account")}+ expanded={isExpanded}+ />+ <SidebarLink+ href="/settings/organization"+ icon={<Building2 className="w-5 h-5" />}+ label="Organization"+ active={pathname.startsWith("/settings/organization")}+ expanded={isExpanded}+ />+ <SidebarLink+ onClick={() => authClient.signOut()}+ icon={<LogOut className="w-5 h-5" />}+ label="Sign out"+ expanded={isExpanded}+ />+ </>+ ) : (+ <div+ className={cn(+ "p-1 rounded-md transition-all duration-200 flex items-center gap-2",+ "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-150 dark:hover:bg-neutral-800/80"+ )}+ >+ <div className="flex items-center justify-center w-5 h-5 shrink-0">+ <Settings className="w-5 h-5" />+ </div>+ </div>+ )}</div></div>);@@ -95,13 +124,32 @@ function SidebarLink({icon,label,expanded = false,+ onClick,}: {active?: boolean;- href: string;+ href?: string;icon?: React.ReactNode;label?: string;expanded?: boolean;+ onClick?: () => void;}) {+ if (!href) {+ return (+ <div+ onClick={onClick}+ className={cn(+ "p-1 rounded-md transition-all duration-200 flex items-center gap-2",+ "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-150 dark:hover:bg-neutral-800/80"+ )}+ >+ <div className="flex items-center justify-center w-5 h-5 shrink-0">{icon}</div>+ {expanded && label && (+ <span className="text-sm font-medium whitespace-nowrap overflow-hidden w-[120px]">{label}</span>+ )}+ </div>+ );+ }+return (<Link href={href} className="focus:outline-none"><div@@ -110,7 +158,6 @@ function SidebarLink({active? "bg-neutral-150 dark:bg-neutral-800 text-neutral-800 dark:text-white": "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-150 dark:hover:bg-neutral-800/80"- // expanded ? "w-40" : "w-12")}><div className="flex items-center justify-center w-5 h-5 shrink-0">{icon}</div>