import React from 'react';

import Head from '../components/AnnotationListHead';
import useStore from '../store';
import useActions from '../actions';

const AnnotationListHead: React.FC = () => {
  const [{
    annotations,
  }, dispatch] = useStore();
  const {
    setNavbar,
    addAnnots,
  } = useActions(dispatch);

  return (
    <Head
      close={(): void => { setNavbar(''); }}
      addAnnots={addAnnots}
      hasAnnots={!!annotations.length}
    />
  );
};

export default AnnotationListHead;
