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 FunctionsLayout = ({ children }: { children?: React.ReactNode }) => { const { functions, ui } = useStore() const router = useRouter() const { id, ref } = router.query useEffect(() => { if (ui.selectedProjectRef) { functions.load() } }, [ui.selectedProjectRef]) if (!functions.isLoaded) { return ( {''} ) } const item = id ? functions.byId(id) : null const name = item?.name || '' const hasFunctions = functions.list().length > 0 const centered = !hasFunctions return ( {centered ? ( <>

Functions

{children}
) : (

Functions

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