Swap to fa spinner (#3047)
This commit is contained in:
parent
5af867a633
commit
9d7027d236
@ -98,7 +98,7 @@ function Payouts ({ className = '', isInElection }: Props): React.ReactElement<P
|
||||
const [partialEras, setPartialEras] = useState(21);
|
||||
const historyDepth = useCall<u32>(api.query.staking.historyDepth, []);
|
||||
const stakerPayoutsAfter = useStakerPayouts();
|
||||
const { allRewards, isLoadingRewards } = useOwnEraRewards(!historyDepth || isPartialEras ? partialEras : historyDepth.toNumber());
|
||||
const { allRewards, isLoadingRewards } = useOwnEraRewards((!historyDepth || isPartialEras) ? partialEras : historyDepth.toNumber());
|
||||
const { t } = useTranslation();
|
||||
const isDisabled = isInElection || !isFunction(api.tx.utility?.batch);
|
||||
|
||||
@ -177,7 +177,9 @@ function Payouts ({ className = '', isInElection }: Props): React.ReactElement<P
|
||||
<ElectionBanner isInElection={isInElection} />
|
||||
<Table
|
||||
empty={!isLoadingRewards && stashes && t<string>('No pending payouts for your stashes')}
|
||||
emptySpinner={t<string>('Retrieving info for all applicable eras, this will take some time')}
|
||||
emptySpinner={t<string>('Retrieving info for last {{numEras}} eras, this will take some time', {
|
||||
replace: { numEras: (!historyDepth || isPartialEras) ? partialEras : historyDepth.toNumber() }
|
||||
})}
|
||||
footer={footer}
|
||||
header={headerStashes}
|
||||
isFixed
|
||||
|
||||
@ -12,16 +12,17 @@ interface Props {
|
||||
className?: string;
|
||||
color?: 'gray' | 'green' | 'normal' | 'orange' | 'red';
|
||||
icon: IconName;
|
||||
isSpinning?: boolean;
|
||||
onClick?: () => void;
|
||||
onMouseOut?: () => void;
|
||||
onMouseOver?: () => void;
|
||||
size?: 'large';
|
||||
size?: '1x' | '2x';
|
||||
}
|
||||
|
||||
// one-time init of FA libraries
|
||||
library.add(fas);
|
||||
|
||||
function Icon ({ className = '', color = 'normal', icon, onClick, onMouseOut, onMouseOver, size }: Props): React.ReactElement<Props> {
|
||||
function Icon ({ className = '', color = 'normal', icon, isSpinning, onClick, onMouseOut, onMouseOver, size = '1x' }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<FontAwesomeIcon
|
||||
className={`ui--Icon ${color}Color ${onClick ? 'isClickable' : ''} ${className}`}
|
||||
@ -29,7 +30,8 @@ function Icon ({ className = '', color = 'normal', icon, onClick, onMouseOut, on
|
||||
onClick={onClick}
|
||||
onMouseOut={onMouseOut}
|
||||
onMouseOver={onMouseOver}
|
||||
size={size === 'large' ? '2x' : '1x'}
|
||||
size={size}
|
||||
spin={isSpinning}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import React from 'react';
|
||||
import Loader from 'semantic-ui-react/dist/commonjs/elements/Loader/Loader';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { useTranslation } from './translate';
|
||||
import Icon from './Icon';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@ -19,26 +19,34 @@ function Spinner ({ className = '', label, variant = 'app' }: Props): React.Reac
|
||||
|
||||
return (
|
||||
<div className={`${className} ui--Spinner ${variant}`}>
|
||||
<Loader
|
||||
active
|
||||
className='ui--highlight--spinner'
|
||||
indeterminate
|
||||
inline='centered'
|
||||
size='medium'
|
||||
>
|
||||
<Icon
|
||||
className='ui--highlight--color'
|
||||
icon='spinner'
|
||||
isSpinning
|
||||
size='2x'
|
||||
/>
|
||||
<div className='text'>
|
||||
{variant === 'app' && (
|
||||
label || t<string>('Retrieving data')
|
||||
)}
|
||||
</Loader>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(styled(Spinner)`
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
|
||||
.ui--Icon {
|
||||
margin-bottom: 0.5rem;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.text {
|
||||
color: inherit !important;
|
||||
margin: 0 auto 1.5rem auto;
|
||||
opacity: 0.6;
|
||||
text-align: center;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -231,13 +231,6 @@ export default React.memo(styled(Status)`
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
|
||||
.ui--highlight--spinner {
|
||||
&:after {
|
||||
border-color: #fff transparent transparent !important;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
@ -54,12 +54,6 @@ export default createGlobalStyle<Props>`
|
||||
}
|
||||
}
|
||||
|
||||
.ui--highlight--spinner {
|
||||
&:after {
|
||||
border-color: ${getHighlight} transparent transparent !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ui--highlight--stroke {
|
||||
stroke: ${getHighlight} !important;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user