BasicLayout.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import type { JSX, ReactNode } from 'react';
  2. import dynamic from 'next/dynamic';
  3. // biome-ignore-start lint/style/noRestrictedImports: no-problem lazy loaded components
  4. import { AlertSiteUrlUndefined } from '~/client/components/AlertSiteUrlUndefined';
  5. import { DeleteBookmarkFolderModalLazyLoaded } from '~/client/components/DeleteBookmarkFolderModal';
  6. import { GrantedGroupsInheritanceSelectModalLazyLoaded } from '~/client/components/GrantedGroupsInheritanceSelectModal';
  7. import { PageAccessoriesModalLazyLoaded } from '~/client/components/PageAccessoriesModal';
  8. import { DeleteAttachmentModalLazyLoaded } from '~/client/components/PageAttachment';
  9. import { PageDeleteModalLazyLoaded } from '~/client/components/PageDeleteModal';
  10. import { PageDuplicateModalLazyLoaded } from '~/client/components/PageDuplicateModal';
  11. import { PagePresentationModalLazyLoaded } from '~/client/components/PagePresentationModal';
  12. import { PageRenameModalLazyLoaded } from '~/client/components/PageRenameModal';
  13. import { PageSelectModalLazyLoaded } from '~/client/components/PageSelectModal';
  14. import { PutBackPageModalLazyLoaded } from '~/client/components/PutbackPageModal';
  15. import { ShortcutsModalLazyLoaded } from '~/client/components/ShortcutsModal';
  16. import { AiAssistantManagementModalLazyLoaded } from '~/features/openai/client/components/AiAssistant/AiAssistantManagementModal';
  17. import { AiAssistantSidebarLazyLoaded } from '~/features/openai/client/components/AiAssistant/AiAssistantSidebar';
  18. import { PageBulkExportSelectModalLazyLoaded } from '~/features/page-bulk-export/client/components';
  19. // biome-ignore-end lint/style/noRestrictedImports: no-problem lazy loaded components
  20. import { RawLayout } from './RawLayout';
  21. import styles from './BasicLayout.module.scss';
  22. const moduleClass = styles['grw-basic-layout'] ?? '';
  23. // biome-ignore-start lint/style/noRestrictedImports: no-problem dynamic import
  24. const Sidebar = dynamic(
  25. () => import('~/client/components/Sidebar').then((mod) => mod.Sidebar),
  26. { ssr: false },
  27. );
  28. const HotkeysManager = dynamic(
  29. () => import('~/client/components/Hotkeys/HotkeysManager'),
  30. { ssr: false },
  31. );
  32. const GrowiNavbarBottom = dynamic(
  33. () =>
  34. import('~/client/components/Navbar/GrowiNavbarBottom').then(
  35. (mod) => mod.GrowiNavbarBottom,
  36. ),
  37. { ssr: false },
  38. );
  39. // Page modals
  40. const PageCreateModal = dynamic(
  41. () => import('~/client/components/PageCreateModal'),
  42. { ssr: false },
  43. );
  44. const SearchModal = dynamic(
  45. () => import('~/features/search/client/components/SearchModal'),
  46. { ssr: false },
  47. );
  48. // biome-ignore-end lint/style/noRestrictedImports: no-problem dynamic import
  49. type Props = {
  50. children?: ReactNode;
  51. className?: string;
  52. };
  53. export const BasicLayout = ({ children, className }: Props): JSX.Element => {
  54. return (
  55. <RawLayout className={`${moduleClass} ${className ?? ''}`}>
  56. <div className="page-wrapper flex-row">
  57. <div className="z-2 d-print-none">
  58. <Sidebar />
  59. </div>
  60. <div className="d-flex flex-grow-1 flex-column mw-0 z-1">
  61. {/* neccessary for nested {children} make expanded */}
  62. <AlertSiteUrlUndefined />
  63. {children}
  64. </div>
  65. <AiAssistantSidebarLazyLoaded />
  66. </div>
  67. <GrowiNavbarBottom />
  68. <SearchModal />
  69. <PageCreateModal />
  70. <PageDuplicateModalLazyLoaded />
  71. <PageDeleteModalLazyLoaded />
  72. <PageRenameModalLazyLoaded />
  73. <PageAccessoriesModalLazyLoaded />
  74. <DeleteAttachmentModalLazyLoaded />
  75. <DeleteBookmarkFolderModalLazyLoaded />
  76. <PutBackPageModalLazyLoaded />
  77. <PageSelectModalLazyLoaded />
  78. <AiAssistantManagementModalLazyLoaded />
  79. <PagePresentationModalLazyLoaded />
  80. <HotkeysManager />
  81. <ShortcutsModalLazyLoaded />
  82. <PageBulkExportSelectModalLazyLoaded />
  83. <GrantedGroupsInheritanceSelectModalLazyLoaded />
  84. </RawLayout>
  85. );
  86. };