i18n progress bar (#2636)
This commit is contained in:
parent
cb67ed7ca6
commit
56817846c2
@ -6,7 +6,8 @@ import { AppProps as Props } from '@polkadot/react-components/types';
|
||||
|
||||
import FileSaver from 'file-saver';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Button, Columar, Column, Dropdown, Spinner } from '@polkadot/react-components';
|
||||
import styled from 'styled-components';
|
||||
import { Button, Columar, Column, Dropdown, Progress, Spinner } from '@polkadot/react-components';
|
||||
|
||||
import { useTranslation } from './translate';
|
||||
import StringInput from './StringInput';
|
||||
@ -176,7 +177,12 @@ function TranslateApp ({ className }: Props): React.ReactElement<Props> {
|
||||
options={keys}
|
||||
value={lng}
|
||||
/>
|
||||
{t('{{done}}/{{total}}, {{progress}}% done', { replace: progressDisplay(modProgress) })}
|
||||
<Progress
|
||||
color='auto'
|
||||
total={modProgress[1]}
|
||||
value={modProgress[0]}
|
||||
/>
|
||||
{t('{{done}}/{{total}}, {{progress}}% done', { replace: progressDisplay(modProgress) })}
|
||||
</Column>
|
||||
<Column>
|
||||
<Dropdown
|
||||
@ -186,7 +192,12 @@ function TranslateApp ({ className }: Props): React.ReactElement<Props> {
|
||||
options={modules}
|
||||
value={record}
|
||||
/>
|
||||
{t('{{done}}/{{total}}, {{progress}}% done', { replace: progressDisplay(allProgress[record]) })}
|
||||
<Progress
|
||||
color='auto'
|
||||
total={allProgress[record]?.[1]}
|
||||
value={allProgress[record]?.[0]}
|
||||
/>
|
||||
{t('{{done}}/{{total}}, {{progress}}% done', { replace: progressDisplay(allProgress[record]) })}
|
||||
</Column>
|
||||
</Columar>
|
||||
</header>
|
||||
@ -210,4 +221,8 @@ function TranslateApp ({ className }: Props): React.ReactElement<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(TranslateApp);
|
||||
export default React.memo(styled(TranslateApp)`
|
||||
.ui.progress:last-child {
|
||||
margin: 0.25rem;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -26,8 +26,10 @@ function Progress ({ className, color = 'blue', percent, style, total, value }:
|
||||
const _total = bnToBn(total);
|
||||
const _value = bnToBn(value);
|
||||
const calculated = _total.gtn(0)
|
||||
? 100.0 * _value.toNumber() / _total.toNumber()
|
||||
: isBn(percent) ? percent.toNumber() : percent;
|
||||
? (100.0 * _value.toNumber() / _total.toNumber())
|
||||
: isBn(percent)
|
||||
? percent.toNumber()
|
||||
: percent;
|
||||
|
||||
if (isUndefined(calculated) || calculated < 0) {
|
||||
return null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user