Skip to content

Commit

Permalink
Feat: Nominate proxy (#1647)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuul-wq authored Apr 9, 2024
1 parent 799d3dd commit c12edfe
Show file tree
Hide file tree
Showing 43 changed files with 1,388 additions and 2,042 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { getMetadataPortalMetadataUrl, TROUBLESHOOTING_URL } from '../common/con

type Props = {
countdown: number;
onQrReset: () => void;
chainId: ChainId;
onQrReset: () => void;
};

export const QrGeneratorContainer = ({ countdown, onQrReset, chainId, children }: PropsWithChildren<Props>) => {
export const QrGeneratorContainer = ({ countdown, chainId, children, onQrReset }: PropsWithChildren<Props>) => {
const { t } = useI18n();

return (
Expand Down
26 changes: 19 additions & 7 deletions src/renderer/entities/transaction/ui/Scanning/ScanMultiframeQr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { useEffect, useState } from 'react';
import { useI18n } from '@app/providers';
import { Transaction, useTransaction } from '@entities/transaction';
import { toAddress } from '@shared/lib/utils';
import { Button } from '@shared/ui';
import { Button, FootnoteText } from '@shared/ui';
import type { Account, BaseAccount, ChainId, ShardAccount } from '@shared/core';
import { SigningType, Wallet } from '@shared/core';
import { createSubstrateSignPayload, createMultipleSignPayload } from '../QrCode/QrGenerator/common/utils';
import { TRANSACTION_BULK } from '../QrCode/common/constants';
import { QrMultiframeGenerator } from '../QrCode/QrGenerator/QrMultiframeTxGenerator';
import { QrGeneratorContainer } from '../QrCode/QrGeneratorContainer/QrGeneratorContainer';
import { WalletIcon } from '../../../wallet';

type Props = {
api: ApiPromise;
Expand Down Expand Up @@ -103,16 +104,27 @@ export const ScanMultiframeQr = ({

return (
<div className="flex flex-col items-center w-full">
<div className="mt-10">
<QrGeneratorContainer countdown={countdown} chainId={chainId} onQrReset={setupTransactions}>
{bulkTxExist && encoder && <QrMultiframeGenerator payload={bulkTransactions} size={200} encoder={encoder} />}
</QrGeneratorContainer>
</div>
{accounts.length > 0 && (
<div className="flex items-center justify-center mb-1 h-8 w-full">
<div className="flex h-full justify-center items-center gap-x-0.5 ">
<FootnoteText className="text-text-secondary">{t('signing.signer')}</FootnoteText>

<div className="w-full flex gap-x-2 items-center px-2">
<WalletIcon className="shrink-0" type={signerWallet.type} size={16} />
<FootnoteText className="text-text-secondary w-max">{signerWallet.name}</FootnoteText>
</div>
</div>
</div>
)}

<QrGeneratorContainer countdown={countdown} chainId={chainId} onQrReset={setupTransactions}>
{bulkTxExist && encoder && <QrMultiframeGenerator payload={bulkTransactions} size={200} encoder={encoder} />}
</QrGeneratorContainer>

<div className="flex w-full justify-between mt-3">
<Button variant="text" onClick={onGoBack}>
{t('operation.goBackButton')}
</Button>

<Button disabled={!bulkTxExist || countdown === 0} onClick={() => onResult(unsignedTransactions, txPayloads)}>
{t('signing.continueButton')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const ScanSingleframeQr = ({

return (
<div className="flex flex-col items-center w-full">
<div className="flex items-center justify-center mb-1 h-8 w-full">
{account && (
{account && (
<div className="flex items-center justify-center mb-1 h-8 w-full">
<div className="flex h-full justify-center items-center gap-x-0.5 ">
<FootnoteText className="text-text-secondary">{t('signing.signer')}</FootnoteText>

Expand All @@ -76,8 +76,8 @@ export const ScanSingleframeQr = ({
<FootnoteText className="text-text-secondary w-max">{signerWallet.name}</FootnoteText>
</div>
</div>
)}
</div>
</div>
)}

<QrGeneratorContainer countdown={countdown} chainId={chainId} onQrReset={setupTransaction}>
{txPayload && (
Expand Down
Empty file.

This file was deleted.

Loading

0 comments on commit c12edfe

Please sign in to comment.