refactor: status pill change ready to synced

This commit is contained in:
André Neves 2019-02-04 22:45:50 -05:00
parent c3b8bbfb7c
commit b99db4e7cf
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@ describe('<StatusPill />', () => {
test('should render status pill correctly', () => {
const { queryByTestId } = render(
<ThemeProvider theme={appTheme}>
<StatusPill progress={83.} type='syncing' />
<StatusPill progress={83.0} type='syncing' />
</ThemeProvider>,
);
@ -24,7 +24,7 @@ describe('<StatusPill />', () => {
test('should show percentage on status pill syncing', () => {
const { container } = render(
<ThemeProvider theme={appTheme}>
<StatusPill progress={56.} type='syncing' />
<StatusPill progress={56.0} type='syncing' />
</ThemeProvider>,
);
@ -34,7 +34,7 @@ describe('<StatusPill />', () => {
test('should hide percentage on status pill', () => {
const { container } = render(
<ThemeProvider theme={appTheme}>
<StatusPill progress={100.} type='ready' />
<StatusPill progress={100.0} type='ready' />
</ThemeProvider>,
);
@ -44,7 +44,7 @@ describe('<StatusPill />', () => {
test('should show error string and hide percentage on status pill', () => {
const { container } = render(
<ThemeProvider theme={appTheme}>
<StatusPill progress={0.} type='error' />
<StatusPill progress={0.0} type='error' />
</ThemeProvider>,
);

View File

@ -105,11 +105,12 @@ export class StatusPill extends Component<Props, State> {
type, icon, progress, isSyncing,
} = this.state;
const showPercent = isSyncing ? `(${progress.toFixed(2)}%)` : '';
const typeText = (type === 'ready') ? 'Synced' : type;
return (
<Wrapper id='status-pill'>
<Icon src={icon} animated={isSyncing} />
<StatusPillLabel value={`${type} ${showPercent}`} />
<StatusPillLabel value={`${typeText} ${showPercent}`} />
</Wrapper>
);
}