HifiPlanet-Website/hifi-src/src/components/RequirePermission.jsx
Maaxxs b6909e756c Redesign navbar mobile menu and rework site color palette
Swaps navbar layout (theme toggle left, nav links right), replaces the
mobile dropdown with a fullscreen overlay whose items fly in top-to-bottom,
and renames the site-wide "slate" gray to "neutral" to remove a blue
undertone that clashed with the brand green. Also converts the flat
saturated-green YouTube and stats sections into dark backgrounds with
green used only as an accent, matching typical premium car-audio branding.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 16:21:48 +02:00

22 lines
835 B
JavaScript

import { useAuth } from '../context/AuthContext.jsx';
export default function RequirePermission({ permission, children }) {
const { hasPermission } = useAuth();
const permissions = Array.isArray(permission) ? permission : [permission];
const allowed = permissions.some((p) => hasPermission(p));
if (!allowed) {
return (
<div className="rounded-xl border border-neutral-200 bg-white p-8 text-center dark:border-neutral-800 dark:bg-neutral-900">
<h1 className="mb-2 text-lg font-bold text-neutral-900 dark:text-white">Keine Berechtigung</h1>
<p className="text-sm text-neutral-500 dark:text-neutral-400">
Du hast keinen Zugriff auf diesen Bereich. Bitte wende dich an einen Administrator, falls du hier
Zugriff brauchst.
</p>
</div>
);
}
return children;
}