mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-13 13:17:13 +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
65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
/* eslint-disable react/prop-types */
|
|
import React, { useEffect } from 'react';
|
|
import { text } from '@storybook/addon-knobs';
|
|
import { store, getNewState } from '../../../.storybook/preview';
|
|
import { suggestedTokens } from '../../../.storybook/initial-states/approval-screens/add-suggested-token';
|
|
import { updateMetamaskState } from '../../store/actions';
|
|
import ConfirmAddSuggestedToken from '.';
|
|
|
|
export default {
|
|
title: 'Confirmation Screens',
|
|
id: __filename,
|
|
};
|
|
|
|
const PageSet = ({ children }) => {
|
|
const symbol = text('symbol', 'META');
|
|
const image = text('Icon URL', 'metamark.svg');
|
|
|
|
const state = store.getState();
|
|
const suggestedTokensState = state.metamask.suggestedTokens;
|
|
|
|
useEffect(() => {
|
|
suggestedTokensState[
|
|
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
|
].symbol = symbol;
|
|
store.dispatch(
|
|
updateMetamaskState(
|
|
getNewState(state.metamask, {
|
|
suggestedTokens: suggestedTokensState,
|
|
}),
|
|
),
|
|
);
|
|
}, [symbol, suggestedTokensState, state.metamask]);
|
|
useEffect(() => {
|
|
suggestedTokensState[
|
|
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
|
].image = image;
|
|
store.dispatch(
|
|
updateMetamaskState(
|
|
getNewState(state.metamask, {
|
|
suggestedTokens: suggestedTokensState,
|
|
}),
|
|
),
|
|
);
|
|
}, [image, suggestedTokensState, state.metamask]);
|
|
|
|
return children;
|
|
};
|
|
|
|
export const AddSuggestedToken = () => {
|
|
const state = store.getState();
|
|
store.dispatch(
|
|
updateMetamaskState(
|
|
getNewState(state.metamask, {
|
|
suggestedTokens,
|
|
}),
|
|
),
|
|
);
|
|
|
|
return (
|
|
<PageSet>
|
|
<ConfirmAddSuggestedToken />
|
|
</PageSet>
|
|
);
|
|
};
|