Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { headers } from "next/headers";
import { redirect } from "next/navigation";
import { SignOut } from "@/components/sign-out-button";
import { auth } from "@/lib/auth/auth";
import { getServersSummary } from "./actions";
import { getServersSummary } from "../../catalog/actions";

export default async function CatalogPage() {
const session = await auth.api.getSession({
Expand Down
14 changes: 14 additions & 0 deletions src/app/(authed)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Navbar } from "@/components/navbar";

export default async function AuthedLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<>
<Navbar />
{children}
</>
);
}
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/__tests__/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react";
import { expect, test } from "vitest";
import Home from "../page";
import Home from "@/app/(authed)/page";

test("Home page renders welcome heading and link to catalog when user is logged in", async () => {
render(await Home());
Expand Down
4 changes: 1 addition & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Toaster } from "sonner";
import { Navbar } from "@/components/navbar";
import "./globals.css";

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

export default function RootLayout({
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${inter.variable} antialiased`}>
<Navbar />
{children}
<Toaster
richColors
Expand Down
16 changes: 16 additions & 0 deletions src/components/navbar-logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Image from "next/image";

export function NavbarLogo() {
return (
<div className="flex items-center gap-2">
<Image
src="/toolhive-icon.svg"
alt="Toolhive"
width={17}
height={19}
className="shrink-0"
/>
<span className="text-2xl font-bold tracking-tight">Toolhive</span>
</div>
);
}
3 changes: 2 additions & 1 deletion src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { headers } from "next/headers";
import { NavbarLogo } from "@/components/navbar-logo";
import { UserMenu } from "@/components/user-menu";
import { auth } from "@/lib/auth/auth";

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