chore(dev): show session role, convexUserId and Convex URL in sidebar footer to debug empty data in local dev

This commit is contained in:
Esdras Renan 2025-10-10 10:06:46 -03:00
parent 4f03433afe
commit 7b768735ea

View file

@ -161,16 +161,16 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
} }
return ( return (
<Sidebar {...props}> <Sidebar {...props}>
<SidebarHeader className="gap-3"> <SidebarHeader className="gap-3">
<VersionSwitcher <VersionSwitcher
label="Sistema de chamados" label="Sistema de chamados"
versions={[...navigation.versions]} versions={[...navigation.versions]}
defaultVersion={navigation.versions[0]} defaultVersion={navigation.versions[0]}
/> />
<SearchForm placeholder="Buscar tickets" /> <SearchForm placeholder="Buscar tickets" />
</SidebarHeader> </SidebarHeader>
<SidebarContent> <SidebarContent>
{navigation.navMain.map((group) => { {navigation.navMain.map((group) => {
if (!canAccess(group.requiredRole)) return null if (!canAccess(group.requiredRole)) return null
const visibleItems = group.items.filter((item) => canAccess(item.requiredRole)) const visibleItems = group.items.filter((item) => canAccess(item.requiredRole))
@ -195,7 +195,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
</SidebarGroup> </SidebarGroup>
) )
})} })}
</SidebarContent> </SidebarContent>
<SidebarFooter> <SidebarFooter>
{isLoading ? ( {isLoading ? (
<div className="flex items-center gap-3 rounded-lg border border-border/70 bg-sidebar p-3 shadow-sm"> <div className="flex items-center gap-3 rounded-lg border border-border/70 bg-sidebar p-3 shadow-sm">
@ -214,9 +214,33 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
}} }}
/> />
)} )}
{process.env.NODE_ENV !== "production" ? (
<div className="mt-3 rounded-lg border border-dashed border-slate-300 bg-slate-50 p-2 text-[11px] text-slate-700">
<div className="flex items-center justify-between">
<span className="font-semibold">Dev</span>
<span className="rounded-full border border-slate-300 bg-white px-2 py-[2px]">{isStaff ? "staff" : "guest"}</span>
</div>
<div className="mt-1 grid gap-[2px]">
<div>
<span className="text-slate-500">role: </span>
<span className="font-mono">{(session?.user as any)?.role ?? "(none)"}</span>
</div>
<div className="truncate">
<span className="text-slate-500">convexUserId: </span>
<span className="font-mono">{convexUserId ?? "(null)"}</span>
</div>
{process.env.NEXT_PUBLIC_CONVEX_URL ? (
<div className="truncate">
<span className="text-slate-500">convex: </span>
<span className="font-mono">{process.env.NEXT_PUBLIC_CONVEX_URL}</span>
</div>
) : null}
</div>
</div>
) : null}
</SidebarFooter> </SidebarFooter>
<SidebarRail /> <SidebarRail />
</Sidebar> </Sidebar>
) )
} }