mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-12 12:47:14 +01:00
f472c2615a
* ci/announce/highlight - add bot announcement section for "highlights" showing off important diffs + storybook highlights * ci/announce/highlight - fix announcement message * Update index.js * xxx tmp xxx * ci/announce/highlight - fix dirty file calculation * ci/announce/highlight - try/catch wrap highlight generation for build stability * ui - put fox emojis in the mascot component * ci/announce/highlight - start storybook permalinks * ci/announce/highlight - fix storybook permalink util * ci/announce/highlight - fix storybook permalink util * ci/announce/highlight - small styling fix * storybook - use any easily predictable story id * ci/announce/highlight - revert sample commit * ci/announce/highlight - minimal documentation
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import React, { useEffect } from 'react';
|
|
|
|
import { select } from '@storybook/addon-knobs';
|
|
import { store } from '../../../.storybook/preview';
|
|
import { updateTransactionParams } from '../../store/actions';
|
|
import ConfirmSendEther from '.';
|
|
|
|
export default {
|
|
title: 'Confirmation Screens',
|
|
id: __filename,
|
|
};
|
|
|
|
// transaction id for redux dispatcher
|
|
const id = 3111025347726181;
|
|
|
|
const PageSet = ({ children }) => {
|
|
const options = [];
|
|
const receiverOptions = {
|
|
'Address 1': '0xaD6D458402F60fD3Bd25163575031ACDce07538D',
|
|
'Address 2': '0x55e0bfb2d400e9be8cf9b114e38a40969a02f69a',
|
|
};
|
|
const state = store.getState();
|
|
const { identities } = state.metamask;
|
|
Object.keys(identities).forEach(function (key) {
|
|
options.push({
|
|
label: identities[key].name,
|
|
address: key,
|
|
});
|
|
});
|
|
const sender = select('Sender', options, options[0]);
|
|
const receiver = select(
|
|
'Receiver',
|
|
receiverOptions,
|
|
'0xaD6D458402F60fD3Bd25163575031ACDce07538D',
|
|
);
|
|
|
|
const confirmTransactionState = state.confirmTransaction.txData.txParams;
|
|
|
|
useEffect(() => {
|
|
confirmTransactionState.from = sender.address;
|
|
store.dispatch(updateTransactionParams(id, confirmTransactionState));
|
|
}, [sender, confirmTransactionState]);
|
|
|
|
useEffect(() => {
|
|
confirmTransactionState.to = receiver;
|
|
store.dispatch(updateTransactionParams(id, confirmTransactionState));
|
|
}, [receiver, confirmTransactionState]);
|
|
return children;
|
|
};
|
|
|
|
export const SendEther = () => {
|
|
return (
|
|
<PageSet>
|
|
<ConfirmSendEther />
|
|
</PageSet>
|
|
);
|
|
};
|