2025-07-23 22:26:54 -04:00
|
|
|
import Layout from '../components/Layout';
|
2026-06-03 13:49:25 -04:00
|
|
|
import CardsPageView from '../components/CardsPageView';
|
2026-06-03 13:06:24 -04:00
|
|
|
import PublicCardsView from '../components/PublicCardsView';
|
2025-07-29 15:19:48 -04:00
|
|
|
import ProtectedRoute from '../components/ProtectedRoute';
|
|
|
|
|
import { useAuth } from '../lib/use-auth';
|
2026-06-03 13:49:25 -04:00
|
|
|
import { useCardsPage } from '../lib/use-cards-page.js';
|
2025-07-23 22:26:54 -04:00
|
|
|
|
2025-07-29 15:19:48 -04:00
|
|
|
function AuthenticatedCards() {
|
2026-06-03 13:49:25 -04:00
|
|
|
const { user } = useAuth();
|
|
|
|
|
const cardsPage = useCardsPage();
|
2025-07-23 22:26:54 -04:00
|
|
|
|
2026-06-03 13:49:25 -04:00
|
|
|
if (cardsPage.showInitialLoading) {
|
2025-07-23 22:26:54 -04:00
|
|
|
return (
|
|
|
|
|
<Layout user={user}>
|
|
|
|
|
<div className="flex items-center justify-center min-h-screen">
|
2026-06-03 13:49:25 -04:00
|
|
|
<div className="animate-spin rounded-full h-32 w-32 border-b-2" style={{ borderColor: 'var(--text-accent)' }} />
|
2025-07-23 22:26:54 -04:00
|
|
|
</div>
|
|
|
|
|
</Layout>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Layout user={user}>
|
2026-06-03 13:49:25 -04:00
|
|
|
<CardsPageView {...cardsPage} />
|
2025-07-23 22:26:54 -04:00
|
|
|
</Layout>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-29 15:19:48 -04:00
|
|
|
export default function Cards() {
|
|
|
|
|
return (
|
|
|
|
|
<ProtectedRoute
|
|
|
|
|
allowPublic={true}
|
|
|
|
|
publicFallback={<PublicCardsView />}
|
|
|
|
|
>
|
|
|
|
|
<AuthenticatedCards />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
);
|
|
|
|
|
}
|