Files
AnchorOS/components/auth-guard.tsx
Marco Gallegos d27354fd5a feat: Add kiosk management, artist selection, and schedule management
- Add KiosksManagement component with full CRUD for kiosks
- Add ScheduleManagement for staff schedules with break reminders
- Update booking flow to allow artist selection by customers
- Add staff_services API for assigning services to artists
- Update staff management UI with service assignment dialog
- Add auto-break reminder when schedule >= 8 hours
- Update availability API to filter artists by service
- Add kiosk management to Aperture dashboard
- Clean up ralphy artifacts and logs
2026-01-21 13:02:06 -06:00

34 lines
1.3 KiB
TypeScript

'use client'
import { useEffect } from 'react'
import { useRouter, usePathname } from 'next/navigation'
import { useAuth } from '@/lib/auth/context'
/**
* @description Authentication guard component that protects routes requiring login
* @param {Object} props - Component props
* @param {React.ReactNode} props.children - Child components to render when authenticated
* @returns {JSX.Element} Loading state while auth is determined, or children when authenticated
* @audit BUSINESS RULE: AuthGuard is a client-side guard for protected routes
* @audit SECURITY: Prevents rendering protected content until authentication verified
* @audit Validate: Loading state shown while auth provider determines user session
* @audit PERFORMANCE: No API calls - relies on AuthProvider's cached session state
* @audit Note: Actual redirect logic handled by AuthProvider to avoid conflicts
*/
export function AuthGuard({ children }: { children: React.ReactNode }) {
const { loading: authLoading } = useAuth()
// Show loading while auth state is being determined
if (authLoading) {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="text-center">
<p>Cargando...</p>
</div>
</div>
)
}
return <>{children}</>
}