PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / workflows / abilities / components / ImageAcquisitionRequest.jsx

ImageAcquisitionRequest.jsx in Extendify 3.2.1, at src/Agent/workflows/abilities/components/ImageAcquisitionRequest.jsx

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 ImagePicker,
3 PickerActions,
4 PickerButton,
5 } from '@agent/components/ImagePicker';
6 import { __ } from '@wordpress/i18n';
7
8 const done = (id, result) =>
9 window.dispatchEvent(
10 new CustomEvent('extendify-agent:client-tool-done', {
11 detail: { id, result },
12 }),
13 );
14
15 export const ImageAcquisitionRequest = ({ message }) => {
16 const { id, details } = message;
17 const { prompt = '', search = '', tab } = details.inputs ?? {};
18
19 return (
20 <ImagePicker
21 prompt={prompt}
22 search={search}
23 tab={tab}
24 autoGenerate={tab === 'generate'}
25 onSubmit={(image) =>
26 done(id, { id: image.id, url: image.source_url || image.url })
27 }
28 onError={(failure) =>
29 done(id, { error: failure?.message || 'Image import failed' })
30 }
31 footer={({ ready, busy, submit }) => (
32 <PickerActions>
33 <PickerButton
34 disabled={busy}
35 onClick={() => done(id, { skipped: true })}
36 >
37 {__('Skip', 'extendify-local')}
38 </PickerButton>
39 <PickerButton primary disabled={!ready || busy} onClick={submit}>
40 {busy
41 ? __('Saving...', 'extendify-local')
42 : __('Submit', 'extendify-local')}
43 </PickerButton>
44 </PickerActions>
45 )}
46 />
47 );
48 };
49