2020-07-03 23:32:39 +02:00
|
|
|
import { utils, CommandRuntime, CommandDeclaration } from '../services/CommandService';
|
|
|
|
const { _ } = require('lib/locale');
|
|
|
|
|
|
|
|
export const declaration:CommandDeclaration = {
|
|
|
|
name: 'historyForward',
|
|
|
|
label: () => _('Forward'),
|
2020-09-15 15:01:07 +02:00
|
|
|
iconName: 'icon-forward',
|
2020-07-03 23:32:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
forwardHistoryNotes: any[],
|
|
|
|
}
|
|
|
|
|
|
|
|
export const runtime = ():CommandRuntime => {
|
|
|
|
return {
|
|
|
|
execute: async (props:Props) => {
|
|
|
|
if (!props.forwardHistoryNotes.length) return;
|
|
|
|
utils.store.dispatch({
|
|
|
|
type: 'HISTORY_FORWARD',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
isEnabled: (props:Props) => {
|
|
|
|
return props.forwardHistoryNotes.length > 0;
|
|
|
|
},
|
|
|
|
mapStateToProps: (state:any) => {
|
|
|
|
return { forwardHistoryNotes: state.forwardHistoryNotes };
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|