|
1 | 1 | import*asReactfrom'react' |
2 | 2 | import{Button}from'@alifd/next' |
| 3 | +importCondfrom'../../components/Cond' |
| 4 | +importDataContextfrom'../../utils/DataContext' |
| 5 | +import{send}from'../../utils/vscode' |
3 | 6 |
|
4 | 7 | interfaceProps{ |
5 | 8 | onNew(tutorialId:string):void |
6 | 9 | } |
7 | 10 |
|
8 | | -constNewPage=(props:Props)=>{ |
| 11 | +exportconstNewPage=(props:Props)=>{ |
| 12 | +const{ state}=React.useContext(DataContext) |
9 | 13 | const[tutorialList,setTutorialList]=React.useState([{id:'1',title:'Demo',description:'A basic demo'}]) |
10 | 14 | // context |
11 | 15 | return( |
12 | 16 | <div> |
13 | | -<h2>Start a new Project</h2> |
14 | | -{tutorialList.map(tutorial=>( |
| 17 | +<Condstate={state}path="SelectTutorial.NewTutorial.SelectTutorial"> |
15 | 18 | <div> |
16 | | -<h3>{tutorial.title}</h3> |
17 | | -<p>{tutorial.description}</p> |
18 | | -<ButtononClick={()=>props.onNew(tutorial.id)}>Start</Button> |
| 19 | +<h2>Start a new Project</h2> |
| 20 | +{tutorialList.map(tutorial=>( |
| 21 | +<div> |
| 22 | +<h3>{tutorial.title}</h3> |
| 23 | +<p>{tutorial.description}</p> |
| 24 | +<ButtononClick={()=>props.onNew(tutorial.id)}>Start</Button> |
| 25 | +</div> |
| 26 | +))} |
19 | 27 | </div> |
20 | | -))} |
| 28 | +</Cond> |
| 29 | +<Condstate={state}path='SelectTutorial.NewTutorial.InitializeTutorial'> |
| 30 | +<div>Initializing tutorial...</div> |
| 31 | +</Cond> |
21 | 32 | </div> |
22 | 33 | ) |
23 | 34 | } |
24 | 35 |
|
25 | | -exportdefaultNewPage |
| 36 | +exportdefault()=><NewPageonNew={()=>send('TUTORIAL_START')}/> |