- Introduce SUPER_ADMIN, ADMIN, CUSTOMER_SUPPORT with admin-roles helpers and useAdminRole hook - New pages: subscription transactions, system members, issues, FAQ & support, notification broadcast - Services and API paths for admin subscription-transactions, system-members, issues, faq, broadcast - Nav and quick search filtered by role; login accepts all panel roles Made-with: Cursor
329 lines
7.6 KiB
TypeScript
329 lines
7.6 KiB
TypeScript
import type { LucideIcon } from "lucide-react"
|
|
import {
|
|
LayoutDashboard,
|
|
Bell,
|
|
Receipt,
|
|
FileSearch,
|
|
ClipboardList,
|
|
CreditCard,
|
|
FileClock,
|
|
Users,
|
|
FileText,
|
|
Settings,
|
|
Wrench,
|
|
Megaphone,
|
|
Activity,
|
|
Shield,
|
|
BarChart3,
|
|
Heart,
|
|
AlertTriangle,
|
|
Key,
|
|
Gauge,
|
|
DollarSign,
|
|
HardDrive,
|
|
ArrowRightLeft,
|
|
UserCog,
|
|
LifeBuoy,
|
|
HelpCircle,
|
|
Send,
|
|
} from "lucide-react"
|
|
|
|
export interface AdminSearchRoute {
|
|
id: string
|
|
path: string
|
|
title: string
|
|
/** Sub-heading style line shown under the title */
|
|
description: string
|
|
group: string
|
|
icon: LucideIcon
|
|
}
|
|
|
|
export const ADMIN_SEARCH_ROUTES: AdminSearchRoute[] = [
|
|
{
|
|
id: "dashboard",
|
|
path: "/admin/dashboard",
|
|
title: "Dashboard",
|
|
description:
|
|
"High-level metrics, recent invoices, and platform status at a glance.",
|
|
group: "Overview",
|
|
icon: LayoutDashboard,
|
|
},
|
|
{
|
|
id: "notifications",
|
|
path: "/notifications",
|
|
title: "Notifications",
|
|
description:
|
|
"System alerts and messages for your account; mark read or filter.",
|
|
group: "Overview",
|
|
icon: Bell,
|
|
},
|
|
{
|
|
id: "invoices",
|
|
path: "/admin/invoices",
|
|
title: "Invoices",
|
|
description: "Browse, search, and manage issued invoices.",
|
|
group: "Commerce",
|
|
icon: Receipt,
|
|
},
|
|
{
|
|
id: "proforma",
|
|
path: "/admin/proforma",
|
|
title: "Proforma",
|
|
description: "View and manage proforma invoices and drafts.",
|
|
group: "Commerce",
|
|
icon: FileSearch,
|
|
},
|
|
{
|
|
id: "proforma-requests",
|
|
path: "/admin/proforma-requests",
|
|
title: "Proforma requests",
|
|
description: "Review and process incoming proforma requests.",
|
|
group: "Commerce",
|
|
icon: ClipboardList,
|
|
},
|
|
{
|
|
id: "payments",
|
|
path: "/admin/payments",
|
|
title: "Payments",
|
|
description: "Recorded payments and transaction history.",
|
|
group: "Commerce",
|
|
icon: CreditCard,
|
|
},
|
|
{
|
|
id: "payment-requests",
|
|
path: "/admin/payment-requests",
|
|
title: "Payment requests",
|
|
description: "Pending and processed payment requests.",
|
|
group: "Commerce",
|
|
icon: FileClock,
|
|
},
|
|
{
|
|
id: "subscription-txns",
|
|
path: "/admin/transactions/subscriptions",
|
|
title: "Subscription transactions",
|
|
description:
|
|
"Successful and failed subscription charges for the platform.",
|
|
group: "Commerce",
|
|
icon: ArrowRightLeft,
|
|
},
|
|
{
|
|
id: "users",
|
|
path: "/admin/users",
|
|
title: "Users",
|
|
description: "Search, create, import, and manage user accounts.",
|
|
group: "People & activity",
|
|
icon: Users,
|
|
},
|
|
{
|
|
id: "system-members",
|
|
path: "/admin/system-members",
|
|
title: "System users",
|
|
description:
|
|
"Internal panel accounts (system admin, admin, customer support).",
|
|
group: "People & activity",
|
|
icon: UserCog,
|
|
},
|
|
{
|
|
id: "logs",
|
|
path: "/admin/logs",
|
|
title: "Activity log",
|
|
description: "User activity and system events across the platform.",
|
|
group: "People & activity",
|
|
icon: FileText,
|
|
},
|
|
{
|
|
id: "settings",
|
|
path: "/admin/settings",
|
|
title: "Settings",
|
|
description: "System configuration, keys, and admin preferences.",
|
|
group: "Operations",
|
|
icon: Settings,
|
|
},
|
|
{
|
|
id: "issues",
|
|
path: "/admin/issues",
|
|
title: "Issues",
|
|
description:
|
|
"Support tickets reported by customers or internal system users.",
|
|
group: "Support",
|
|
icon: LifeBuoy,
|
|
},
|
|
{
|
|
id: "faq-support",
|
|
path: "/admin/support/faq",
|
|
title: "FAQ & support",
|
|
description:
|
|
"Published Q&A for end users and staff; editors manage entries.",
|
|
group: "Support",
|
|
icon: HelpCircle,
|
|
},
|
|
{
|
|
id: "maintenance",
|
|
path: "/admin/maintenance",
|
|
title: "Maintenance",
|
|
description: "Enable maintenance mode and set user-facing messages.",
|
|
group: "Operations",
|
|
icon: Wrench,
|
|
},
|
|
{
|
|
id: "announcements",
|
|
path: "/admin/announcements",
|
|
title: "Announcements",
|
|
description: "Create and broadcast announcements to users.",
|
|
group: "Operations",
|
|
icon: Megaphone,
|
|
},
|
|
{
|
|
id: "audit",
|
|
path: "/admin/audit",
|
|
title: "Audit",
|
|
description: "Immutable audit trail of sensitive admin actions.",
|
|
group: "Operations",
|
|
icon: Activity,
|
|
},
|
|
{
|
|
id: "security-hub",
|
|
path: "/admin/security",
|
|
title: "Security",
|
|
description: "Hub for sessions, API keys, failed logins, and limits.",
|
|
group: "Security",
|
|
icon: Shield,
|
|
},
|
|
{
|
|
id: "failed-logins",
|
|
path: "/admin/security/failed-logins",
|
|
title: "Failed logins",
|
|
description: "View and manage failed login attempts.",
|
|
group: "Security",
|
|
icon: AlertTriangle,
|
|
},
|
|
{
|
|
id: "suspicious",
|
|
path: "/admin/security/suspicious",
|
|
title: "Suspicious activity",
|
|
description: "Monitor suspicious IPs and emails.",
|
|
group: "Security",
|
|
icon: Shield,
|
|
},
|
|
{
|
|
id: "api-keys",
|
|
path: "/admin/security/api-keys",
|
|
title: "API keys",
|
|
description: "Manage API keys and tokens.",
|
|
group: "Security",
|
|
icon: Key,
|
|
},
|
|
{
|
|
id: "rate-limits",
|
|
path: "/admin/security/rate-limits",
|
|
title: "Rate limits",
|
|
description: "View rate limit violations and abuse patterns.",
|
|
group: "Security",
|
|
icon: Gauge,
|
|
},
|
|
{
|
|
id: "sessions",
|
|
path: "/admin/security/sessions",
|
|
title: "Active sessions",
|
|
description: "Manage active user sessions across devices.",
|
|
group: "Security",
|
|
icon: Users,
|
|
},
|
|
{
|
|
id: "analytics-hub",
|
|
path: "/admin/analytics",
|
|
title: "Analytics",
|
|
description: "Hub for charts, growth, revenue, and API usage.",
|
|
group: "Analytics",
|
|
icon: BarChart3,
|
|
},
|
|
{
|
|
id: "analytics-overview",
|
|
path: "/admin/analytics/overview",
|
|
title: "Performance overview",
|
|
description: "Platform analytics overview and KPIs.",
|
|
group: "Analytics",
|
|
icon: BarChart3,
|
|
},
|
|
{
|
|
id: "analytics-users",
|
|
path: "/admin/analytics/users",
|
|
title: "User dynamics",
|
|
description: "User growth and statistics over time.",
|
|
group: "Analytics",
|
|
icon: Users,
|
|
},
|
|
{
|
|
id: "analytics-revenue",
|
|
path: "/admin/analytics/revenue",
|
|
title: "Revenue streams",
|
|
description: "Revenue trends and breakdowns.",
|
|
group: "Analytics",
|
|
icon: DollarSign,
|
|
},
|
|
{
|
|
id: "analytics-storage",
|
|
path: "/admin/analytics/storage",
|
|
title: "Resource allocation",
|
|
description: "Storage usage and breakdown by user or resource.",
|
|
group: "Analytics",
|
|
icon: HardDrive,
|
|
},
|
|
{
|
|
id: "analytics-api",
|
|
path: "/admin/analytics/api",
|
|
title: "API operations",
|
|
description: "API endpoint usage and traffic statistics.",
|
|
group: "Analytics",
|
|
icon: Activity,
|
|
},
|
|
{
|
|
id: "health",
|
|
path: "/admin/health",
|
|
title: "System health",
|
|
description: "Service health checks, version, and diagnostics.",
|
|
group: "Operations",
|
|
icon: Heart,
|
|
},
|
|
{
|
|
id: "broadcast",
|
|
path: "/admin/notifications/broadcast",
|
|
title: "Send notification",
|
|
description:
|
|
"Broadcast push, SMS, and email to selected audiences (admins).",
|
|
group: "Communications",
|
|
icon: Send,
|
|
},
|
|
]
|
|
|
|
const GROUP_ORDER = [
|
|
"Overview",
|
|
"Commerce",
|
|
"People & activity",
|
|
"Support",
|
|
"Operations",
|
|
"Communications",
|
|
"Security",
|
|
"Analytics",
|
|
]
|
|
|
|
export function groupAdminSearchRoutes(
|
|
routes: AdminSearchRoute[],
|
|
): Map<string, AdminSearchRoute[]> {
|
|
const map = new Map<string, AdminSearchRoute[]>()
|
|
for (const r of routes) {
|
|
const list = map.get(r.group) ?? []
|
|
list.push(r)
|
|
map.set(r.group, list)
|
|
}
|
|
const ordered = new Map<string, AdminSearchRoute[]>()
|
|
for (const g of GROUP_ORDER) {
|
|
const list = map.get(g)
|
|
if (list?.length) ordered.set(g, list)
|
|
}
|
|
for (const [g, list] of map) {
|
|
if (!ordered.has(g)) ordered.set(g, list)
|
|
}
|
|
return ordered
|
|
}
|