mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-12 22:42:13 +02:00
feat(sidebar): introduce SidebarButtonBadge for improved badge display
- Added SidebarButtonBadge component to encapsulate badge styling and functionality. - Updated Sidebar to utilize SidebarButtonBadge for displaying new item notifications, enhancing visual clarity. - Adjusted SidebarUserProfile layout for better alignment in collapsed view.
This commit is contained in:
parent
2670ad96c8
commit
d6fbbb97d4
4 changed files with 25 additions and 11 deletions
|
|
@ -19,7 +19,7 @@ import { ChatListItem } from "./ChatListItem";
|
||||||
import { CreditBalanceDisplay } from "./CreditBalanceDisplay";
|
import { CreditBalanceDisplay } from "./CreditBalanceDisplay";
|
||||||
import { DocumentsSidebar } from "./DocumentsSidebar";
|
import { DocumentsSidebar } from "./DocumentsSidebar";
|
||||||
import { NavSection } from "./NavSection";
|
import { NavSection } from "./NavSection";
|
||||||
import { SidebarButton } from "./SidebarButton";
|
import { SidebarButton, SidebarButtonBadge } from "./SidebarButton";
|
||||||
import { SidebarCollapseButton } from "./SidebarCollapseButton";
|
import { SidebarCollapseButton } from "./SidebarCollapseButton";
|
||||||
import { SidebarHeader } from "./SidebarHeader";
|
import { SidebarHeader } from "./SidebarHeader";
|
||||||
import { SidebarSection } from "./SidebarSection";
|
import { SidebarSection } from "./SidebarSection";
|
||||||
|
|
@ -246,14 +246,7 @@ export function Sidebar({
|
||||||
onClick={() => onNavItemClick?.(playgroundItem)}
|
onClick={() => onNavItemClick?.(playgroundItem)}
|
||||||
isCollapsed={isCollapsed}
|
isCollapsed={isCollapsed}
|
||||||
isActive={playgroundItem.isActive}
|
isActive={playgroundItem.isActive}
|
||||||
badge={
|
badge={<SidebarButtonBadge>New</SidebarButtonBadge>}
|
||||||
<Badge
|
|
||||||
variant="secondary"
|
|
||||||
className="h-5 shrink-0 rounded-sm border-0 bg-popover-foreground/10 px-1.5 text-[11px] text-popover-foreground hover:bg-popover-foreground/10"
|
|
||||||
>
|
|
||||||
New
|
|
||||||
</Badge>
|
|
||||||
}
|
|
||||||
tooltipContent={isCollapsed ? playgroundItem.title : undefined}
|
tooltipContent={isCollapsed ? playgroundItem.title : undefined}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import type { LucideIcon } from "lucide-react";
|
import type { LucideIcon } from "lucide-react";
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
@ -28,6 +29,26 @@ const baseClassName = cn(
|
||||||
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export function SidebarButtonBadge({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Badge
|
||||||
|
variant="secondary"
|
||||||
|
className={cn(
|
||||||
|
"h-5 shrink-0 rounded-sm border-0 bg-popover-foreground/10 px-1.5 text-[11px] text-popover-foreground hover:bg-popover-foreground/10",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Badge>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function SidebarButton({
|
export function SidebarButton({
|
||||||
icon: Icon,
|
icon: Icon,
|
||||||
label,
|
label,
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,7 @@ export function SidebarUserProfile({
|
||||||
// Collapsed view - just show avatar with dropdown
|
// Collapsed view - just show avatar with dropdown
|
||||||
if (isCollapsed) {
|
if (isCollapsed) {
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full px-1.5 py-2 before:absolute before:inset-x-3 before:top-0 before:h-px before:bg-border">
|
<div className="relative w-full px-1.5 py-2 before:absolute before:inset-x-1.5 before:top-0 before:h-px before:bg-border">
|
||||||
<div className="flex flex-col items-center gap-2">
|
<div className="flex flex-col items-center gap-2">
|
||||||
{topContent}
|
{topContent}
|
||||||
{showDownloadCta && (
|
{showDownloadCta && (
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export function ConnectAgentDialog({ className }: { className?: string }) {
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Cable className="h-3.5 w-3.5 shrink-0" />
|
<Cable className="h-3.5 w-3.5 shrink-0" />
|
||||||
<span className="min-w-0 flex-1 truncate">Connect your AI Agent</span>
|
<span className="min-w-0 flex-1 truncate">Connect your agent</span>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="max-h-[85vh] overflow-y-auto sm:max-w-2xl">
|
<DialogContent className="max-h-[85vh] overflow-y-auto sm:max-w-2xl">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue