File tree 3 files changed +63
-14
lines changed
3 files changed +63
-14
lines changed Original file line number Diff line number Diff line change
1
+ import * as React from 'react'
2
+ import { Dialog } from '@alifd/next'
3
+ import Button from '../../../components/Button'
4
+
5
+ interface Props {
6
+ onReset ( ) : void
7
+ }
8
+
9
+ const Reset = ( props : Props ) => {
10
+ const [ modalState , setModalState ] = React . useState < 'none' | 'confirm' | 'progress' > ( 'none' )
11
+
12
+ const onClose = ( ) => {
13
+ setModalState ( 'none' )
14
+ }
15
+
16
+ const onOk = ( ) => {
17
+ setModalState ( 'progress' )
18
+ props . onReset ( )
19
+ return setTimeout ( ( ) => {
20
+ setModalState ( 'none' )
21
+ } , 3000 )
22
+ }
23
+
24
+ return (
25
+ < >
26
+ < Button type = "secondary" onClick = { ( ) => setModalState ( 'confirm' ) } >
27
+ Reset
28
+ </ Button >
29
+ { /* TODO improve reset message */ }
30
+ < Dialog
31
+ title = "Reset"
32
+ visible = { modalState === 'confirm' }
33
+ onOk = { onOk }
34
+ onCancel = { onClose }
35
+ onClose = { onClose }
36
+ footerActions = { [ 'ok' , 'cancel' ] }
37
+ >
38
+ Are you sure?
39
+ </ Dialog >
40
+ < Dialog
41
+ title = "Resetting..."
42
+ visible = { modalState === 'progress' }
43
+ footer = { false }
44
+ onClose = { onClose }
45
+ closeable = { false }
46
+ >
47
+ Reverting progress to an earlier commit...
48
+ </ Dialog >
49
+ </ >
50
+ )
51
+ }
52
+
53
+ export default Reset
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import * as selectors from '../../services/selectors'
4
4
import SideMenu from './components/SideMenu'
5
5
import Level from './components/Level'
6
6
import Icon from '../../components/Icon'
7
- import SettingsPage from './containers/Settings'
7
+ // import SettingsPage from './containers/Settings'
8
8
import ReviewPage from './containers/Review'
9
9
import Button from '../../components/Button'
10
+ import Reset from './components/Reset'
10
11
import ProcessMessages from '../../components/ProcessMessages'
11
12
import TestMessage from '../../components/TestMessage'
12
13
import { Progress } from '@alifd/next'
@@ -100,6 +101,10 @@ const TutorialPage = (props: PageProps) => {
100
101
props . send ( { type : 'RUN_TEST' } )
101
102
}
102
103
104
+ const onReset = ( ) : void => {
105
+ // TODO
106
+ }
107
+
103
108
const [ menuVisible , setMenuVisible ] = React . useState ( false )
104
109
105
110
const [ page , setPage ] = React . useState < 'level' | 'settings' | 'review' > ( 'level' )
@@ -149,7 +154,9 @@ const TutorialPage = (props: PageProps) => {
149
154
) }
150
155
151
156
{ /* Center */ }
152
- < div />
157
+ < div >
158
+ < Reset onReset = { onReset } />
159
+ </ div >
153
160
154
161
{ /* Right */ }
155
162
< div >
Original file line number Diff line number Diff line change @@ -142,16 +142,5 @@ storiesOf('Review', module)
142
142
. addDecorator ( SideBarDecorator )
143
143
. addDecorator ( withKnobs )
144
144
. add ( 'Example' , ( ) => {
145
- const progress = {
146
- levels : {
147
- '1' : true ,
148
- } ,
149
- steps : {
150
- '1.1' : true ,
151
- '1.2' : true ,
152
- '1.3' : true ,
153
- '2.1' : true ,
154
- } ,
155
- }
156
- return < Review levels = { levels } progress = { progress } />
145
+ return < Review levels = { levels } />
157
146
} )
You can’t perform that action at this time.
0 commit comments