#38: Enhance new repertory release available notification - partial
This commit is contained in:
@@ -1,17 +1,40 @@
|
||||
import React from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import * as Constants from '../../../constants';
|
||||
import Button from '../../UI/Button/Button';
|
||||
import {formatLinesForDisplay, getChangesForRepertoryVersion} from '../../../utils';
|
||||
import {
|
||||
notifyError,
|
||||
notifyInfo
|
||||
} from '../../../redux/actions/error_actions';
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
notifyError: msg => dispatch(notifyError(msg)),
|
||||
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(({release, lastItem, notifyError, notifyInfo}) => {
|
||||
const title = '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
|
||||
const displayChanges = async () => {
|
||||
try {
|
||||
const lines = await getChangesForRepertoryVersion(release.VersionString);
|
||||
notifyInfo(title, formatLinesForDisplay(lines));
|
||||
} catch (e) {
|
||||
notifyError(e);
|
||||
}
|
||||
};
|
||||
|
||||
export default ({release, lastItem}) => {
|
||||
return (
|
||||
<div>
|
||||
<h2>{'[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display }</h2>
|
||||
<h2>{title}</h2>
|
||||
<table cellSpacing={0} cellPadding={0} width="97%">
|
||||
<tbody>
|
||||
<tr style={{height: '4px'}}/>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<Button buttonStyles={{width: '100%'}}>Changes</Button>
|
||||
<Button buttonStyles={{width: '100%'}} clicked={displayChanges}>Changes</Button>
|
||||
</td>
|
||||
<td>
|
||||
<div style={{width: 'var(--default_spacing)'}}/>
|
||||
@@ -25,4 +48,4 @@ export default ({release, lastItem}) => {
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user