2025-07-24 16:16:57 -04:00
|
|
|
import { useRouter } from 'next/router';
|
2025-07-24 18:04:06 -04:00
|
|
|
import dynamic from 'next/dynamic';
|
2025-07-24 16:16:57 -04:00
|
|
|
import Layout from '../../components/Layout';
|
2025-07-24 17:31:29 -04:00
|
|
|
import AdminProtected from '../../components/AdminProtected';
|
2026-06-03 18:30:29 -04:00
|
|
|
import CardEditorView from '../../components/CardEditorView';
|
|
|
|
|
import { useCardEditor } from '../../lib/use-card-editor.js';
|
2025-07-24 16:16:57 -04:00
|
|
|
|
2026-06-03 18:30:29 -04:00
|
|
|
function CardEditorPage() {
|
2025-07-24 16:16:57 -04:00
|
|
|
const router = useRouter();
|
2026-06-03 18:30:29 -04:00
|
|
|
const editor = useCardEditor(router);
|
2025-07-24 16:16:57 -04:00
|
|
|
|
2026-06-03 18:30:29 -04:00
|
|
|
if (editor.loading) {
|
2025-07-24 16:16:57 -04:00
|
|
|
return (
|
2025-07-24 17:31:29 -04:00
|
|
|
<AdminProtected>
|
2025-07-24 18:04:06 -04:00
|
|
|
{(user) => (
|
|
|
|
|
<Layout user={user}>
|
|
|
|
|
<div className="flex items-center justify-center min-h-screen">
|
2026-06-03 18:30:29 -04:00
|
|
|
<div
|
|
|
|
|
className="animate-spin rounded-full h-32 w-32 border-b-2"
|
|
|
|
|
style={{ borderColor: 'var(--text-accent)' }}
|
|
|
|
|
/>
|
2025-07-24 18:04:06 -04:00
|
|
|
</div>
|
|
|
|
|
</Layout>
|
|
|
|
|
)}
|
2025-07-24 17:31:29 -04:00
|
|
|
</AdminProtected>
|
2025-07-24 16:16:57 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2025-07-24 17:31:29 -04:00
|
|
|
<AdminProtected>
|
2025-07-24 18:04:06 -04:00
|
|
|
{(user) => (
|
|
|
|
|
<Layout user={user}>
|
2026-06-03 18:30:29 -04:00
|
|
|
<CardEditorView {...editor} />
|
|
|
|
|
</Layout>
|
2025-07-24 18:04:06 -04:00
|
|
|
)}
|
2025-07-24 17:31:29 -04:00
|
|
|
</AdminProtected>
|
2025-07-24 16:16:57 -04:00
|
|
|
);
|
2026-06-03 18:30:29 -04:00
|
|
|
}
|
2025-07-24 18:04:06 -04:00
|
|
|
|
2026-06-03 18:30:29 -04:00
|
|
|
export default dynamic(() => Promise.resolve(CardEditorPage), { ssr: false });
|