Fix scrolling for questions

This commit is contained in:
Dennis Schoepf 2021-08-08 00:57:56 +02:00
parent 3e3cec06f6
commit 1efd67c733
3 changed files with 14 additions and 7 deletions

View file

@ -79,10 +79,12 @@ export class Logger {
public logQuestions(answers: string[], isKQ: boolean = false) {
const uid = store.getState().uid;
try {
this.database
.ref(uid)
.child(`${isKQ ? 'knowledge' : 'general'}Questions`)
.set(answers);
} catch (e) {}
}
}

View file

@ -31,7 +31,7 @@ const store = create<State>((set) => ({
uid: null,
showScore: false,
showOvScore: true,
currentIntroStep: 1,
currentIntroStep: 5,
revealablesFinished: 0,
currentScene: Scenes.OVERVIEW,
currentSubproject: null,

View file

@ -91,7 +91,7 @@ export class Intro {
this.showStep();
}
store.subscribe((state) => {
store.subscribe((state, prevState) => {
this.currentStep = state.currentIntroStep;
this.anonymous = state.participantAnonymous;
@ -101,6 +101,12 @@ export class Intro {
this.nextButton.innerHTML = 'Confirm';
} else if (state.currentIntroStep === 4) {
this.nextButton.innerHTML = 'Start already!';
} else if (state.currentIntroStep === 6 && prevState.currentIntroStep === 5) {
console.log('hm');
setTimeout(() => {
document.querySelector('#intro-step6').scrollIntoView();
}, 50);
} else if (state.currentIntroStep === 7) {
this.nextButton.style.display = 'none';
} else if (state.currentIntroStep === 0) {
@ -174,7 +180,6 @@ export class Intro {
if (currentStep === 6) {
this.sendGeneralQuestionAnswers();
window.scrollTo(0);
}
if (currentStep === 5) {