import React, { useCallback, useEffect } from "react"; import { type SerializableObject } from "@carrot-kpi/react"; import { useNavigate } from "react-router-dom"; import { useAccount } from "wagmi"; import { Authenticate } from "../components/authenticate"; import { useIsDataManagerAuthenticated } from "../hooks/useIsDataManagerAuthenticated"; import { Layout } from "../components/layout"; import { Permissioned } from "../components/permissioned"; import { useIsCreatorAllowed } from "../hooks/useIsCreatorAllowed"; import { CampaignCreationForm } from "../components/campaign-creation-form"; import { Loader } from "@carrot-kpi/ui"; export function CreateWithTemplateId>() { const navigate = useNavigate(); const { address } = useAccount(); const dataManagerAuthenticated = useIsDataManagerAuthenticated(); const { allowed: creatorAllowed, loading: loadingPermission } = useIsCreatorAllowed(address); useEffect(() => { const bodyElement = window.document.getElementById("__app_body"); if (!bodyElement) return; bodyElement.scrollIntoView(); }, []); const handleDismiss = useCallback(() => { navigate(-1); }, [navigate]); return (
{loadingPermission ? (
) : !creatorAllowed ? (
) : !dataManagerAuthenticated ? (
) : ( )}
); }