AnnotationList.tsx 1022 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import { MARKUP_TYPE } from '../constants';
  3. import { AnnotationType } from '../constants/type';
  4. import Head from './AnnotationListHead';
  5. import Drawer from '../components/Drawer';
  6. import Body from '../components/AnnotationList';
  7. import useStore from '../store';
  8. import {
  9. Container,
  10. } from '../global/sidebarStyled';
  11. const MARKUP_TYPE_ARRAY = Object.values(MARKUP_TYPE);
  12. const AnnotationList: React.FC = () => {
  13. const [{
  14. navbarState,
  15. annotations,
  16. viewport,
  17. scale,
  18. pdf,
  19. }] = useStore();
  20. const isActive = navbarState === 'annotations';
  21. return (
  22. <Drawer anchor="right" open={isActive}>
  23. <Container>
  24. <Head />
  25. <Body
  26. annotations={annotations.filter(
  27. (ele: AnnotationType) => MARKUP_TYPE_ARRAY.includes(ele.obj_type),
  28. )}
  29. viewport={viewport}
  30. scale={scale}
  31. pdf={pdf}
  32. isActive={isActive}
  33. />
  34. </Container>
  35. </Drawer>
  36. );
  37. };
  38. export default AnnotationList;