mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
789779f4d5
* Add new snap header and footer to snap install * Add new snap header and footer to snap result and snap update * Fix loading state * Fix lint * Add required scrolling * Adjust avatar component * Apply new headers and footers to snaps confirmations * Rename previous SnapAuthorship component to SnapAuthorshipExpanded * Fix lint * Fix font weight * Fix fencing * Fix a test * Fix lint after rebase * Fix E2E * Fix locale lint * Fix another E2E * Fix test ID * Address PR comments * Better scroll button centering * Address design comments * Fix unit test * Fix E2Es
70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
import { mapToTemplate } from '../../../../../components/app/snaps/snap-ui-renderer';
|
|
import { MESSAGE_TYPE } from '../../../../../../shared/constants/app';
|
|
import { DelineatorType } from '../../../../../helpers/constants/snaps';
|
|
|
|
function getValues(pendingApproval, t, actions, _history, setInputState) {
|
|
const {
|
|
snapName,
|
|
requestData: { content, placeholder },
|
|
} = pendingApproval;
|
|
const elementKeyIndex = { value: 0 };
|
|
|
|
return {
|
|
content: [
|
|
{
|
|
element: 'Box',
|
|
key: 'snap-dialog-content-wrapper',
|
|
props: {
|
|
marginTop: 4,
|
|
marginLeft: 4,
|
|
marginRight: 4,
|
|
},
|
|
children: {
|
|
element: 'SnapDelineator',
|
|
key: 'snap-delineator',
|
|
props: {
|
|
type: DelineatorType.Content,
|
|
snapName,
|
|
},
|
|
children: [
|
|
// TODO: Replace with SnapUIRenderer when we don't need to inject the input manually.
|
|
mapToTemplate(content, elementKeyIndex),
|
|
{
|
|
element: 'div',
|
|
key: 'snap-prompt-container',
|
|
children: {
|
|
element: 'TextField',
|
|
key: 'snap-prompt-input',
|
|
props: {
|
|
className: 'snap-prompt-input',
|
|
placeholder,
|
|
max: 300,
|
|
onChange: (event) => {
|
|
const inputValue = event.target.value ?? '';
|
|
setInputState(MESSAGE_TYPE.SNAP_DIALOG_PROMPT, inputValue);
|
|
},
|
|
theme: 'bordered',
|
|
},
|
|
},
|
|
props: {
|
|
className: 'snap-prompt',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
cancelText: t('cancel'),
|
|
submitText: t('submit'),
|
|
onSubmit: (inputValue) =>
|
|
actions.resolvePendingApproval(pendingApproval.id, inputValue),
|
|
onCancel: () => actions.resolvePendingApproval(pendingApproval.id, null),
|
|
};
|
|
}
|
|
|
|
const snapConfirm = {
|
|
getValues,
|
|
};
|
|
|
|
export default snapConfirm;
|