feat(telemetry): collections, universal server-fn coverage, beacon, client tracker
- activities indexes + client_events/client_errors/rollups/alerts collections - global function middleware via createStart; reads skipped on success - actor stash, denial dedup, control-flow error guards - api route logging, auth event overrides, beacon endpoint, web vitals - centralized admin role checks, shared skeletons, award-badges fix - extracted deriveRunState with tests
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { useAuth } from "@/contexts/auth-context";
|
||||
import { isAdminRole } from "../utils/roles";
|
||||
|
||||
export const useIsAdmin = (): boolean => {
|
||||
const { roles } = useAuth();
|
||||
return isAdminRole(roles);
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { HouseIcon, RankingIcon, ShieldIcon, TrophyIcon, UserCircleIcon } from "@phosphor-icons/react";
|
||||
import { useMemo } from "react";
|
||||
import { useLingui } from "@lingui/react/macro";
|
||||
import { isAdminRole } from "../utils/roles";
|
||||
|
||||
export const useLinks = (userId: string | undefined, roles: string[]) => {
|
||||
const { t } = useLingui();
|
||||
@@ -31,7 +32,7 @@ export const useLinks = (userId: string | undefined, roles: string[]) => {
|
||||
}
|
||||
]
|
||||
|
||||
if (roles.includes('Admin')) {
|
||||
if (isAdminRole(roles)) {
|
||||
links.push({
|
||||
label: t`Admin`,
|
||||
href: '/admin',
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export const ADMIN_ROLE = "Admin";
|
||||
|
||||
export const isAdminRole = (roles?: string[] | null): boolean =>
|
||||
!!roles?.includes(ADMIN_ROLE);
|
||||
Reference in New Issue
Block a user