Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
lightning-bits
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
lightning-bits
Commits
ac743d17
Unverified
Commit
ac743d17
authored
Jul 03, 2018
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add waiting flag to notification for spinner
parent
b2be1673
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
info.js
src/action/info.js
+1
-1
notification.js
src/action/notification.js
+2
-1
notification.js
src/component/notification.js
+3
-1
notification.js
stories/component/notification.js
+15
-2
No files found.
src/action/info.js
View file @
ac743d17
...
...
@@ -15,7 +15,7 @@ class InfoAction {
this
.
_store
.
syncedToChain
=
response
.
synced_to_chain
;
this
.
_store
.
blockHeight
=
response
.
block_height
;
if
(
!
response
.
synced_to_chain
)
{
this
.
_notification
.
display
({
msg
:
'Syncing to chain
...'
});
this
.
_notification
.
display
({
msg
:
'Syncing to chain
'
,
wait
:
true
});
log
.
info
(
`Syncing to chain ... block height:
${
response
.
block_height
}
`
);
clearTimeout
(
this
.
t3
);
this
.
t3
=
setTimeout
(()
=>
this
.
getInfo
(),
RETRY_DELAY
);
...
...
src/action/notification.js
View file @
ac743d17
...
...
@@ -7,11 +7,12 @@ class NotificationAction {
this
.
_nav
=
nav
;
}
display
({
type
,
msg
,
err
,
handler
,
handlerLbl
})
{
display
({
type
,
msg
,
wait
,
err
,
handler
,
handlerLbl
})
{
if
(
err
)
log
.
error
(
msg
,
err
);
this
.
_store
.
notifications
.
push
({
type
:
type
||
(
err
?
'error'
:
'info'
),
message
:
msg
,
waiting
:
wait
,
date
:
new
Date
(),
handler
:
handler
||
(
err
?
()
=>
this
.
_nav
.
goCLI
()
:
null
),
handlerLbl
:
handlerLbl
||
(
err
?
'Show error logs'
:
null
),
...
...
src/component/notification.js
View file @
ac743d17
...
...
@@ -4,7 +4,8 @@ import PropTypes from 'prop-types';
import
{
SmallPillButton
}
from
'./button'
;
import
{
Text
,
H4Text
}
from
'./text'
;
import
Icon
from
'./icon'
;
import
{
color
,
font
}
from
'../component/style'
;
import
{
SmallSpinner
}
from
'./spinner'
;
import
{
color
,
font
}
from
'./style'
;
//
// NotificationBar
...
...
@@ -47,6 +48,7 @@ export const NotificationBar = ({ notification, display, style }) =>
onPress
=
{
notification
.
handler
}
/
>
)
:
null
}
{
notification
.
waiting
?
<
SmallSpinner
/>
:
null
}
<
/View
>
)
:
null
;
...
...
stories/component/notification.js
View file @
ac743d17
...
...
@@ -6,12 +6,19 @@ import NotificationAction from '../../src/action/notification';
import
{
Store
}
from
'../../src/store'
;
const
store
=
new
Store
();
store
.
init
();
export
const
notify
=
new
NotificationAction
(
store
);
storiesOf
(
'Notification'
,
module
)
.
add
(
'Notification Bar'
,
()
=>
(
.
add
(
'Notification Bar
(error)
'
,
()
=>
(
<
NotificationBar
notification
=
{
store
.
lastNotification
}
notification
=
{
store
.
notifications
[
0
]}
display
=
{
store
.
displayNotification
}
/
>
))
.
add
(
'Notification Bar (waiting)'
,
()
=>
(
<
NotificationBar
notification
=
{
store
.
notifications
[
1
]}
display
=
{
store
.
displayNotification
}
/
>
))
...
...
@@ -29,3 +36,9 @@ store.notifications.push({
handlerLbl
:
'Handle error'
,
display
:
true
,
});
store
.
notifications
.
push
({
type
:
'info'
,
message
:
'Syncing to chain'
,
waiting
:
true
,
display
:
true
,
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment