Skip to content

Commit

Permalink
Feat: Drawer for general info - needs adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Its4Nik committed Feb 7, 2025
1 parent ac663dd commit 299fbda
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 48 deletions.
136 changes: 109 additions & 27 deletions app/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
Bolt,
ShoppingBag,
Currency,
Timer
Timer,
Settings,
ViewIcon,
User,
GithubIcon,
FileQuestion,
} from "lucide-react";
import type * as React from "react";

Expand All @@ -25,6 +30,17 @@ import {
SidebarMenuSubButton,
SidebarMenuSubItem,
} from "~/components/ui/sidebar";
import { Separator } from "~/components/ui/separator";
import {
Drawer,
DrawerTrigger,
DrawerContent,
DrawerHeader,
DrawerTitle,
DrawerDescription,
DrawerFooter,
} from "~/components/ui/drawer";
import { Button } from "~/components/ui/button";

const data = {
navMain: [
Expand All @@ -36,6 +52,8 @@ const data = {
},
{
title: "Views",
icon: ViewIcon,
url: "/",
items: [
{
title: "Default",
Expand All @@ -56,11 +74,13 @@ const data = {
title: "Timeline",
url: "/view/timeline",
icon: Timer,
}
},
],
},
{
title: "Stacks",
icon: Layers,
url: "/stacks/overview",
items: [
{
title: "Overview",
Expand All @@ -81,6 +101,8 @@ const data = {
},
{
title: "Settings",
icon: Settings,
url: "/settings/overview",
items: [
{
title: "Overview",
Expand All @@ -99,7 +121,7 @@ const data = {

export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
return (
<Sidebar variant="floating" {...props}>
<Sidebar collapsible="icon" {...props}>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
Expand All @@ -125,33 +147,93 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
<SidebarGroup>
<SidebarMenu className="gap-2">
{data.navMain.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<Link to={item.url as string} className="font-medium">
{item.icon && <item.icon className="mr-2 h-4 w-4" />}
{item.title}
</Link>
</SidebarMenuButton>
{item.items?.length ? (
<SidebarMenuSub className="ml-0 border-l-0 px-1.5">
{item.items.map((subItem) => (
<SidebarMenuSubItem key={subItem.title}>
<SidebarMenuSubButton asChild>
<Link to={subItem.url}>
{subItem.icon && (
<subItem.icon className="mr-2 h-4 w-4" />
)}
{subItem.title}
</Link>
</SidebarMenuSubButton>
</SidebarMenuSubItem>
))}
</SidebarMenuSub>
) : null}
</SidebarMenuItem>
<>
<Separator className="my-4" />

<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<Link to={item.url as string} className="font-large">
{item.icon && <item.icon className="mr-2 h-4 w-4" />}
<div className="text-l text-accent">{item.title}</div>
</Link>
</SidebarMenuButton>
{item.items?.length ? (
<SidebarMenuSub className="ml-0 border-l-0 px-1.5">
{item.items.map((subItem) => (
<SidebarMenuSubItem key={subItem.title}>
<SidebarMenuSubButton asChild className="ml-4">
<Link to={subItem.url}>
{subItem.icon && (
<subItem.icon className="mr-2 h-4 w-4" />
)}
{subItem.title}
</Link>
</SidebarMenuSubButton>
</SidebarMenuSubItem>
))}
</SidebarMenuSub>
) : null}
</SidebarMenuItem>
</>
))}
</SidebarMenu>
</SidebarGroup>
<SidebarGroup className="mt-auto border-t pt-2">
<SidebarMenu>
<SidebarMenuItem>
<Drawer>
<DrawerTrigger asChild>
<SidebarMenuButton className="w-full">
<GithubIcon className="mr-2 h-4 w-4" />
GitHub
</SidebarMenuButton>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>About DockStat</DrawerTitle>
<DrawerDescription>
Learn more about the DockStat ecosystem.
</DrawerDescription>
</DrawerHeader>
<div className="p-4 space-y-4">
<div>
<h3 className="font-semibold">DockStat</h3>
<p className="text-sm text-muted-foreground">
A powerful tool for monitoring and managing your Docker
containers.
</p>
</div>
<div>
<h3 className="font-semibold">DockStatAPI</h3>
<p className="text-sm text-muted-foreground">
The backend API that powers DockStat, providing robust
functionality and scalability.
</p>
</div>
<div>
<h3 className="font-semibold">DockStacks</h3>
<p className="text-sm text-muted-foreground">
A collection of pre-configured Docker stacks for easy
deployment and management.
</p>
</div>
</div>
<DrawerFooter>
<Button asChild>
<Link
to="https://github.com/Its4Nik/DockStat"
target="_blank"
rel="noopener noreferrer"
>
Visit GitHub
</Link>
</Button>
</DrawerFooter>
</DrawerContent>
</Drawer>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
);
Expand Down
116 changes: 116 additions & 0 deletions app/components/ui/drawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import * as React from "react"
import { Drawer as DrawerPrimitive } from "vaul"

import { cn } from "~/lib/utils"

const Drawer = ({
shouldScaleBackground = true,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
<DrawerPrimitive.Root
shouldScaleBackground={shouldScaleBackground}
{...props}
/>
)
Drawer.displayName = "Drawer"

const DrawerTrigger = DrawerPrimitive.Trigger

const DrawerPortal = DrawerPrimitive.Portal

const DrawerClose = DrawerPrimitive.Close

const DrawerOverlay = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Overlay
ref={ref}
className={cn("fixed inset-0 z-50 bg-black/80", className)}
{...props}
/>
))
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName

const DrawerContent = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DrawerPortal>
<DrawerOverlay />
<DrawerPrimitive.Content
ref={ref}
className={cn(
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
className
)}
{...props}
>
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
))
DrawerContent.displayName = "DrawerContent"

const DrawerHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
{...props}
/>
)
DrawerHeader.displayName = "DrawerHeader"

const DrawerFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
DrawerFooter.displayName = "DrawerFooter"

const DrawerTitle = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DrawerTitle.displayName = DrawerPrimitive.Title.displayName

const DrawerDescription = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DrawerDescription.displayName = DrawerPrimitive.Description.displayName

export {
Drawer,
DrawerPortal,
DrawerOverlay,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerFooter,
DrawerTitle,
DrawerDescription,
}
8 changes: 4 additions & 4 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Index() {
<div className="">
<h1>Overview</h1>
<br />
<h2 className="text-5xl text-slate-900">DockStat</h2>
<h2 className="text-5xl text-accent">DockStat</h2>
<br />
<strong>DockStat</strong> is a Docker monitoring solution designed to
provide insights into running Docker containers and their related
Expand All @@ -24,7 +24,7 @@ export default function Index() {
project called DockStatAPI.
<br />
<hr className="my-5" />
<h2 className="text-5xl text-slate-900">DockStatAPI</h2>
<h2 className="text-5xl text-accent">DockStatAPI</h2>
<br />
<strong>DockStatAPI</strong> is an extension of the DockStat project,
aimed at adding more advanced features. This API is currently in
Expand All @@ -34,7 +34,7 @@ export default function Index() {
effectively and visualize performance metrics.
<br />
<hr className="my-5" />
<h2 className="text-5xl text-slate-900">DockStacks</h2>
<h2 className="text-5xl text-accent">DockStacks</h2>
<br />
While specific details about <strong>DockStacks</strong> were not directly
available in the search results, it is likely related to the management of
Expand All @@ -45,7 +45,7 @@ export default function Index() {
capabilities of DockStat.
<br />
<hr className="my-5" />
<h3 className="text-4xl text-slate-900">Conclusion</h3>
<h3 className="text-4xl text-accent">Conclusion</h3>
In summary, the DockStat suite, including DockStat and DockStatAPI,
provides a robust framework for monitoring and managing Docker containers.
The ongoing development of these projects indicates a commitment to
Expand Down
4 changes: 2 additions & 2 deletions app/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body {
--secondary-foreground: 240 5.9% 10%;
--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;
--accent: 240 4.8% 95.9%;
--accent: 234 90.8% 74.3%; /* Distinct accent color */
--accent-foreground: 240 5.9% 10%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
Expand Down Expand Up @@ -67,7 +67,7 @@ body {
--secondary-foreground: 0 0% 90%;
--muted: 220 24% 15%;
--muted-foreground: 220 24% 60%; /* Better readability */
--accent: 260 4% 18%; /* Distinct accent color */
--accent: 234 90.8% 74.3%; /* Distinct accent color */
--accent-foreground: 0 0% 95%;
--destructive: 0 72% 42%; /* Darker red for better contrast */
--destructive-foreground: 0 0% 98%;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.4",
"@radix-ui/react-separator": "^1.1.1",
"@radix-ui/react-slot": "^1.1.1",
Expand All @@ -31,7 +31,8 @@
"remix-themes": "^2.0.4",
"sonner": "^1.7.4",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7"
"tailwindcss-animate": "^1.0.7",
"vaul": "^1.1.2"
},
"devDependencies": {
"@remix-run/dev": "^2.15.2",
Expand Down
Loading

0 comments on commit 299fbda

Please sign in to comment.