Files
supabase/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
Mohammed Yasin Mulla 497575b647 fix: prevent scroll when banners are visible in AppLayout components (#21069)
* fix: prevent scroll when banners are visible  in AppLayout components

* Lint + use tailwind

* fix

* Deprecate LayoutWrapper

* Fix import

---------

Co-authored-by: Mohammed Yasin Mulla <mohammedyasin@obmondo.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-08 14:13:18 +08:00

36 lines
1.1 KiB
TypeScript

import { useMonaco } from '@monaco-editor/react'
import { useTheme } from 'next-themes'
import { PropsWithChildren, useEffect } from 'react'
import IncidentBanner from 'components/layouts/AppLayout/IncidentBanner'
import { NoticeBanner } from 'components/layouts/AppLayout/NoticeBanner'
import { getTheme } from 'components/ui/CodeEditor'
import { useFlag } from 'hooks'
const AppBannerWrapper = ({ children }: PropsWithChildren<{}>) => {
const monaco = useMonaco()
const { resolvedTheme } = useTheme()
const ongoingIncident = useFlag('ongoingIncident')
const showNoticeBanner = useFlag('showNoticeBanner')
useEffect(() => {
if (monaco && resolvedTheme) {
const mode: any = getTheme(resolvedTheme)
monaco.editor.defineTheme('supabase', mode)
}
}, [resolvedTheme, monaco])
return (
<div className="min-h-full flex flex-col">
<div className="flex-none">
{ongoingIncident && <IncidentBanner />}
{showNoticeBanner && <NoticeBanner />}
</div>
{children}
</div>
)
}
export default AppBannerWrapper