Skip to content

Commit baaa470

Browse files
authored
Merge pull request #4012 from Dokploy/3979-collapsed-sidebar-state-has-usability-and-visual-issues
3979 collapsed sidebar state has usability and visual issues
2 parents c317ec3 + 4871520 commit baaa470

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

apps/dokploy/components/dashboard/projects/show.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ export const ShowProjects = () => {
169169
<BreadcrumbSidebar
170170
list={[{ name: "Projects", href: "/dashboard/projects" }]}
171171
/>
172-
{!isCloud && (
173-
<div className="absolute top-4 right-4">
174-
<TimeBadge />
175-
</div>
176-
)}
177172
<div className="w-full">
178173
<Card className="h-full bg-sidebar p-2.5 rounded-xl ">
179174
<div className="rounded-xl bg-background shadow-md ">

apps/dokploy/components/layouts/side.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ function SidebarLogo() {
545545
const { mutateAsync: setDefaultOrganization, isPending: isSettingDefault } =
546546
api.organization.setDefault.useMutation();
547547
const { isMobile } = useSidebar();
548+
const isCollapsed = state === "collapsed" && !isMobile;
548549
const { data: activeOrganization } = api.organization.active.useQuery();
549550

550551
const { data: invitations, refetch: refetchInvitations } =
@@ -570,27 +571,25 @@ function SidebarLogo() {
570571
<SidebarMenu
571572
className={cn(
572573
"flex gap-2",
573-
state === "collapsed"
574-
? "flex-col"
575-
: "flex-row justify-between items-center",
574+
isCollapsed ? "flex-col" : "flex-row justify-between items-center",
576575
)}
577576
>
578577
{/* Organization Logo and Selector */}
579578
<SidebarMenuItem className={"w-full"}>
580579
<DropdownMenu>
581580
<DropdownMenuTrigger asChild>
582581
<SidebarMenuButton
583-
size={state === "collapsed" ? "sm" : "lg"}
582+
size={isCollapsed ? "sm" : "lg"}
584583
className={cn(
585584
"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
586-
state === "collapsed" &&
585+
isCollapsed &&
587586
"flex justify-center items-center p-2 h-10 w-10 mx-auto",
588587
)}
589588
>
590589
<div
591590
className={cn(
592591
"flex items-center gap-2",
593-
state === "collapsed" && "justify-center",
592+
isCollapsed && "justify-center",
594593
)}
595594
>
596595
<div
@@ -602,15 +601,15 @@ function SidebarLogo() {
602601
<Logo
603602
className={cn(
604603
"transition-all",
605-
state === "collapsed" ? "size-4" : "size-5",
604+
isCollapsed ? "size-4" : "size-5",
606605
)}
607606
logoUrl={activeOrganization?.logo || undefined}
608607
/>
609608
</div>
610609
<div
611610
className={cn(
612611
"flex flex-col items-start",
613-
state === "collapsed" && "hidden",
612+
isCollapsed && "hidden",
614613
)}
615614
>
616615
<p className="text-sm font-medium leading-none">
@@ -619,7 +618,7 @@ function SidebarLogo() {
619618
</div>
620619
</div>
621620
<ChevronsUpDown
622-
className={cn("ml-auto", state === "collapsed" && "hidden")}
621+
className={cn("ml-auto", isCollapsed && "hidden")}
623622
/>
624623
</SidebarMenuButton>
625624
</DropdownMenuTrigger>
@@ -768,15 +767,15 @@ function SidebarLogo() {
768767
</SidebarMenuItem>
769768

770769
{/* Notification Bell */}
771-
<SidebarMenuItem className={cn(state === "collapsed" && "mt-2")}>
770+
<SidebarMenuItem className={cn(isCollapsed && "mt-2")}>
772771
<DropdownMenu>
773772
<DropdownMenuTrigger asChild>
774773
<Button
775774
variant="ghost"
776775
size="icon"
777776
className={cn(
778777
"relative",
779-
state === "collapsed" && "h-8 w-8 p-1.5 mx-auto",
778+
isCollapsed && "h-8 w-8 p-1.5 mx-auto",
780779
)}
781780
>
782781
<Bell className="size-4" />
@@ -1145,14 +1144,9 @@ export default function Page({ children }: Props) {
11451144
</div>
11461145
)}
11471146
{dokployVersion && (
1148-
<>
1149-
<div className="px-3 text-xs text-muted-foreground text-center group-data-[collapsible=icon]:hidden">
1150-
Version {dokployVersion}
1151-
</div>
1152-
<div className="hidden text-xs text-muted-foreground text-center group-data-[collapsible=icon]:block">
1153-
{dokployVersion}
1154-
</div>
1155-
</>
1147+
<div className="px-3 text-xs text-muted-foreground text-center group-data-[collapsible=icon]:hidden">
1148+
Version {dokployVersion}
1149+
</div>
11561150
)}
11571151
</SidebarMenu>
11581152
</SidebarFooter>

apps/dokploy/components/shared/breadcrumb-sidebar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
} from "@/components/ui/dropdown-menu";
1818
import { Separator } from "@/components/ui/separator";
1919
import { SidebarTrigger } from "@/components/ui/sidebar";
20+
import { TimeBadge } from "@/components/ui/time-badge";
21+
import { api } from "@/utils/api";
2022

2123
interface BreadcrumbEntry {
2224
name: string;
@@ -32,9 +34,11 @@ interface Props {
3234
}
3335

3436
export const BreadcrumbSidebar = ({ list }: Props) => {
37+
const { data: isCloud } = api.settings.isCloud.useQuery();
38+
3539
return (
3640
<header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12">
37-
<div className="flex items-center justify-between w-full">
41+
<div className="flex items-center justify-between w-full px-4">
3842
<div className="flex items-center gap-2">
3943
<SidebarTrigger className="-ml-1" />
4044
<Separator orientation="vertical" className="mr-2 h-4" />
@@ -75,6 +79,7 @@ export const BreadcrumbSidebar = ({ list }: Props) => {
7579
</BreadcrumbList>
7680
</Breadcrumb>
7781
</div>
82+
{!isCloud && <TimeBadge />}
7883
</div>
7984
</header>
8085
);

apps/dokploy/components/ui/sidebar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ const Sidebar = React.forwardRef<
213213
}
214214
side={side}
215215
>
216-
<div className="flex h-full w-full flex-col">{children}</div>
216+
<div className="flex h-full w-full flex-col overflow-hidden">
217+
{children}
218+
</div>
217219
</SheetContent>
218220
</Sheet>
219221
);
@@ -412,7 +414,7 @@ const SidebarContent = React.forwardRef<
412414
ref={ref}
413415
data-sidebar="content"
414416
className={cn(
415-
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
417+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-y-auto",
416418
className,
417419
)}
418420
{...props}

0 commit comments

Comments
 (0)