Skip to content
Permalink
Browse files

connect delegation pages (simple and advance)

  • Loading branch information
nicarq committed Dec 2, 2019
1 parent 1cdf357 commit d3fef2ab9a23ad2a523cd2f3f287c19873430f34
@@ -33,3 +33,4 @@ chrome/manifest.*.json

# history plugin for vscode
.history
Yoroi Shelley Testnet
@@ -33,8 +33,8 @@ import YoroiTransferPage from './containers/transfer/YoroiTransferPage';
import URILandingPage from './containers/uri/URILandingPage';
import Transfer from './containers/transfer/Transfer';
import StakingDashboardPage from './containers/wallet/staking/StakingDashboardPage';
import StakingSimulatorPage from './containers/wallet/staking/StakingSimulatorPage';
import StakingAdvancedSimulatorPage from './containers/wallet/staking/StakingAdvancedSimulatorPage';
import StakingSimplePage from './containers/wallet/staking/StakingSimplePage';
import StakingAdvancePage from './containers/wallet/staking/StakingAdvancePage';

/* eslint-disable max-len */
export const Routes = (
@@ -128,18 +128,18 @@ const WalletsSubpages = (stores, actions) => (
<>
<Route
exact
path={ROUTES.WALLETS.STAKE_DASHBOARD}
path={ROUTES.WALLETS.DELEGATION_DASHBOARD}
component={(props) => <StakingDashboardPage {...props} stores={stores} actions={actions} />}
/>
<Route
exact
path={ROUTES.WALLETS.STAKE_SIMULATOR}
component={(props) => <StakingSimulatorPage {...props} stores={stores} actions={actions} />}
path={ROUTES.WALLETS.DELEGATION_SIMPLE}
component={(props) => <StakingSimplePage {...props} stores={stores} actions={actions} />}
/>
<Route
exact
path={ROUTES.WALLETS.STAKE_ADVANCED_SIMULATOR}
component={(props) => <StakingAdvancedSimulatorPage {...props} stores={stores} actions={actions} />}
path={ROUTES.WALLETS.DELEGATION_ADVANCE}
component={(props) => <StakingAdvancePage {...props} stores={stores} actions={actions} />}
/>
</>)
}
@@ -22,17 +22,17 @@ const messages = defineMessages({
id: 'wallet.navigation.receive',
defaultMessage: '!!!Receive',
},
stakeDashboard: {
id: 'wallet.navigation.stakeDashboard',
delegationDashboard: {
id: 'wallet.navigation.delegationDashboard',
defaultMessage: '!!!Dashboard',
},
stakeAdvancedSimulator: {
id: 'wallet.navigation.stakeAdvancedSimulator',
defaultMessage: '!!!Advanced staking simulator',
delegationAdvance: {
id: 'wallet.navigation.delegationAdvance',
defaultMessage: '!!!Delegation (Advance)',
},
stakeSimulator: {
id: 'wallet.navigation.stakeSimulator',
defaultMessage: '!!!Simple staking simulator',
delegationSimple: {
id: 'wallet.navigation.delegationSimple',
defaultMessage: '!!!Delegation (Simple)',
},
});

@@ -90,30 +90,30 @@ export default class WalletNavigation extends Component<Props> {
<div className={styles.navItem}>
<WalletNavButton
className="stakeDashboard"
label={intl.formatMessage(messages.stakeDashboard)}
label={intl.formatMessage(messages.delegationDashboard)}
icon={summaryIcon}
isActive={isActiveNavItem('stake-dashboard')}
onClick={() => onNavItemClick('stake-dashboard')}
isActive={isActiveNavItem('delegation-dashboard')}
onClick={() => onNavItemClick('delegation-dashboard')}
/>
</div>

<div className={styles.navItem}>
<WalletNavButton
className="stakeSimulator"
label={intl.formatMessage(messages.stakeSimulator)}
label={intl.formatMessage(messages.delegationSimple)}
icon={sendIcon}
isActive={isActiveNavItem('stake-simulator')}
onClick={() => onNavItemClick('stake-simulator')}
isActive={isActiveNavItem('delegation-simple')}
onClick={() => onNavItemClick('delegation-simple')}
/>
</div>

<div className={styles.navItem}>
<WalletNavButton
className="stakeAdvancedSimulator"
label={intl.formatMessage(messages.stakeAdvancedSimulator)}
label={intl.formatMessage(messages.delegationAdvance)}
icon={receiveIcon}
isActive={isActiveNavItem('stake-advanced-simulator')}
onClick={() => onNavItemClick('stake-advanced-simulator')}
isActive={isActiveNavItem('delegation-advance')}
onClick={() => onNavItemClick('delegation-advance')}
/>
</div>
</>
@@ -1,8 +1,6 @@
// @flow

import React from 'react';
import MainLayout from '../../MainLayout';
import TopBarContainer from '../../TopBarContainer';
import type { InjectedContainerProps } from '../../../types/injectedPropsType';

const prettifyReceivedPools = (pools: Array<{
@@ -28,35 +26,22 @@ const useIframeMessageReceiver = () => {
return () => {
window.removeEventListener('message', messageHandler);
};

}, []);
};

const Staking = (props: InjectedContainerProps) => {
const iframeRef = React.useRef(null);
const { actions, stores, children } = props;
const { stores, stakingUrl } = props;
const { profile } = stores;
const topbarContainer = (<TopBarContainer actions={actions} stores={stores} />);

useIframeMessageReceiver();

const seizaUrl = process.env.SEIZA_FOR_YOROI_URL;
if (seizaUrl == null) {
if (stakingUrl == null) {
throw new Error('Staking undefined SEIZA_FOR_YOROI_URL should never happen');
}
return (
<MainLayout
topbar={topbarContainer}
// TODO: Check Seiza server connection
connectionErrorType="healthy"
actions={actions}
stores={stores}
>
<iframe ref={iframeRef} title="Staking" src={`${seizaUrl}/staking?locale=${profile.currentLocale}`} frameBorder="0" width="100%" height="100%" />;
{children}
</MainLayout>
<iframe ref={iframeRef} title="Staking" src={`${stakingUrl}&locale=${profile.currentLocale}`} frameBorder="0" width="100%" height="100%" />
);

};

export default Staking;
@@ -0,0 +1,21 @@
// @flow
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import SeizaFetcher from './SeizaFetcher';

import type { InjectedProps } from '../../../types/injectedPropsType';
import {ConfigType} from "../../../../config/config-types";

type Props = InjectedProps

declare var CONFIG: ConfigType;
const seizaAdvance = CONFIG.seiza.advance;

@observer
export default class StakingAdvancePage extends Component<Props> {

render() {
const { stores } = this.props;
return (<SeizaFetcher {...this.props} stores={stores} stakingUrl={seizaAdvance} />);
}
}

This file was deleted.

@@ -0,0 +1,21 @@
// @flow
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import SeizaFetcher from './SeizaFetcher';

import type { InjectedProps } from '../../../types/injectedPropsType';
import {ConfigType} from "../../../../config/config-types";

type Props = InjectedProps;

declare var CONFIG: ConfigType;
const seizaSimple = CONFIG.seiza.simple;

@observer
export default class StakingSimplePage extends Component<Props> {

render() {
const { stores } = this.props;
return (<SeizaFetcher {...this.props} stores={stores} stakingUrl={seizaSimple} />);
}
}

This file was deleted.

@@ -14,9 +14,9 @@ export const ROUTES = {
TRANSACTIONS: '/wallets/:id/transactions',
SEND: '/wallets/:id/send',
RECEIVE: '/wallets/:id/receive',
STAKE_DASHBOARD: '/wallets/:id/stake-dashboard',
STAKE_SIMULATOR: '/wallets/:id/stake-simulator',
STAKE_ADVANCED_SIMULATOR: '/wallets/:id/stake-advanced-simulator',
DELEGATION_DASHBOARD: '/wallets/:id/delegation-dashboard',
DELEGATION_SIMPLE: '/wallets/:id/delegation-simple',
DELEGATION_ADVANCE: '/wallets/:id/delegation-advance',
},
SETTINGS: {
ROOT: '/settings',
@@ -5,6 +5,10 @@
"websocketUrl": "wss://testnet-yoroi-backend.yoroiwallet.com:443",
"name": "shelley-dev"
},
"seiza": {
"simple": "http://localhost:3001/staking-simple/list?sortBy=REVENUE&searchText=&performance[]=0&performance[]=100",
"advance": "http://localhost:3001/staking/list?sortBy=REVENUE&searchText=&performance[]=0&performance[]=100"
},
"app": {
"walletRefreshInterval": 20000,
"serverStatusRefreshInterval": 20000,

0 comments on commit d3fef2a

Please sign in to comment.
You can’t perform that action at this time.