diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index d1252b9..c5aba37 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -1,4 +1,5 @@ import { AppSidebar } from "@/components/dashboardComponents/AppSidebar"; +import { DashboardNavbar } from "@/components/dashboardComponents/DashboardNavbar"; import MobileSidear from "@/components/dashboardComponents/MobileSidebar"; import type { Metadata } from "next"; export const metadata: Metadata = { @@ -11,14 +12,12 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( -
-
- -
+
+
-
{children}
+
{children}
); -} \ No newline at end of file +} diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index b58c5de..d64016d 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -17,8 +17,6 @@ import { Trophy, TrendingUp, CheckCircle, - XCircle, - Calendar } from "lucide-react"; export default function Dashboard() { diff --git a/app/layout.tsx b/app/layout.tsx index 7e00d5d..b6a169c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,7 +2,6 @@ import "./globals.css"; import type { Metadata } from "next"; import { Inter } from "next/font/google"; import { ThemeProvider } from "@/components/theme-provider"; -import { V2Navbar } from "@/components/DashboardV2/V2Navbar"; const inter = Inter({ subsets: ["latin"] }); @@ -20,7 +19,6 @@ export default function RootLayout({ - {children} diff --git a/app/page.tsx b/app/page.tsx index b1abbdb..9267ade 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -9,6 +9,7 @@ import { PricingSection } from "@/components/DashboardV2/PricingSection"; import { ServicesSection } from "@/components/DashboardV2/ServicesSection"; import { TeamSection } from "@/components/DashboardV2/TeamSection"; import { TestimonialSection } from "@/components/DashboardV2/TestimonialSection"; +import { V2Navbar } from "@/components/DashboardV2/V2Navbar"; export const metadata = { title: "LeetCode Journal - Your Coding Companion", @@ -41,6 +42,7 @@ export const metadata = { export default function Home() { return (
+ diff --git a/components/AuthComponent/Logout.tsx b/components/AuthComponent/Logout.tsx new file mode 100644 index 0000000..a2ab121 --- /dev/null +++ b/components/AuthComponent/Logout.tsx @@ -0,0 +1,62 @@ +"use client"; + +import React from "react"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "../ui/alert-dialog"; +import { LogOut } from "lucide-react"; +import { signout } from "@/app/actions/action"; +import { useRouter } from "next/navigation"; +import { Button } from "../ui/button"; + +type buttonVariant = + | "link" + | "default" + | "destructive" + | "outline" + | "secondary" + | "ghost" + | null + | undefined; + +export default function Logout({ variant = "default" }: { variant?: buttonVariant }) { + const router = useRouter(); + const handleLogout = async () => { + try { + signout(); + router.push("/auth/signin"); + } catch (error) { + console.error("Sign out error:", error); + } + }; + return ( + + + + + + + Are you absolutely sure? + + This action will Logout you from the application. + + + + Cancel + Continue + + + + ); +} diff --git a/components/dashboardComponents/AppSidebar.tsx b/components/dashboardComponents/AppSidebar.tsx index c8db18f..548e02e 100644 --- a/components/dashboardComponents/AppSidebar.tsx +++ b/components/dashboardComponents/AppSidebar.tsx @@ -27,21 +27,14 @@ import { AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog" +import Logout from "../AuthComponent/Logout"; export function AppSidebar() { const { setTheme, theme } = useTheme(); const pathname = usePathname(); - const router = useRouter(); const [isCollapsed, setIsCollapsed] = React.useState(false); - const handleLogout = async () => { - try { - signout(); - router.push('/auth/signin'); - } catch (error) { - console.error("Sign out error:", error); - } - }; + return (
diff --git a/components/dashboardComponents/DashboardNavbar.tsx b/components/dashboardComponents/DashboardNavbar.tsx new file mode 100644 index 0000000..edcbe1c --- /dev/null +++ b/components/dashboardComponents/DashboardNavbar.tsx @@ -0,0 +1,89 @@ +"use client"; +import { Menu } from "lucide-react"; +import React from "react"; +import { + Sheet, + SheetContent, + SheetFooter, + SheetHeader, + SheetTitle, + SheetTrigger, +} from "../ui/sheet"; +import { Separator } from "../ui/separator"; +import { Button } from "../ui/button"; +import Link from "next/link"; +import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"; +import { ToggleTheme } from "../DashboardV2/ToggleTheme"; +import Logout from "../AuthComponent/Logout"; +import { SidebarData } from "@/data/SidebarData"; + +export const DashboardNavbar = () => { + const [isOpen, setIsOpen] = React.useState(false); + return ( +
+ + + + LC + + Leetcode Journal + + {/* */} +
+ + + setIsOpen(!isOpen)} + className="cursor-pointer lg:hidden" + /> + + + +
+ + + + + + LC + + Leetcode Journal + + + + +
+ {SidebarData.map(({ href, title }) => ( + + ))} +
+
+ + + + + + + +
+ +
+ +
+ + +
+
+ ); +}; diff --git a/components/ui/button.tsx b/components/ui/button.tsx index 36496a2..0672e9b 100644 --- a/components/ui/button.tsx +++ b/components/ui/button.tsx @@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-2xl 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", { variants: { variant: { @@ -21,8 +21,8 @@ const buttonVariants = cva( }, size: { default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", + sm: "h-9 rounded-2xl px-3", + lg: "h-11 rounded-2xl px-8", icon: "h-10 w-10", }, },