Spaces:
Sleeping
Sleeping
File size: 3,367 Bytes
dc11950 4dc66a3 1d2a779 4dc66a3 345b8ff dc11950 4dc66a3 dc11950 1d2a779 dc11950 4dc66a3 345b8ff 4dc66a3 1d2a779 4dc66a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
"use client";
import Link from "next/link";
import { AnalyticsPanel } from "@/components/analytics-panel";
import { TenantHeatmap } from "@/components/tenant-heatmap";
import { Footer } from "@/components/footer";
import { TenantSelector } from "@/components/tenant-selector";
import { useTenant } from "@/contexts/TenantContext";
import { canViewAnalytics } from "@/lib/permissions";
export default function AnalyticsPage() {
const { role } = useTenant();
if (!canViewAnalytics(role)) {
return (
<main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8">
<header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40">
<div className="flex items-center justify-between gap-3">
<div className="flex items-center gap-3 text-base font-semibold">
<span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950">
IC
</span>
IntegraChat · Analytics
</div>
<div className="flex items-center gap-4">
<TenantSelector />
<Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white">
← Back Home
</Link>
</div>
</div>
</header>
<div className="rounded-2xl border border-red-500/50 bg-red-500/10 p-8 text-center">
<h2 className="text-2xl font-bold text-red-300 mb-2">Access Denied</h2>
<p className="text-slate-300 mb-4">
Unable to access analytics. Please check your role permissions.
</p>
<p className="text-sm text-slate-400">
Your current role: <strong className="text-slate-200">{role.charAt(0).toUpperCase() + role.slice(1)}</strong>
</p>
</div>
<Footer />
</main>
);
}
return (
<main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8">
<header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40">
<div className="flex items-center justify-between gap-3">
<div className="flex items-center gap-3 text-base font-semibold">
<span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950">
IC
</span>
IntegraChat · Analytics
</div>
<div className="flex items-center gap-4">
<TenantSelector />
<Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white">
← Back Home
</Link>
</div>
</div>
<p className="text-sm text-slate-300">
Inspect tenant-wide metrics including tool usage, red-flag violations, and overall activity—all powered by the
FastAPI analytics endpoints.
</p>
</header>
<AnalyticsPanel />
<div className="mt-6">
<TenantHeatmap days={7} />
</div>
<Footer />
</main>
);
}
|