layout.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from 'react'
  2. import type { ReactNode } from 'react'
  3. import Header from './header'
  4. import SwrInitor from '@/app/components/swr-initor'
  5. import { AppContextProvider } from '@/context/app-context'
  6. import GA, { GaType } from '@/app/components/base/ga'
  7. import HeaderWrapper from '@/app/components/header/header-wrapper'
  8. import { EventEmitterContextProvider } from '@/context/event-emitter'
  9. import { ProviderContextProvider } from '@/context/provider-context'
  10. import { ModalContextProvider } from '@/context/modal-context'
  11. const Layout = ({ children }: { children: ReactNode }) => {
  12. return (
  13. <>
  14. <GA gaType={GaType.admin} />
  15. <SwrInitor>
  16. <AppContextProvider>
  17. <EventEmitterContextProvider>
  18. <ProviderContextProvider>
  19. <ModalContextProvider>
  20. <HeaderWrapper>
  21. <Header />
  22. </HeaderWrapper>
  23. <div className='relative flex flex-col overflow-y-auto bg-white shrink-0 h-0 grow'>
  24. {children}
  25. </div>
  26. </ModalContextProvider>
  27. </ProviderContextProvider>
  28. </EventEmitterContextProvider>
  29. </AppContextProvider>
  30. </SwrInitor>
  31. </>
  32. )
  33. }
  34. export const metadata = {
  35. title: 'Dify',
  36. }
  37. export default Layout