From 81bfc92f71dc315bcd78880ccccf16101d74fc17 Mon Sep 17 00:00:00 2001 From: Moinul Moin Date: Sat, 11 Nov 2023 11:34:00 +0600 Subject: [PATCH 1/5] refactor: remove stickiness from header and rework on header and footer --- src/app/dashboard/layout.tsx | 4 +- src/app/dashboard/projects/page.tsx | 2 +- src/app/layout.tsx | 3 +- src/components/layout/footer.tsx | 17 +----- src/components/layout/header/index.tsx | 8 ++- src/components/layout/header/navbar.tsx | 77 +++++++++++++------------ src/components/layout/user-nav.tsx | 15 +++-- src/components/sections/hero.tsx | 2 +- 8 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index 047892d..c12f2c3 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -6,8 +6,8 @@ interface DashboardLayoutProps { export default function DashboardLayout({ children }: DashboardLayoutProps) { return ( -
-
+
+
diff --git a/src/app/dashboard/projects/page.tsx b/src/app/dashboard/projects/page.tsx index c95eb44..830d55f 100644 --- a/src/app/dashboard/projects/page.tsx +++ b/src/app/dashboard/projects/page.tsx @@ -7,7 +7,7 @@ export default async function Projects() { const projects = await getProjects(); return ( -
+
{projects.map((project) => ( -
-
+
{children} {signinDialog}
diff --git a/src/components/layout/footer.tsx b/src/components/layout/footer.tsx index 0260321..96bd4ac 100644 --- a/src/components/layout/footer.tsx +++ b/src/components/layout/footer.tsx @@ -1,6 +1,7 @@ import Image from "next/image"; import Link from "next/link"; import { siteConfig } from "~/config/site"; +import ThemeToggle from "../shared/theme-toggle"; export default function Footer() { return ( @@ -26,20 +27,8 @@ export default function Footer() {

-

- - About - - - Changelog - -

+ +
); diff --git a/src/components/layout/header/index.tsx b/src/components/layout/header/index.tsx index c8b60f0..00014db 100644 --- a/src/components/layout/header/index.tsx +++ b/src/components/layout/header/index.tsx @@ -4,5 +4,11 @@ import Navbar from "./navbar"; export default async function Header() { const currentUser = (await getUser()) as CurrentUser; - return ; + return ( +
+
+ +
+
+ ); } diff --git a/src/components/layout/header/navbar.tsx b/src/components/layout/header/navbar.tsx index 40d6e3d..3c3377c 100644 --- a/src/components/layout/header/navbar.tsx +++ b/src/components/layout/header/navbar.tsx @@ -1,50 +1,51 @@ -"use client"; - import Image from "next/image"; import Link from "next/link"; import { buttonVariants } from "~/components/ui/button"; -import useScroll from "~/hooks/use-scroll"; -import { cn } from "~/lib/utils"; import { type CurrentUser } from "~/types"; -import ThemeToggle from "../../shared/theme-toggle"; import UserNav from "../user-nav"; -export default function Navbar({ currentUser }: { currentUser: CurrentUser }) { - const scrolled = useScroll(50); - +export default function Navbar({ + loggedInUser, +}: { + loggedInUser: CurrentUser; +}) { return ( -
-
-
- - ChadNext logo -

ChadNext

+
+ ); } diff --git a/src/components/layout/user-nav.tsx b/src/components/layout/user-nav.tsx index f468042..178939f 100644 --- a/src/components/layout/user-nav.tsx +++ b/src/components/layout/user-nav.tsx @@ -1,8 +1,9 @@ +"use client"; + import { LayoutDashboardIcon, LogOut } from "lucide-react"; import { signOut } from "next-auth/react"; import Link from "next/link"; import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar"; -import { Button } from "~/components/ui/button"; import { DropdownMenu, DropdownMenuContent, @@ -17,14 +18,12 @@ export default function UserNav({ user }: { user: CurrentUser }) { return ( - + + + {user.name?.[0]} + - +

{user.name}

diff --git a/src/components/sections/hero.tsx b/src/components/sections/hero.tsx index c4497a6..e314e86 100644 --- a/src/components/sections/hero.tsx +++ b/src/components/sections/hero.tsx @@ -31,7 +31,7 @@ export default async function Hero() { Introducing ChadNext

-

+

Quick Starter Template for your Next.js project

From d823ed471b7a3396715d5a8255d326694bf51486 Mon Sep 17 00:00:00 2001 From: Moinul Moin Date: Mon, 4 Dec 2023 21:35:17 +0600 Subject: [PATCH 2/5] refactor: little bit UI tweaks --- src/app/dashboard/projects/action.ts | 3 +++ src/app/dashboard/projects/page.tsx | 3 +-- src/app/dashboard/settings/settings-form.tsx | 4 ++-- src/components/layout/footer.tsx | 4 ++-- src/components/layout/header/navbar.tsx | 10 +++++----- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/app/dashboard/projects/action.ts b/src/app/dashboard/projects/action.ts index 65c3fa1..e7d76d7 100644 --- a/src/app/dashboard/projects/action.ts +++ b/src/app/dashboard/projects/action.ts @@ -53,6 +53,9 @@ export async function getProjects() { where: { userId: user.id, }, + orderBy: { + createdAt: "desc", + }, }); return projects as Project[]; } diff --git a/src/app/dashboard/projects/page.tsx b/src/app/dashboard/projects/page.tsx index 830d55f..0087b3c 100644 --- a/src/app/dashboard/projects/page.tsx +++ b/src/app/dashboard/projects/page.tsx @@ -8,6 +8,7 @@ export default async function Projects() { return (

+ {projects.map((project) => ( ))} - -
); } diff --git a/src/app/dashboard/settings/settings-form.tsx b/src/app/dashboard/settings/settings-form.tsx index 1cb31d2..44fb54b 100644 --- a/src/app/dashboard/settings/settings-form.tsx +++ b/src/app/dashboard/settings/settings-form.tsx @@ -115,14 +115,14 @@ export default function SettingsForm({
( - Image + Picture diff --git a/src/components/layout/footer.tsx b/src/components/layout/footer.tsx index 96bd4ac..1bc2eb2 100644 --- a/src/components/layout/footer.tsx +++ b/src/components/layout/footer.tsx @@ -6,8 +6,8 @@ import ThemeToggle from "../shared/theme-toggle"; export default function Footer() { return (