/
index.tsx
33 lines (31 loc) · 1.16 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { dispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { PanelBody, SelectControl } from '@wordpress/components';
import { PlainBodyTitle } from '../../../../../editor/components';
import { storeName } from '../../../../../editor/store';
export function Edit(): JSX.Element {
const { selectedStep } = useSelect((select) => ({
selectedStep: select(storeName).getSelectedStep(),
}));
return (
<PanelBody opened>
<PlainBodyTitle title={__('Settings', 'mailpoet')} />
<SelectControl
onChange={(id: string) => {
void dispatch(storeName).updateStepArgs(
selectedStep.id,
'wait',
parseInt(id, 10),
);
}}
defaultValue={(selectedStep.args?.wait as string) ?? '30'}
>
<option value="30">{__('30 minutes', 'mailpoet')}</option>
<option value="60">{__('1 hour', 'mailpoet')}</option>
<option value="240">{__('4 hours', 'mailpoet')}</option>
<option value="1440">{__('1 day', 'mailpoet')}</option>
<option value="4320">{__('3 days', 'mailpoet')}</option>
</SelectControl>
</PanelBody>
);
}