AnnotationList.tsx 853 B

12345678910111213141516171819202122232425262728293031323334
  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 }] = 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. isActive={isActive}
  21. />
  22. </Container>
  23. </Drawer>
  24. );
  25. };
  26. export default AnnotationList;