AnnotationList.tsx 948 B

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