-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from nervosnetwork/rc/v0.1.0-alpha.9
[ᚬmaster] Release v0.1.0 alpha.9
- Loading branch information
Showing
29 changed files
with
231 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, { Component } from 'react' | ||
import { appCalls } from 'services/UILayer' | ||
import { Stack, Spinner } from 'office-ui-fabric-react' | ||
|
||
const handleError = (error: Error) => { | ||
appCalls.handleViewError(error.toString()) | ||
setTimeout(() => { | ||
window.location.reload() | ||
}, 0) | ||
return { hasError: true } | ||
} | ||
|
||
class ErrorBoundary extends Component<{ children: React.ReactChild }, { hasError: boolean }> { | ||
state = { | ||
hasError: false, | ||
} | ||
|
||
static getDerivedStateFromError(error: Error) { | ||
return handleError(error) | ||
} | ||
|
||
public componentDidCatch(error: Error) { | ||
this.setState(handleError(error)) | ||
} | ||
|
||
render() { | ||
const { hasError } = this.state | ||
const { children } = this.props | ||
return hasError ? ( | ||
<Stack verticalFill verticalAlign="center"> | ||
<Spinner /> | ||
</Stack> | ||
) : ( | ||
children | ||
) | ||
} | ||
} | ||
|
||
export default ErrorBoundary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { SyncStatus } from 'containers/Footer' | ||
|
||
const stories = storiesOf('SyncStatus', module) | ||
|
||
const states = { | ||
'0/0': { | ||
tipBlockNumber: '0', | ||
syncedBlockNumber: '0', | ||
bufferBlockNumber: 10, | ||
}, | ||
'0/100': { | ||
tipBlockNumber: '0', | ||
syncedBlockNumber: '0', | ||
bufferBlockNumber: 10, | ||
}, | ||
'syncing 10/100': { | ||
tipBlockNumber: '100', | ||
syncedBlockNumber: '10', | ||
bufferBlockNumber: 10, | ||
}, | ||
'buffering 89/100': { | ||
tipBlockNumber: '100', | ||
syncedBlockNumber: '89', | ||
bufferBlockNumber: 10, | ||
}, | ||
'synced 90/100': { | ||
tipBlockNumber: '100', | ||
syncedBlockNumber: '90', | ||
bufferBlockNumber: 10, | ||
}, | ||
'synced 100/100': { | ||
tipBlockNumber: '100', | ||
syncedBlockNumber: '100', | ||
bufferBlockNumber: 10, | ||
}, | ||
} | ||
|
||
Object.entries(states).forEach(([title, props]) => { | ||
stories.add(title, () => <SyncStatus {...props} />) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.