page.tsx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. 'use client';
  2. import { useRouter } from 'next/navigation';
  3. import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
  4. import { FileText, Layout, Upload, BookOpen } from 'lucide-react';
  5. import Image from 'next/image';
  6. import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
  7. interface AppTile {
  8. id: string;
  9. title: string;
  10. description: string;
  11. icon: React.ReactNode;
  12. href: string;
  13. color: string;
  14. }
  15. export default function DashboardPage() {
  16. const router = useRouter();
  17. const { isAuthenticated, accessToken } = useKindeBrowserClient();
  18. const roles = accessToken?.roles || [];
  19. const permissions = accessToken?.permissions || [];
  20. const apps: AppTile[] = [
  21. {
  22. id: 'files',
  23. title: 'Files',
  24. description: 'Manage and organize your uploaded files',
  25. icon: <FileText className="w-8 h-8" />,
  26. href: '/files',
  27. color: 'bg-blue-500'
  28. },
  29. {
  30. id: 'layout-configurations',
  31. title: 'Layout Configurations',
  32. description: 'Create and manage layout configurations',
  33. icon: <Layout className="w-8 h-8" />,
  34. href: '/layout-configurations',
  35. color: 'bg-green-500'
  36. },
  37. {
  38. id: 'imports',
  39. title: 'Imports',
  40. description: 'Import and manage data from external sources',
  41. icon: <Upload className="w-8 h-8" />,
  42. href: '/imports',
  43. color: 'bg-purple-500'
  44. },
  45. {
  46. id: 'api-docs',
  47. title: 'API Documentation',
  48. description: 'Explore API endpoints and documentation',
  49. icon: <BookOpen className="w-8 h-8" />,
  50. href: '/api-docs',
  51. color: 'bg-orange-500'
  52. },
  53. {
  54. id: 'cintas-calendar-summary',
  55. title: 'Cintas Install Calendar Summary',
  56. description: 'View installation calendar summary and statistics',
  57. icon: (
  58. <div className="w-8 h-8 relative">
  59. <Image
  60. src="/Cintas-Blue.svg"
  61. alt="Cintas"
  62. fill
  63. className="object-contain"
  64. />
  65. </div>
  66. ),
  67. href: '/cintas-calendar-summary',
  68. color: 'bg-blue-600'
  69. }
  70. ];
  71. const handleAppClick = (href: string) => {
  72. router.push(href);
  73. };
  74. return (
  75. <div className="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
  76. <div className="container mx-auto px-4 py-8">
  77. <div className="text-center mb-12">
  78. <h1 className="text-4xl font-bold text-gray-900 dark:text-white mb-4">
  79. Welcome to Vtorio Dashboard
  80. </h1>
  81. <p className="text-lg text-gray-600 dark:text-gray-300">
  82. Select an application to get started
  83. </p>
  84. </div>
  85. <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto">
  86. {apps.map((app) => (
  87. <Card
  88. key={app.id}
  89. className="group cursor-pointer transition-all duration-300 hover:shadow-lg hover:scale-105 dark:bg-gray-800 dark:border-gray-700"
  90. onClick={() => handleAppClick(app.href)}
  91. >
  92. <CardHeader className="text-center">
  93. <div className={`${app.id === 'cintas-calendar-summary' ? 'bg-white border-2 border-blue-500' : app.color} w-16 h-16 rounded-full flex items-center justify-center ${app.id === 'cintas-calendar-summary' ? '' : 'text-white'} mx-auto mb-4 group-hover:scale-110 transition-transform duration-300`}>
  94. {app.icon}
  95. </div>
  96. <CardTitle className="text-xl font-semibold text-gray-900 dark:text-white">
  97. {app.title}
  98. </CardTitle>
  99. </CardHeader>
  100. <CardContent>
  101. <CardDescription className="text-center text-gray-600 dark:text-gray-300">
  102. {app.description}
  103. </CardDescription>
  104. </CardContent>
  105. </Card>
  106. ))}
  107. </div>
  108. <div className="mt-12 text-center">
  109. <p className="text-sm text-gray-500 dark:text-gray-400">
  110. Click on any application to access its features
  111. </p>
  112. </div>
  113. </div>
  114. </div>
  115. );
  116. }