Skip to content

Commit

Permalink
Merge branch 'release/4.23' into fix/YOEXT-755/delegation-info-from-b…
Browse files Browse the repository at this point in the history
…ackend
  • Loading branch information
vsubhuman authored Oct 8, 2023
2 parents 9b9c49f + efc2c22 commit ebef233
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ function StepController(props: Props): Node {
py="24px"
gap="24px"
>
{actions.map(({ type, label, disabled, onClick }) => {
{actions.map(({ type, label, disabled, onClick }, idx) => {
const isPrimary = type === 'primary';
return (
<Button
key={idx}
variant={isPrimary ? 'contained' : 'outlined'}
color="primary"
disableRipple={false}
onClick={onClick}
disabled={disabled}
style={{ width: '144px', height: '48px' }}
id={type+'Button'}
id={type + 'Button'}
>
{label}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ export default class RestoreRecoveryPhraseFormClass extends Component<Props, Sta

return (
<Stack
item
// use the form name key to know when we reset
key={form.name + '-word-' + idx}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ type Props = {|
+percentage: number,
+days: string,
+currentEpoch: number,
+startEpochDate: string,
+endEpochDate: string,
+startEpochDate: string | Date,
+endEpochDate: string | Date,
|};

export function EpochProgressCard({
Expand Down Expand Up @@ -50,7 +50,7 @@ const Title = ({ label, value }: TitleProps): Node => {

type InfoColumnProps = {|
+label: string,
+value: string | number,
+value: string | number | Date,
|};
const LabelWithValue = ({ label, value }: InfoColumnProps): Node => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// @flow
import type { ComponentType, Node } from 'react';
import type { $npm$ReactIntl$IntlShape } from 'react-intl';
import { Box, styled } from '@mui/system';
import { Typography } from '@mui/material';
import { observer } from 'mobx-react';
import { injectIntl } from 'react-intl';
import type { $npm$ReactIntl$IntlShape } from 'react-intl';
import globalMessages from '../../../../i18n/global-messages';
import { EpochProgressCard } from './EpochProgressCard';
import globalMessages from '../../../../i18n/global-messages';
import moment from 'moment';

type Props = {|
epochProgress: {|
currentEpoch: number,
startEpochDate: string,
endEpochDate: string,
startEpochDate: string | Date,
endEpochDate: string | Date,
endEpochDateTime: Date,
percentage: number,
|},
|};
Expand All @@ -23,6 +24,8 @@ type Intl = {|
|};

function EpochProgressWrapper({ epochProgress, intl }: Props & Intl): Node {
const days = moment(epochProgress.endEpochDateTime).diff(moment(), 'days');

return (
<Card>
<Box
Expand All @@ -38,7 +41,7 @@ function EpochProgressWrapper({ epochProgress, intl }: Props & Intl): Node {
<Box sx={{ padding: '24px' }}>
<EpochProgressCard
percentage={epochProgress.percentage}
days={moment(epochProgress.endEpochDate).diff(moment(), 'days')}
days={days}
currentEpoch={epochProgress.currentEpoch}
startEpochDate={epochProgress.startEpochDate}
endEpochDate={epochProgress.endEpochDate}
Expand Down
27 changes: 13 additions & 14 deletions packages/yoroi-extension/app/containers/wallet/WalletSummaryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,11 @@ class WalletSummaryPage extends Component<AllProps> {
);

if (recent.length > 0) {
const noTransactionsFoundLabel = intl.formatMessage(globalMessages.noTransactionsFound);

const mapWalletTransactionLayout = {
CLASSIC: WalletTransactionsList,
REVAMP: WalletTransactionsListRevamp,
};
const mapWalletNoTransactionsLayout = {
CLASSIC: WalletNoTransactions,
REVAMP: WalletNoTransactionsRevamp,
};
const WalletTransactionsListComp = mapWalletTransactionLayout[this.props.selectedLayout];
const WalletNoTransactionsComp = mapWalletNoTransactionsLayout[this.props.selectedLayout];

if (isLoading || hasAny) {
const {
Expand Down Expand Up @@ -196,14 +189,20 @@ class WalletSummaryPage extends Component<AllProps> {
complexityLevel={this.generated.stores.profile.selectedComplexityLevel}
/>
);
} else {
walletTransactions = (
<WalletNoTransactionsComp
label={noTransactionsFoundLabel}
classicTheme={profile.isClassicTheme}
/>
);
}
} else {
const mapWalletNoTransactionsLayout = {
CLASSIC: WalletNoTransactions,
REVAMP: WalletNoTransactionsRevamp,
};
const WalletNoTransactionsComp = mapWalletNoTransactionsLayout[this.props.selectedLayout];
const noTransactionsFoundLabel = intl.formatMessage(globalMessages.noTransactionsFound);
walletTransactions = (
<WalletNoTransactionsComp
label={noTransactionsFoundLabel}
classicTheme={profile.isClassicTheme}
/>
);
}

const notification = this._getThisPageActiveNotification();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import { observer } from 'mobx-react';
import { computed } from 'mobx';
import { SelectedExplorer } from '../../../domain/SelectedExplorer';
import { PublicDeriver } from '../../../api/ada/lib/storage/models/PublicDeriver';
import { ROUTES } from '../../../routes-config';
import { MultiToken } from '../../../api/common/lib/MultiToken';
import TopBarLayout from '../../../components/layout/TopBarLayout';
import BannerContainer from '../../banners/BannerContainer';
import SidebarContainer from '../../SidebarContainer';
import LocalizableError from '../../../i18n/LocalizableError';
import { ROUTES } from '../../../routes-config';

export const RestoreWalletPagePromise: void => Promise<any> = () =>
import('../../../components/wallet/restore/RestoreWalletPage');
Expand Down Expand Up @@ -111,6 +112,9 @@ export default class RestoreWalletPage extends Component<Props> {
walletSettings: {|
getConceptualWalletSettingsCache: ConceptualWallet => ConceptualWalletSettingsCache,
|},
transactions: {|
getBalance: (PublicDeriver<>) => MultiToken | null,
|},
|},
|} {
if (this.props.generated !== undefined) {
Expand Down Expand Up @@ -149,6 +153,9 @@ export default class RestoreWalletPage extends Component<Props> {
selectedAccount: stores.walletRestore.selectedAccount,
mode: stores.walletRestore.mode,
},
transactions: {
getBalance: stores.transactions.getBalance,
},
},
actions: {
dialogs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class StakingPageContent extends Component<AllProps> {
const currentEpoch = currTimeRequests.currentEpoch;
const epochLength = getEpochLength();

const getDateFromEpoch = epoch => {
const getDateFromEpoch = (epoch, returnEpochTime = false) => {
const epochTime = toRealTime({
absoluteSlotNum: toAbsoluteSlot({
epoch,
Expand All @@ -270,11 +270,15 @@ class StakingPageContent extends Component<AllProps> {
}),
timeSinceGenesisFunc: timeSinceGenesis,
});

if (returnEpochTime) return epochTime;

const epochMoment = moment(epochTime).format('lll');
return epochMoment;
};

const endEpochDate = getDateFromEpoch(currentEpoch);
const endEpochDateTime = getDateFromEpoch(currentEpoch, true);
const previousEpochDate = getDateFromEpoch(currentEpoch - 1);

return (
Expand All @@ -283,6 +287,7 @@ class StakingPageContent extends Component<AllProps> {
startEpochDate: previousEpochDate,
currentEpoch,
endEpochDate,
endEpochDateTime,
percentage: Math.floor((100 * currTimeRequests.currentSlot) / epochLength),
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import {
loadSubmittedTransactions,
persistSubmittedTransactions,
} from '../../api/localStorage';
import { FETCH_TXS_BATCH_SIZE } from '../../api/ada';
import LegacyTransactionsStore from './LegacyTransactionsStore';
import type { Api } from '../../api/index';
import { getAllAddressesForWallet } from '../../api/ada/lib/storage/bridge/traitUtils';
Expand Down Expand Up @@ -571,7 +570,7 @@ export default class TransactionsStore extends Store<StoresMap, ActionsMap> {
const result = await tailRequest.promise;
runInAction(() => {
state.txs.splice(state.txs.length, 0, ...result);
state.hasMoreToLoad = result.length === FETCH_TXS_BATCH_SIZE;
state.hasMoreToLoad = result.length > 0;
});

await this._afterLoadingNewTxs(
Expand Down

0 comments on commit ebef233

Please sign in to comment.