index.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import Footer from 'sentry/components/footer';
  2. import HookOrDefault from 'sentry/components/hookOrDefault';
  3. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  4. import Sidebar from 'sentry/components/sidebar';
  5. import useRouteAnalyticsHookSetup from 'sentry/utils/routeAnalytics/useRouteAnalyticsHookSetup';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. import OrganizationContainer from 'sentry/views/organizationContainer';
  8. import Body from './body';
  9. interface Props {
  10. children: React.ReactNode;
  11. }
  12. const OrganizationHeader = HookOrDefault({
  13. hookName: 'component:organization-header',
  14. });
  15. function OrganizationLayout({children}: Props) {
  16. useRouteAnalyticsHookSetup();
  17. // XXX(epurkhiser): The OrganizationContainer is responsible for ensuring the
  18. // oganization is loaded before rendering children. Organization may not be
  19. // loaded yet when this first renders.
  20. const organization = useOrganization({allowNull: true});
  21. return (
  22. <SentryDocumentTitle noSuffix title={organization?.name ?? 'Sentry'}>
  23. <OrganizationContainer>
  24. <div className="app">
  25. {organization && <OrganizationHeader organization={organization} />}
  26. <Sidebar />
  27. <Body>{children}</Body>
  28. <Footer />
  29. </div>
  30. </OrganizationContainer>
  31. </SentryDocumentTitle>
  32. );
  33. }
  34. export default OrganizationLayout;