IdenticalPathPage.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React, {
  2. FC,
  3. } from 'react';
  4. import { withUnstatedContainers } from './UnstatedUtils';
  5. import AppContainer from '~/client/services/AppContainer';
  6. import PageListItem from './Page/PageListItem';
  7. type IdenticalPathPageProps= {
  8. // add props and types here
  9. }
  10. const jsonNull = 'null';
  11. const IdenticalPathPage:FC<IdenticalPathPageProps> = (props:IdenticalPathPageProps) => {
  12. const identicalPageDocument = document.getElementById('identical-path-page-list');
  13. const pageDataList = JSON.parse(identicalPageDocument?.getAttribute('data-identical-page-data-list') || jsonNull);
  14. const shortbodyMap = JSON.parse(identicalPageDocument?.getAttribute('data-shortody-map') || jsonNull);
  15. return (
  16. <div className="container">
  17. <ul className="list-group">
  18. {/* Todo: show alert */}
  19. {pageDataList.map((data) => {
  20. return (
  21. <PageListItem
  22. key={data.pageData._id}
  23. page={data} // need this to have valid userpicture
  24. isSelected={false}
  25. isChecked={false}
  26. isEnableActions={false}
  27. shortBody={shortbodyMap[data.pageData._id]}
  28. />
  29. );
  30. })}
  31. </ul>
  32. </div>
  33. );
  34. };
  35. export default withUnstatedContainers(IdenticalPathPage, [AppContainer]);