fixing platform admin

This commit is contained in:
root
2026-05-06 22:58:23 -04:00
parent 695a7f7cc7
commit 750ae56a29
175 changed files with 31249 additions and 328 deletions
@@ -11,24 +11,30 @@ import {
UserPlus,
BarChart2,
CreditCard,
Bell,
Settings,
LogOut,
} from 'lucide-react'
import { useClerk, useUser } from '@clerk/nextjs'
import { clerkFrontendEnabled } from '@/lib/clerk'
import { useDashboardI18n } from '@/components/I18nProvider'
import { marketplaceUrl } from '@/lib/urls'
const NAV_ITEMS = [
{ href: '/dashboard', label: 'Dashboard', icon: LayoutDashboard, exact: true },
{ href: '/dashboard/fleet', label: 'Fleet', icon: Car },
{ href: '/dashboard/reservations', label: 'Reservations', icon: Calendar },
{ href: '/dashboard/customers', label: 'Customers', icon: Users },
{ href: '/dashboard/offers', label: 'Offers', icon: Tag },
{ href: '/dashboard/team', label: 'Team', icon: UserPlus },
{ href: '/dashboard/reports', label: 'Reports', icon: BarChart2 },
{ href: '/dashboard/billing', label: 'Billing', icon: CreditCard },
{ href: '/dashboard/settings', label: 'Settings', icon: Settings },
]
{ href: '/dashboard', key: 'dashboard', icon: LayoutDashboard, exact: true },
{ href: '/dashboard/fleet', key: 'fleet', icon: Car },
{ href: '/dashboard/reservations', key: 'reservations', icon: Calendar },
{ href: '/dashboard/customers', key: 'customers', icon: Users },
{ href: '/dashboard/offers', key: 'offers', icon: Tag },
{ href: '/dashboard/team', key: 'team', icon: UserPlus },
{ href: '/dashboard/reports', key: 'reports', icon: BarChart2 },
{ href: '/dashboard/billing', key: 'billing', icon: CreditCard },
{ href: '/dashboard/notifications', key: 'notifications', icon: Bell },
{ href: '/dashboard/settings', key: 'settings', icon: Settings },
] as const
export default function Sidebar() {
function SidebarWithClerk() {
const { dict } = useDashboardI18n()
const pathname = usePathname()
const { signOut } = useClerk()
const { user } = useUser()
@@ -41,12 +47,12 @@ export default function Sidebar() {
return (
<aside className="fixed inset-y-0 left-0 w-64 bg-slate-900 flex flex-col z-40">
{/* Logo */}
<div className="flex items-center gap-3 px-6 py-5 border-b border-slate-800">
<Link href={marketplaceUrl} className="flex items-center gap-3 px-6 py-5 border-b border-slate-800">
<div className="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
<Car className="w-4 h-4 text-white" />
</div>
<span className="font-bold text-white text-sm tracking-wide">RentalDriveGo</span>
</div>
</Link>
{/* Navigation */}
<nav className="flex-1 px-3 py-4 space-y-0.5 overflow-y-auto">
@@ -65,7 +71,7 @@ export default function Sidebar() {
].join(' ')}
>
<Icon className="w-4 h-4 flex-shrink-0" />
{item.label}
{dict.nav[item.key]}
</Link>
)
})}
@@ -91,9 +97,68 @@ export default function Sidebar() {
className="mt-2 w-full flex items-center gap-3 px-3 py-2 text-sm text-slate-400 hover:text-white hover:bg-slate-800 rounded-lg transition-colors"
>
<LogOut className="w-4 h-4" />
Sign out
{dict.signOut}
</button>
</div>
</aside>
)
}
function SidebarWithoutClerk() {
const { dict } = useDashboardI18n()
const pathname = usePathname()
const isActive = (item: typeof NAV_ITEMS[0]) => {
if (item.exact) return pathname === item.href
return pathname.startsWith(item.href)
}
return (
<aside className="fixed inset-y-0 left-0 w-64 bg-slate-900 flex flex-col z-40">
<Link href={marketplaceUrl} className="flex items-center gap-3 px-6 py-5 border-b border-slate-800">
<div className="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
<Car className="w-4 h-4 text-white" />
</div>
<span className="font-bold text-white text-sm tracking-wide">RentalDriveGo</span>
</Link>
<nav className="flex-1 px-3 py-4 space-y-0.5 overflow-y-auto">
{NAV_ITEMS.map((item) => {
const Icon = item.icon
const active = isActive(item)
return (
<Link
key={item.href}
href={item.href}
className={[
'flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-colors',
active
? 'bg-blue-600 text-white'
: 'text-slate-400 hover:text-white hover:bg-slate-800',
].join(' ')}
>
<Icon className="w-4 h-4 flex-shrink-0" />
{dict.nav[item.key]}
</Link>
)
})}
</nav>
<div className="px-3 py-4 border-t border-slate-800">
<div className="flex items-center gap-3 px-3 py-2 rounded-lg">
<div className="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white text-xs font-semibold flex-shrink-0">
D
</div>
<div className="flex-1 min-w-0">
<p className="text-sm font-medium text-white truncate">{dict.demoUser}</p>
<p className="text-xs text-slate-400 truncate">{dict.clerkDisabled}</p>
</div>
</div>
</div>
</aside>
)
}
export default function Sidebar() {
return clerkFrontendEnabled ? <SidebarWithClerk /> : <SidebarWithoutClerk />
}