1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00
joplin/ReactNativeClient/lib/commands/historyBackward.ts
2020-09-15 14:01:07 +01:00

31 lines
744 B
TypeScript

import { utils, CommandRuntime, CommandDeclaration } from '../services/CommandService';
const { _ } = require('lib/locale');
export const declaration:CommandDeclaration = {
name: 'historyBackward',
label: () => _('Back'),
// iconName: 'fa-arrow-left',
iconName: 'icon-back',
};
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 };
},
};
};