PageAlerts.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import dynamic from 'next/dynamic';
  3. import { useIsNotFound } from '~/stores/context';
  4. import { OldRevisionAlert } from './OldRevisionAlert';
  5. import { PageGrantAlert } from './PageGrantAlert';
  6. import { PageRedirectedAlert } from './PageRedirectedAlert';
  7. import { PageStaleAlert } from './PageStaleAlert';
  8. const FixPageGrantAlert = dynamic(() => import('./FixPageGrantAlert').then(mod => mod.FixPageGrantAlert), { ssr: false });
  9. // dynamic import because TrashPageAlert uses localStorageMiddleware
  10. const TrashPageAlert = dynamic(() => import('./TrashPageAlert').then(mod => mod.TrashPageAlert), { ssr: false });
  11. export const PageAlerts = (): JSX.Element => {
  12. const { data: isNotFound } = useIsNotFound();
  13. return (
  14. <div className="row d-edit-none">
  15. <div className="col-sm-12">
  16. {/* alerts */}
  17. { !isNotFound && <FixPageGrantAlert /> }
  18. <PageGrantAlert />
  19. <TrashPageAlert />
  20. <PageStaleAlert />
  21. <OldRevisionAlert />
  22. <PageRedirectedAlert />
  23. </div>
  24. </div>
  25. );
  26. };