PageAlerts.tsx 1.1 KB

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