Skip to content

Commit

Permalink
EPMRPP-77765 || code review fixes - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sidarkevich committed Aug 5, 2022
1 parent d5732a9 commit 9990b80
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,25 @@ export const RuleItem = ({ item, actions, onToggle, disabled, content, onClick }
</span>
{actions.length > 0 && !disabled && (
<span className={cx('actions')}>
{actions.map(({ icon, handler }) => (
<i
className={cx('icon')}
onClick={(e) => {
e.stopPropagation();
handler(item);
}}
key={icon}
>
{Parser(icon)}
</i>
))}
{actions.map(({ icon, handler, customIcon: CustomIcon, id }) => {
return (
<React.Fragment key={id || icon}>
{CustomIcon ? (
<CustomIcon item={item} />
) : (
<i
className={cx('icon')}
onClick={(e) => {
e.stopPropagation();
handler(item);
}}
>
{Parser(icon)}
</i>
)}
</React.Fragment>
);
})}
</span>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ RuleList.propTypes = {
actions: PropTypes.array,
onToggle: PropTypes.func,
disabled: PropTypes.bool,
ruleItemContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
ruleItemContent: PropTypes.elementType,
handleRuleItemClick: PropTypes.func,
};
RuleList.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import classNames from 'classnames/bind';
import { useTracking } from 'react-tracking';
import { useIntl } from 'react-intl';
import { canUpdateSettings } from 'common/utils/permissions';
import { SETTINGS_PAGE_EVENTS } from 'components/main/analytics/events';
import {
projectNotificationsSelector,
projectNotificationsStateSelector,
Expand All @@ -44,8 +43,8 @@ import BinIcon from 'common/img/newIcons/bin-inline.svg';
import CopyIcon from 'common/img/newIcons/copy-inline.svg';
import { projectNotificationsLoadingSelector } from 'controllers/project/selectors';
import { SpinningPreloader } from 'components/preloaders/spinningPreloader';
import { RuleList, FieldElement, NotificationRuleContent } from '../elements';
import { PROJECT_SETTINGS_NOTIFICATIONS_EVENTS } from 'analyticsEvents/projectSettingsPageEvents';
import { RuleList, FieldElement, NotificationRuleContent } from '../elements';
import { Layout } from '../layout';
import styles from './notifications.scss';
import { DEFAULT_CASE_CONFIG } from './constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const PatternAnalysisContent = ({
<RuleList
disabled={disabled}
data={patterns}
actionsConfig={actions}
actions={actions}
onToggle={onToggleHandler}
ruleItemContent={PatternRuleContent}
/>
Expand Down

0 comments on commit 9990b80

Please sign in to comment.