import { Button, Space } from "antd";
import { useTranslation } from "react-i18next";

import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { deselectAllMediaForJob, selectAllmediaForJob } from "../../redux/media/media.actions";

const mapStateToProps = createStructuredSelector({
  //currentUser: selectCurrentUser
});
const mapDispatchToProps = (dispatch) => ({
  selectAllmediaForJob: (jobid) => dispatch(selectAllmediaForJob(jobid)),
  deselectAllmediaForJob: (jobid) => dispatch(deselectAllMediaForJob(jobid))
});
export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsLocalGallerySelectAllComponent);

export function JobsDocumentsLocalGallerySelectAllComponent({ jobid, selectAllmediaForJob, deselectAllmediaForJob }) {
  const { t } = useTranslation();

  // onSelectImage={(index, image) => {
  //     toggleMediaSelected({ jobid: job.id, filename: image.filename });
  //   }}

  const handleSelectAll = () => {
    selectAllmediaForJob({ jobid });
  };

  const handleDeselectAll = () => {
    deselectAllmediaForJob({ jobid });
  };

  return (
    <Space wrap>
      <Button onClick={handleSelectAll}>{t("general.actions.selectall")}</Button>

      <Button onClick={handleDeselectAll}>{t("general.actions.deselectall")}</Button>
    </Space>
  );
}
