mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
* add main log drain form and navigation * fix submit and select * add mutation and update form * fix submit issue * fix issues with validation * fix typeerrs * add log drain table * update create log drain mutation * add delete log drain mutation * update get log drains query * fix new log drain click in cards * add delete mutation * add delete log drain * refactor gzip switch * refactor radiogroup to use formfield * add headers form * fix validation, custom headers errors * refactor to support update in form * format * add log drains to nav * update api spec and list logdrains query * wire backend * fix datadog region values * make api input password * fix url elastic * fix typerr * rm unnecessary value setter * fix state issue log drains update form * Add default values setting in useEffect to fix form issues * format * Update LogDrains table header width to 250px * add upgrade plan card when free plan * fix dumb if statement * fix the freaking headers * fix upgrade to team state * fix plan check and loading state * disable type update * Add link to documentation in Log Drains settings * show add destination only after empty state * fix bug with inputs not resetting * add gzip tooltip * rm command * defaultValue to value * add defaultValue * rm consolelog * rm anys
76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren, useEffect } from 'react'
|
|
|
|
import { useParams } from 'common'
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
|
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
import ProjectLayout from '../ProjectLayout/ProjectLayout'
|
|
import { generateSettingsMenu } from './SettingsMenu.utils'
|
|
import { useFlag } from 'hooks/ui/useFlag'
|
|
|
|
interface SettingsLayoutProps {
|
|
title?: string
|
|
}
|
|
|
|
const SettingsLayout = ({ title, children }: PropsWithChildren<SettingsLayoutProps>) => {
|
|
const router = useRouter()
|
|
const { ref } = useParams()
|
|
const project = useSelectedProject()
|
|
const organization = useSelectedOrganization()
|
|
|
|
useEffect(() => {
|
|
if (!IS_PLATFORM) {
|
|
router.push('/project/default')
|
|
}
|
|
}, [router])
|
|
|
|
// billing pages live under /billing/invoices and /billing/subscription, etc
|
|
// so we need to pass the [5]th part of the url to the menu
|
|
const page = router.pathname.includes('billing')
|
|
? router.pathname.split('/')[5]
|
|
: router.pathname.split('/')[4]
|
|
|
|
const {
|
|
projectAuthAll: authEnabled,
|
|
projectEdgeFunctionAll: edgeFunctionsEnabled,
|
|
projectStorageAll: storageEnabled,
|
|
billingInvoices: invoicesEnabled,
|
|
} = useIsFeatureEnabled([
|
|
'project_auth:all',
|
|
'project_edge_function:all',
|
|
'project_storage:all',
|
|
'billing:invoices',
|
|
])
|
|
|
|
const warehouseEnabled = useFlag('warehouse')
|
|
const logDrainsEnabled = useFlag('logdrains')
|
|
|
|
const menuRoutes = generateSettingsMenu(ref, project, organization, {
|
|
auth: authEnabled,
|
|
edgeFunctions: edgeFunctionsEnabled,
|
|
storage: storageEnabled,
|
|
invoices: invoicesEnabled,
|
|
warehouse: warehouseEnabled,
|
|
logDrains: logDrainsEnabled,
|
|
})
|
|
|
|
return (
|
|
<ProjectLayout
|
|
isBlocking={false}
|
|
title={title || 'Settings'}
|
|
product="Settings"
|
|
productMenu={<ProductMenu page={page} menu={menuRoutes} />}
|
|
>
|
|
<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">
|
|
{children}
|
|
</main>
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(SettingsLayout)
|