diff --git a/apps/admin/postcss.config.js b/apps/admin/postcss.config.js new file mode 100644 index 0000000..d41ad63 --- /dev/null +++ b/apps/admin/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/apps/admin/src/components/ProtectedRoute.tsx b/apps/admin/src/components/ProtectedRoute.tsx new file mode 100644 index 0000000..2af4462 --- /dev/null +++ b/apps/admin/src/components/ProtectedRoute.tsx @@ -0,0 +1,30 @@ +import { Navigate } from 'react-router-dom'; +import { useAuth } from '@/contexts/AuthContext'; +import { Loader2 } from 'lucide-react'; + +interface ProtectedRouteProps { + children: React.ReactNode; + requireSuperAdmin?: boolean; +} + +export function ProtectedRoute({ children, requireSuperAdmin = false }: ProtectedRouteProps) { + const { session, loading, isSuperAdmin } = useAuth(); + + if (loading) { + return ( +
{user?.email}
++ {permissions?.role?.replace('_', ' ')} +
++ Track all administrative actions and data changes +
++ Welcome back! Manage your Sauci content and users. +
+Categories
+Packs
+Questions
+Active Users
++ Manage system administrators and their roles +
++ Organize your question packs into categories +
++ Create your first category to get started +
+ ++ {category + ? `Manage packs in the ${category.name} category` + : 'Manage all question packs'} +
++ Create your first question pack to get started +
++ {questions.length} question{questions.length !== 1 ? 's' : ''} in this pack +
++ Add questions manually or generate them with AI +
+Chat not found
+ + + ++ {match.question?.text} +
+{user.name || 'Unnamed'}
+Current User
+{partner.name || 'Unnamed'}
+ + View Profile + +No messages in this chat yet
+{message.content}
+ )} + {message.media_path && ( +User not found
+ + + ++ {profile.email || 'No email'} +
+ +No responses yet
+No matches yet
++ {profiles.length} registered user{profiles.length !== 1 ? 's' : ''} +
+