import BaseLayout from 'components/layouts' import { observer } from 'mobx-react-lite' import { useStore, withAuth } from 'hooks' import { IconAlertCircle, IconCode, IconSlash, Loading, Tabs } from '@supabase/ui' import { Tab } from '@headlessui/react' import FunctionsNav from './FunctionsNav' import React, { useEffect } from 'react' import { useRouter } from 'next/router' import Link from 'next/link' import WarningBanner from 'components/ui/WarningBanner' import { WARNING_MESSAGE } from './Functions.constants' const PageLayout = ({ children, centered }: { children?: React.ReactNode; centered?: boolean }) => { const { functions, ui } = useStore() const router = useRouter() const { id, ref } = router.query useEffect(() => { if (ui.selectedProjectRef) { functions.load() } }, [ui.selectedProjectRef]) if (!functions.isLoaded) { return ( loading ) } const item = id ? functions.byId(id) : null const name = item?.name || '' return ( {centered ? ( <>

Functions

{children}
) : (

Functions

{name && ( <>
{name}
)}
{item && }
{children}
)}
) } export default withAuth(observer(PageLayout))