Skip to content

Commit 71b3cc8

Browse files
committed
reorganize folder structure and highlight active tab
1 parent 2f27858 commit 71b3cc8

19 files changed

+182
-165
lines changed

components.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"tsx": true,
66
"tailwind": {
77
"config": "tailwind.config.ts",
8-
"css": "src/app/globals.css",
8+
"css": "src/styles/globals.css",
99
"baseColor": "slate",
1010
"cssVariables": true,
1111
"prefix": ""
@@ -14,4 +14,4 @@
1414
"components": "@/components",
1515
"utils": "@/lib/utils"
1616
}
17-
}
17+
}

public/next.svg

-1
This file was deleted.

public/vercel.svg

-1
This file was deleted.

src/app/components/sidebar/index.tsx

-55
This file was deleted.

src/app/layout.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Metadata } from "next";
22
import { Inter } from "next/font/google";
33
import { cn } from "@/lib/utils";
4-
import "./globals.css";
4+
import "../styles/globals.css";
55

6-
import Appbar from "./components/appbar";
7-
import Sidebar from "./components/sidebar";
6+
import Appbar from "../components/appbar";
7+
import Sidebar from "../components/sidebar";
88

99
const inter = Inter({ subsets: ["latin"] });
1010

File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/sidebar/index.tsx

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"use client";
2+
import { cn } from "@/lib/utils";
3+
import Link from "next/link";
4+
import { usePathname } from "next/navigation";
5+
6+
import { Button } from "@/components/ui/button";
7+
import { Home, Users, DollarSign, ListChecks, Settings } from "lucide-react";
8+
9+
interface ButtonLinkProps extends React.HTMLAttributes<HTMLDivElement> {
10+
href: string;
11+
}
12+
13+
const ButtonLink = ({ href, children }: ButtonLinkProps) => {
14+
const pathname = usePathname();
15+
const isActive = pathname === href;
16+
17+
return (
18+
<Button
19+
asChild
20+
variant="ghost"
21+
className={`w-full justify-start ${isActive && "bg-slate-100"}`}
22+
>
23+
<Link href={href}>{children}</Link>
24+
</Button>
25+
);
26+
};
27+
28+
interface SidebarProps extends React.HTMLAttributes<HTMLDivElement> {
29+
isProgramManager: boolean;
30+
}
31+
32+
export default function Sidebar({ className, isProgramManager }: SidebarProps) {
33+
return (
34+
<div
35+
className={cn(
36+
"pb-2 w-40 border-r bg-background text-slate-600",
37+
className
38+
)}
39+
>
40+
<ButtonLink href="/">
41+
<Home className="mr-2 h-4 w-4" />
42+
Home
43+
</ButtonLink>
44+
<ButtonLink href="/tasks">
45+
<ListChecks className="mr-2 h-4 w-4" />
46+
Tasks
47+
</ButtonLink>
48+
{isProgramManager && (
49+
<>
50+
<ButtonLink href="/agents">
51+
<Users className="mr-2 h-4 w-4" />
52+
Agents
53+
</ButtonLink>
54+
<ButtonLink href="/billings">
55+
<DollarSign className="mr-2 h-4 w-4" />
56+
Billings & Usage
57+
</ButtonLink>
58+
</>
59+
)}
60+
<ButtonLink href="/settings">
61+
<Settings className="mr-2 h-4 w-4" />
62+
Settings
63+
</ButtonLink>
64+
</div>
65+
);
66+
}

components/ui/avatar.tsx src/components/ui/avatar.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
"use client"
1+
"use client";
22

3-
import * as React from "react"
4-
import * as AvatarPrimitive from "@radix-ui/react-avatar"
3+
import * as React from "react";
4+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
55

6-
import { cn } from "@/lib/utils"
6+
import { cn } from "@/lib/utils";
77

88
const Avatar = React.forwardRef<
99
React.ElementRef<typeof AvatarPrimitive.Root>,
@@ -17,8 +17,8 @@ const Avatar = React.forwardRef<
1717
)}
1818
{...props}
1919
/>
20-
))
21-
Avatar.displayName = AvatarPrimitive.Root.displayName
20+
));
21+
Avatar.displayName = AvatarPrimitive.Root.displayName;
2222

2323
const AvatarImage = React.forwardRef<
2424
React.ElementRef<typeof AvatarPrimitive.Image>,
@@ -29,8 +29,8 @@ const AvatarImage = React.forwardRef<
2929
className={cn("aspect-square h-full w-full", className)}
3030
{...props}
3131
/>
32-
))
33-
AvatarImage.displayName = AvatarPrimitive.Image.displayName
32+
));
33+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
3434

3535
const AvatarFallback = React.forwardRef<
3636
React.ElementRef<typeof AvatarPrimitive.Fallback>,
@@ -44,7 +44,7 @@ const AvatarFallback = React.forwardRef<
4444
)}
4545
{...props}
4646
/>
47-
))
48-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
47+
));
48+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
4949

50-
export { Avatar, AvatarImage, AvatarFallback }
50+
export { Avatar, AvatarImage, AvatarFallback };

components/ui/button.tsx src/components/ui/button.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
1+
import * as React from "react";
2+
import { Slot } from "@radix-ui/react-slot";
3+
import { cva, type VariantProps } from "class-variance-authority";
44

5-
import { cn } from "@/lib/utils"
5+
import { cn } from "@/lib/utils";
66

77
const buttonVariants = cva(
88
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
@@ -31,26 +31,26 @@ const buttonVariants = cva(
3131
size: "default",
3232
},
3333
}
34-
)
34+
);
3535

3636
export interface ButtonProps
3737
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
3838
VariantProps<typeof buttonVariants> {
39-
asChild?: boolean
39+
asChild?: boolean;
4040
}
4141

4242
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
4343
({ className, variant, size, asChild = false, ...props }, ref) => {
44-
const Comp = asChild ? Slot : "button"
44+
const Comp = asChild ? Slot : "button";
4545
return (
4646
<Comp
4747
className={cn(buttonVariants({ variant, size, className }))}
4848
ref={ref}
4949
{...props}
5050
/>
51-
)
51+
);
5252
}
53-
)
54-
Button.displayName = "Button"
53+
);
54+
Button.displayName = "Button";
5555

56-
export { Button, buttonVariants }
56+
export { Button, buttonVariants };

0 commit comments

Comments
 (0)