Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3983bda

Browse files
committed
fix issue when continue history is unusable
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent99a6f70 commit3983bda

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎web-app/src/containers/Start/getProgress.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asTfrom'typings'
22
import*asTTfrom'typings/tutorial'
33

4-
constgetProgress=(levels:TT.Level[]=[],position:T.Position):number=>{
4+
constgetProgress=(levels:TT.Level[]=[],position:T.Position):number|null=>{
55
letprogress=0
66
letisLevelComplete=false
77
if(levels&&levels.length){
@@ -10,7 +10,9 @@ const getProgress = (levels: TT.Level[] = [], position: T.Position): number => {
1010
constcurrentLevel:TT.Level|undefined=levels.find(findLevel)
1111
letcurrentLevelIndex:number=levels.findIndex(findLevel)
1212
if(!currentLevel){
13-
thrownewError('Invalid level')
13+
// something went wrong, just return null
14+
console.error('Invalid level match between levels & position')
15+
returnnull
1416
}
1517
// check if the level is complete
1618
if(position.stepId&&currentLevel.steps&&currentLevel.steps.length){

‎web-app/src/containers/Start/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ interface Props {
9797
onContinue():void
9898
onNew():void
9999
tutorial:TT.Tutorial|null
100-
progress:number
100+
progress:number|null
101101
}
102102

103103
exportconstStartPage=(props:Props)=>(
@@ -118,12 +118,12 @@ export const StartPage = (props: Props) => (
118118
Start New Tutorial
119119
</Button>
120120
</div>
121-
{props.tutorial&&(
121+
{!!props.tutorial&&props.progress!==null&&(
122122
<divcss={styles.buttonContainer}>
123123
<buttononClick={props.onContinue}css={styles.buttonLarge}>
124124
Continue Tutorial
125125
<divcss={styles.continueTitle}>"{props.tutorial.summary.title}"</div>
126-
<Progressstyle={{marginLeft:'1rem'}}percent={props.progress}hasBordersize="large"/>
126+
<Progressstyle={{marginLeft:'1rem'}}percent={props.progress||0}hasBordersize="large"/>
127127
</button>
128128
</div>
129129
)}
@@ -142,7 +142,7 @@ interface ContainerProps {
142142
}
143143

144144
constStartPageContainer=({ context, send}:ContainerProps)=>{
145-
constprogress:number=getProgress(context?.tutorial?.levels,context.position)
145+
constprogress=getProgress(context?.tutorial?.levels,context.position)
146146
return(
147147
<StartPage
148148
onContinue={()=>send({type:'CONTINUE_TUTORIAL'})}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp