fix: viewer cant see users now
This commit is contained in:
@@ -19,11 +19,11 @@ import { authApi, api } from '@/lib/api/client';
|
||||
import { toast } from '@/components/ui/toast';
|
||||
|
||||
const navItems = [
|
||||
{ href: '/dashboard', label: 'Overview', icon: LayoutDashboard },
|
||||
{ href: '/dashboard/tabs', label: 'Open Tabs', icon: ClipboardList },
|
||||
{ href: '/dashboard/users', label: 'Users', icon: Monitor },
|
||||
{ href: '/dashboard/commands', label: 'Command History', icon: Terminal },
|
||||
{ href: '/dashboard/settings', label: 'Settings', icon: Settings },
|
||||
{ href: '/dashboard', label: 'Overview', icon: LayoutDashboard, neededRole: 'viewer' },
|
||||
{ href: '/dashboard/tabs', label: 'Open Tabs', icon: ClipboardList, neededRole: 'viewer' },
|
||||
{ href: '/dashboard/users', label: 'Users', icon: Monitor, neededRole: 'admin' },
|
||||
{ href: '/dashboard/commands', label: 'Command History', icon: Terminal, neededRole: 'viewer' },
|
||||
{ href: '/dashboard/settings', label: 'Settings', icon: Settings, neededRole: 'viewer' },
|
||||
];
|
||||
|
||||
export default function DashboardLayout({
|
||||
@@ -110,6 +110,11 @@ export default function DashboardLayout({
|
||||
{navItems.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const active = pathname === item.href;
|
||||
|
||||
if (item.neededRole === 'admin' && user?.role !== 'admin') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
|
||||
@@ -107,23 +107,6 @@ export default function SettingsPage() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>API</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Base URL</span>
|
||||
<span className="font-mono text-xs">{process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api/v1'}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Swagger</span>
|
||||
<span className="font-mono text-xs">
|
||||
{process.env.NEXT_PUBLIC_API_URL?.replace('/api/v1', '/api/docs') || 'http://localhost:3001/api/docs'}
|
||||
</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{regDialog && (
|
||||
|
||||
@@ -4,7 +4,6 @@ export function EmptyState({ title, description }: { title: string; description:
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="flex flex-col items-center justify-center py-12">
|
||||
<div className="text-4xl mb-4">📭</div>
|
||||
<h3 className="text-lg font-semibold mb-1">{title}</h3>
|
||||
<p className="text-sm text-muted-foreground">{description}</p>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user