add url analytics and logs routers

This commit is contained in:
oiov
2025-10-30 17:39:18 +08:00
parent 7ee88c8026
commit 802db8724a
6 changed files with 77 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
import { Skeleton } from "@/components/ui/skeleton";
export default function DashboardUrlsLoading() {
return (
<>
<Skeleton className="h-[400px] w-full rounded-lg" />
</>
);
}

View File

@@ -0,0 +1,22 @@
import { redirect } from "next/navigation";
import { getCurrentUser } from "@/lib/session";
import { constructMetadata } from "@/lib/utils";
import Globe from "@/app/(protected)/dashboard/urls/globe";
export const metadata = constructMetadata({
title: "Globe Analytics",
description: "Display link's globe analytics.",
});
export default async function DashboardPage() {
const user = await getCurrentUser();
if (!user?.id) redirect("/login");
return (
<>
<Globe isAdmin />
</>
);
}

View File

@@ -0,0 +1,11 @@
import { Skeleton } from "@/components/ui/skeleton";
import { DashboardHeader } from "@/components/dashboard/header";
export default function DashboardUrlsLoading() {
return (
<>
<DashboardHeader heading="Live Logs" text="" />
<Skeleton className="h-[400px] w-full rounded-lg" />
</>
);
}

View File

@@ -0,0 +1,24 @@
import { redirect } from "next/navigation";
import { getCurrentUser } from "@/lib/session";
import { constructMetadata } from "@/lib/utils";
import { DashboardHeader } from "@/components/dashboard/header";
import LiveLog from "@/app/(protected)/dashboard/urls/live-logs";
export const metadata = constructMetadata({
title: "Live Logs",
description: "Display link's real-time live logs.",
});
export default async function DashboardPage() {
const user = await getCurrentUser();
if (!user?.id) redirect("/login");
return (
<>
<DashboardHeader heading="Live Logs" text="" />
<LiveLog live={true} admin />
</>
);
}

View File

@@ -120,6 +120,16 @@ export const sidebarLinks: SidebarNavItem[] = [
title: "Cloud Storage Manage",
authorizeOnly: UserRole.ADMIN,
},
{
href: "/admin/urls/analytics",
title: "Analytics",
authorizeOnly: UserRole.ADMIN,
},
{
href: "/admin/urls/logs",
title: "Ip Logs",
authorizeOnly: UserRole.ADMIN,
},
],
},
{

File diff suppressed because one or more lines are too long