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