Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.1 kB
1
Indexable
Never
import React, { useContext, useState, useEffect } from 'react';
import languageContext from 'language-context';
import Icon from 'components/icon';
import Activities from 'components/activities';
import Loading from 'components/loading';
import { connect } from 'react-redux';

const AgileBoardPopupActivities = (state, ...props) => {
  const tc = useContext(languageContext);
  const props = { hideBlocks, setHideBlocks, previewData };

  return (
    <div className="agileBoardPopupWrapper__agilePopup__content__block">
      <div
        className="agileBoardPopupWrapper__agilePopup__content__block__header"
        onClick={(e) => {
          if (props.hideBlocks.includes('activities')) {
            props.setHideBlocks(
              props.hideBlocks.filter((num) => num !== 'activities')
            );
          } else {
            e.stopPropagation();
            props.setHideBlocks(props.hideBlocks.concat('activities'));
          }
        }}
      >
        <div className="agileBoardPopupWrapper__agilePopup__content__block__header__title">
          {props.previewData.item.type === 'prospect' ? (
            <p>{tc.previousActivityForProspect}</p>
          ) : (
            <p>{tc.activity}</p>
          )}
          {props.hideBlocks.includes('activities') ? (
            <Icon val="maximize" />
          ) : (
            <Icon val="minimize" />
          )}
        </div>
      </div>
      {!props.hideBlocks.includes('activities') ? (
        <div className="agileBoardPreviewWrapper__agileBoardPreview__content__block__content">
          <Activities
            target={props.previewData.item._id}
            //target={previewData.item._id}
            view="embedded"
            //activities={state.activities}
            //hideBlocks={hideBlocks}
          />
        </div>
      ) : null}
    </div>
  );
};

//export default AgileBoardPopupActivities;

const mapStateToProps = (state) => {
  return {
    activities: state.activities,
    agile: state.agile,
    props: props,
  };
};

export default connect(mapStateToProps)(AgileBoardPopupActivities);
Leave a Comment