20 lines
762 B
TypeScript
20 lines
762 B
TypeScript
import Link from "next/link";
|
|
import type { ServerProps } from "payload";
|
|
import { canViewAnalytics } from "@/access";
|
|
|
|
export function AnalyticsNavLink({ user }: ServerProps) {
|
|
// Payload's custom views/nav links have no declarative `access` option -
|
|
// this component must gate itself (see also AdminAnalyticsView.tsx, which
|
|
// re-checks the same thing for direct navigation to /admin/analytics).
|
|
if (!canViewAnalytics({ req: { user } } as Parameters<typeof canViewAnalytics>[0])) return null;
|
|
|
|
return (
|
|
<div className="anouma-custom-nav-item">
|
|
<Link href="/admin/analytics" className="anouma-custom-nav-link">
|
|
<span className="anouma-custom-nav-link__icon">03</span>
|
|
<span>Auswertung</span>
|
|
</Link>
|
|
</div>
|
|
);
|
|
}
|