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 @@ -77,7 +77,7 @@ const AdminDashboard = () => {
const { data: reportCounts } = api.report.getCounts.useQuery();

return (
<div className="mx-auto max-w-6xl px-0 py-4 sm:px-4 sm:py-8">
<div className="mx-auto max-w-6xl">
<div className="mb-8">
<p className="eyebrow">
<span className="slash">{"// "}</span>admin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { getServerAuthSession } from "@/server/auth";
import { redirect } from "next/navigation";
import { Suspense } from "react";
import ModerationQueue from "./_client";

Expand All @@ -8,13 +6,8 @@ export const metadata = {
description: "Review and manage reported content",
};

export default async function Page() {
const session = await getServerAuthSession();

if (!session?.user || session.user.role !== "ADMIN") {
redirect("/");
}

// Admin-role gate is enforced in app/(admin)/layout.tsx.
export default function Page() {
return (
<Suspense>
<ModerationQueue />
Expand Down
11 changes: 11 additions & 0 deletions app/(admin)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import AdminDashboard from "./_client";

export const metadata = {
title: "Admin Dashboard - Codú",
description: "Admin dashboard for managing Codú platform",
};

// Admin-role gate is enforced in app/(admin)/layout.tsx.
export default function Page() {
return <AdminDashboard />;
}
11 changes: 11 additions & 0 deletions app/(admin)/admin/sources/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Content from "./_client";

export const metadata = {
title: "Feed Sources - Admin",
description: "Manage RSS feed sources for the content aggregator",
};

// Admin-role gate is enforced in app/(admin)/layout.tsx.
export default function Page() {
return <Content />;
}
File renamed without changes.
11 changes: 11 additions & 0 deletions app/(admin)/admin/tags/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import TagsAdmin from "./_client";

export const metadata = {
title: "Tag Management - Codú Admin",
description: "Manage tags and topics on the Codú platform",
};

// Admin-role gate is enforced in app/(admin)/layout.tsx.
export default function Page() {
return <TagsAdmin />;
}
11 changes: 11 additions & 0 deletions app/(admin)/admin/users/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import UserManagement from "./_client";

export const metadata = {
title: "User Management - Codú Admin",
description: "Search and manage users",
};

// Admin-role gate is enforced in app/(admin)/layout.tsx.
export default function Page() {
return <UserManagement />;
}
34 changes: 34 additions & 0 deletions app/(admin)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import { redirect } from "next/navigation";
import { getServerAuthSession } from "@/server/auth";
import { AdminShell } from "@/components/Admin/AdminShell";

export const metadata = {
title: "Admin - Codú",
description: "Private admin dashboard for managing the Codú platform",
robots: { index: false, follow: false },
};

/**
* Layout for the private `(admin)` route group. The admin-role gate is enforced
* ONCE here for the whole section, so individual pages don't repeat it. This
* group is a sibling of `(app)`, so it is fully outside the public AppShell
* rails — admin gets its own full-width cockpit.
*/
export default async function AdminLayout({
children,
}: {
children: React.ReactNode;
}) {
const session = await getServerAuthSession();

if (!session?.user || session.user.role !== "ADMIN") {
redirect("/");
}

return (
<AdminShell user={{ name: session.user.name, image: session.user.image }}>
{children}
</AdminShell>
);
}
18 changes: 0 additions & 18 deletions app/(app)/admin/page.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions app/(app)/admin/sources/page.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions app/(app)/admin/tags/page.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions app/(app)/admin/users/page.tsx

This file was deleted.

Loading
Loading