ForbiddenPage.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React, { useMemo } from 'react';
  2. import { useTranslation } from 'next-i18next';
  3. import CustomNavAndContents from './CustomNavigation/CustomNavAndContents';
  4. import { DescendantsPageListForCurrentPath } from './DescendantsPageList';
  5. import PageListIcon from './Icons/PageListIcon';
  6. type Props = {
  7. isLinkSharingDisabled?: boolean,
  8. }
  9. const ForbiddenPage = React.memo((props: Props): JSX.Element => {
  10. const { t } = useTranslation();
  11. const navTabMapping = useMemo(() => {
  12. return {
  13. pagelist: {
  14. Icon: PageListIcon,
  15. Content: DescendantsPageListForCurrentPath,
  16. i18n: t('page_list'),
  17. index: 0,
  18. },
  19. };
  20. }, [t]);
  21. return (
  22. <>
  23. <div className="row not-found-message-row mb-4">
  24. <div className="col-lg-12">
  25. <h2 className="text-muted">
  26. <i className="icon-ban mr-2" aria-hidden="true" />
  27. Forbidden
  28. </h2>
  29. </div>
  30. </div>
  31. <div className="row row-alerts d-edit-none">
  32. <div className="col-sm-12">
  33. <p className="alert alert-primary py-3 px-4">
  34. <i className="icon-fw icon-lock" aria-hidden="true" />
  35. { props.isLinkSharingDisabled ? t('custom_navigation.link_sharing_is_disabled') : t('Browsing of this page is restricted')}
  36. </p>
  37. </div>
  38. </div>
  39. { !props.isLinkSharingDisabled && (
  40. <div className="mt-5">
  41. <CustomNavAndContents navTabMapping={navTabMapping} />
  42. </div>
  43. ) }
  44. </>
  45. );
  46. });
  47. ForbiddenPage.displayName = 'ForbiddenPage';
  48. export default ForbiddenPage;