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

Commitaae3fa5

Browse files
committed
load page position progress
1 parent8e96307 commitaae3fa5

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

‎lib/modules/page/page-position/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ function pagePosition(pagePosition, action) {
55
switch(action.type){
66
casetypes_1.PAGE_SET:
77
returnaction.payload.pagePosition;
8+
case'PROGRESS_PAGE_POSITION':
9+
varpages=action.payload.progress.pages;
10+
varfirstFail=pages.indexOf(false);
11+
returnfirstFail<0 ?pages.length-1 :firstFail;
812
default:
913
returnpagePosition;
1014
}

‎lib/modules/progress/actions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ function progressLoad() {
55
returnfunction(dispatch,getState){
66
vartutorial=getState().tutorial;
77
dispatch({type:types_1.PROGRESS_LOAD,payload:{tutorial:tutorial}});
8+
dispatch(_progressPagePosition());
89
dispatch(actions_1.testRun());
910
};
1011
}
1112
exports.progressLoad=progressLoad;
13+
function_progressPagePosition(){
14+
returnfunction(dispatch,getState){
15+
varprogress=getState().progress;
16+
dispatch({type:types_1.PROGRESS_PAGE_POSITION,payload:{progress:progress}});
17+
};
18+
}
1219
functionprogressCompletePage(completed){
1320
if(completed===void0){completed=true;}
1421
returnfunction(dispatch,getState){

‎lib/modules/progress/types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use strict";
2-
exports.PROGRESS_LOAD='PROGRESS_LOAD';
32
exports.PROGRESS_COMPLETE_PAGE='PROGRESS_COMPLETE_PAGE';
43
exports.PROGRESS_COMPLETE_TUTORIAL='PROGRESS_COMPLETE_TUTORIAL';
4+
exports.PROGRESS_LOAD='PROGRESS_LOAD';
5+
exports.PROGRESS_PAGE_POSITION='PROGRESS_PAGE_POSITION';

‎src/modules/page/page-position/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export default function pagePosition(
88
casePAGE_SET:
99
returnaction.payload.pagePosition;
1010

11+
// allow access until before first incomplete tutorial
12+
case'PROGRESS_PAGE_POSITION':
13+
constpages=action.payload.progress.pages;
14+
constfirstFail=pages.indexOf(false);
15+
returnfirstFail<0 ?pages.length-1 :firstFail;
16+
1117
default:
1218
returnpagePosition;
1319
}

‎src/modules/progress/actions.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{
2-
PROGRESS_LOAD,PROGRESS_COMPLETE_PAGE,PROGRESS_COMPLETE_TUTORIAL
2+
PROGRESS_LOAD,PROGRESS_COMPLETE_PAGE,PROGRESS_PAGE_POSITION,PROGRESS_COMPLETE_TUTORIAL
33
}from'./types';
44
import{alertOpen,testRun}from'../../actions';
55

@@ -8,10 +8,18 @@ export function progressLoad(): ReduxThunk.ThunkInterface {
88
return(dispatch,getState)=>{
99
const{tutorial}=getState();
1010
dispatch({type:PROGRESS_LOAD,payload:{ tutorial}});
11+
dispatch(_progressPagePosition());
1112
dispatch(testRun());
1213
};
1314
}
1415

16+
function_progressPagePosition(){
17+
returnfunction(dispatch,getState){
18+
const{progress}=getState();
19+
dispatch({type:PROGRESS_PAGE_POSITION,payload:{ progress}});
20+
};
21+
}
22+
1523
exportfunctionprogressCompletePage(completed=true):ReduxThunk.ThunkInterface{
1624
return(dispatch,getState)=>{
1725
const{pagePosition, progress, tutorial}=getState();

‎src/modules/progress/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
exportconstPROGRESS_LOAD='PROGRESS_LOAD';
21
exportconstPROGRESS_COMPLETE_PAGE='PROGRESS_COMPLETE_PAGE';
32
exportconstPROGRESS_COMPLETE_TUTORIAL='PROGRESS_COMPLETE_TUTORIAL';
3+
exportconstPROGRESS_LOAD='PROGRESS_LOAD';
4+
exportconstPROGRESS_PAGE_POSITION='PROGRESS_PAGE_POSITION';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp