initial admin

This commit is contained in:
Dreamgineer
2025-10-15 01:03:31 -04:00 Unverified
parent ba6143f63b
commit fc97ebc35f
99 changed files with 2351 additions and 1408 deletions
+12
View File
@@ -0,0 +1,12 @@
import { DataTable } from "@/components/tantable";
import { db } from "@/lib/db";
import { cdn } from "@/lib/db/schema";
import { cdnColumns } from "./table";
export default async function CdnManagerPage() {
const files = await db
.select({ id: cdn.id, name: cdn.name, size: cdn.size })
.from(cdn)
.orderBy(cdn.name);
return <DataTable columns={cdnColumns} data={files} />;
}
+24
View File
@@ -0,0 +1,24 @@
"use client";
import type { ColumnDef } from "@tanstack/react-table";
export const cdnColumns: ColumnDef<{
id: string;
name: string | null;
size: string;
}>[] = [
{
accessorFn: (row) => row.name || `[${row.id}]`,
header: "Name",
},
{
accessorFn: (row) => b2s(Number(row.size)),
header: "Size",
},
];
const b2s = (t: number) => {
let e = (Math.log2(t) / 10) | 0;
// biome-ignore lint/suspicious/noAssignInExpressions: copied
return `${(t / 1024 ** (e = e <= 0 ? 0 : e)).toFixed(1)}${" KMGP"[e]}B`;
};