selection was reworked to interact with webhooks store

This commit is contained in:
Vladimir Khvan 2023-05-01 13:23:42 +05:00
parent 8e6248fc38
commit 3c7fa54222

View File

@ -1,5 +1,7 @@
import React, { useMemo } from "react";
import moment from "moment";
import { inject, observer } from "mobx-react";
import { useNavigate } from "react-router-dom";
import TableRow from "@docspace/components/table-container/TableRow";
@ -7,13 +9,12 @@ import TableCell from "@docspace/components/table-container/TableCell";
import Text from "@docspace/components/text";
import Checkbox from "@docspace/components/checkbox";
import { StatusBadge } from "../../../../sub-components/StatusBadge";
import withFileActions from "@docspace/client/src/HOCs/withFileActions";
import RetryIcon from "PUBLIC_DIR/images/refresh.react.svg?url";
import InfoIcon from "PUBLIC_DIR/images/info.outline.react.svg?url";
const HistoryTableRow = (props) => {
const { item, checkedProps, onContentFileSelect } = props;
const { item, toggleEventId, isIdChecked } = props;
const navigate = useNavigate();
const redirectToDetails = () => navigate(window.location.pathname + `/${item.id}`);
@ -37,15 +38,17 @@ const HistoryTableRow = (props) => {
[item],
);
const onChange = (e) => {
onContentFileSelect && onContentFileSelect(e.target.checked, item);
const onChange = () => {
toggleEventId(item.id);
};
const isChecked = isIdChecked(item.id);
return (
<TableRow contextOptions={contextOptions} checked={checkedProps}>
<TableRow contextOptions={contextOptions} checked={isChecked}>
<TableCell>
<TableCell checked={checkedProps} className="noPadding">
<Checkbox onChange={onChange} isChecked={checkedProps} title="TitleSelectFile" />
<TableCell checked={isChecked} className="noPadding">
<Checkbox onChange={onChange} isChecked={isChecked} title="TitleSelectFile" />
</TableCell>
<Text fontWeight={600}>{item.id}</Text>
@ -62,4 +65,8 @@ const HistoryTableRow = (props) => {
);
};
export default withFileActions(HistoryTableRow);
export default inject(({ webhooksStore }) => {
const { checkedEventIds, toggleEventId, isIdChecked } = webhooksStore;
return { checkedEventIds, toggleEventId, isIdChecked };
})(observer(HistoryTableRow));