Skip to content

Commit a7d3e7f

Browse files
authored
feat: add logo to header (#70)
* feat: add logo to header * . * leverage route groups to group logged-in pages together * fix
1 parent ba0e405 commit a7d3e7f

File tree

7 files changed

+35
-6
lines changed

7 files changed

+35
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { headers } from "next/headers";
22
import { redirect } from "next/navigation";
33
import { SignOut } from "@/components/sign-out-button";
44
import { auth } from "@/lib/auth/auth";
5-
import { getServersSummary } from "./actions";
5+
import { getServersSummary } from "../../catalog/actions";
66

77
export default async function CatalogPage() {
88
const session = await auth.api.getSession({

src/app/(authed)/layout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Navbar } from "@/components/navbar";
2+
3+
export default async function AuthedLayout({
4+
children,
5+
}: Readonly<{
6+
children: React.ReactNode;
7+
}>) {
8+
return (
9+
<>
10+
<Navbar />
11+
{children}
12+
</>
13+
);
14+
}

src/app/__tests__/page.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render, screen } from "@testing-library/react";
22
import { expect, test } from "vitest";
3-
import Home from "../page";
3+
import Home from "@/app/(authed)/page";
44

55
test("Home page renders welcome heading and link to catalog when user is logged in", async () => {
66
render(await Home());

src/app/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Metadata } from "next";
22
import { Inter } from "next/font/google";
33
import { Toaster } from "sonner";
4-
import { Navbar } from "@/components/navbar";
54
import "./globals.css";
65

76
const inter = Inter({
@@ -14,15 +13,14 @@ export const metadata: Metadata = {
1413
description: "Generated by create next app",
1514
};
1615

17-
export default function RootLayout({
16+
export default async function RootLayout({
1817
children,
1918
}: Readonly<{
2019
children: React.ReactNode;
2120
}>) {
2221
return (
2322
<html lang="en">
2423
<body className={`${inter.variable} antialiased`}>
25-
<Navbar />
2624
{children}
2725
<Toaster
2826
richColors

src/components/navbar-logo.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Image from "next/image";
2+
3+
export function NavbarLogo() {
4+
return (
5+
<div className="flex items-center gap-2">
6+
<Image
7+
src="/toolhive-icon.svg"
8+
alt="Toolhive"
9+
width={17}
10+
height={19}
11+
className="shrink-0"
12+
/>
13+
<span className="text-2xl font-bold tracking-tight">Toolhive</span>
14+
</div>
15+
);
16+
}

src/components/navbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { headers } from "next/headers";
2+
import { NavbarLogo } from "@/components/navbar-logo";
23
import { UserMenu } from "@/components/user-menu";
34
import { auth } from "@/lib/auth/auth";
45

@@ -10,7 +11,7 @@ export async function Navbar() {
1011
return (
1112
<header className="w-full border-b bg-muted/50">
1213
<div className="container mx-auto flex items-center justify-between px-4 py-4">
13-
<div />
14+
<NavbarLogo />
1415
{session?.user?.name && <UserMenu userName={session.user.name} />}
1516
</div>
1617
</header>

0 commit comments

Comments
 (0)