Skip to content

Commit

Permalink
EPMRPP-77501 || sorted integrations after add new item (#3371)
Browse files Browse the repository at this point in the history
* EPMRPP-77501 || sorted integrations after add new item

* EPMRPP-77501 || Code review fixes - 1

* EPMRPP-77501 || Code review fixes - 2

Co-authored-by: Ilya Hancharyk <Ilya_Hancharyk@epam.com>
  • Loading branch information
Alexander and AmsterGet committed Jan 5, 2023
1 parent 725a767 commit 3b13ed3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/src/controllers/plugins/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {

const addIntegration = (state, type, payload) => ({
...state,
[type]: [...state[type], payload],
[type]: [payload, ...state[type]],
});

const updateIntegration = (state, type, payload) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,29 @@ import styles from './integrationCollection.scss';

const cx = classNames.bind(styles);

export const IntegrationCollection = ({ items, disabled, openIntegration }) => {
return (
<div className={cx('instances-list-wrapper')}>
<ul className={cx('instances-list')}>
{items.map((item) => (
<IntegrationCollectionItem
key={item.id}
item={item}
id={item.id}
disabled={disabled}
title={item.name}
creator={item.creator}
creationInfo={moment(item.creationDate).format('ll')}
openIntegration={openIntegration}
/>
))}
</ul>
</div>
);
};

export const IntegrationCollection = ({ items, disabled, openIntegration }) => (
<div className={cx('instances-list-wrapper')}>
<ul className={cx('instances-list')}>
{items.map((item) => (
<IntegrationCollectionItem
key={item.id}
item={item}
id={item.id}
disabled={disabled}
title={item.name}
creator={item.creator}
creationInfo={moment(item.creationDate).format('ll')}
openIntegration={openIntegration}
/>
))}
</ul>
</div>
);
IntegrationCollection.propTypes = {
items: PropTypes.array.isRequired,
disabled: PropTypes.bool,
openIntegration: PropTypes.func,
};

IntegrationCollection.defaultProps = {
disabled: false,
openIntegration: () => {},
Expand Down

0 comments on commit 3b13ed3

Please sign in to comment.