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) { public logQuestions(answers: string[], isKQ: boolean = false) {
const uid = store.getState().uid; const uid = store.getState().uid;
this.database try {
.ref(uid) this.database
.child(`${isKQ ? 'knowledge' : 'general'}Questions`) .ref(uid)
.set(answers); .child(`${isKQ ? 'knowledge' : 'general'}Questions`)
.set(answers);
} catch (e) {}
} }
} }

View file

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

View file

@ -91,7 +91,7 @@ export class Intro {
this.showStep(); this.showStep();
} }
store.subscribe((state) => { store.subscribe((state, prevState) => {
this.currentStep = state.currentIntroStep; this.currentStep = state.currentIntroStep;
this.anonymous = state.participantAnonymous; this.anonymous = state.participantAnonymous;
@ -101,6 +101,12 @@ export class Intro {
this.nextButton.innerHTML = 'Confirm'; this.nextButton.innerHTML = 'Confirm';
} else if (state.currentIntroStep === 4) { } else if (state.currentIntroStep === 4) {
this.nextButton.innerHTML = 'Start already!'; 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) { } else if (state.currentIntroStep === 7) {
this.nextButton.style.display = 'none'; this.nextButton.style.display = 'none';
} else if (state.currentIntroStep === 0) { } else if (state.currentIntroStep === 0) {
@ -174,7 +180,6 @@ export class Intro {
if (currentStep === 6) { if (currentStep === 6) {
this.sendGeneralQuestionAnswers(); this.sendGeneralQuestionAnswers();
window.scrollTo(0);
} }
if (currentStep === 5) { if (currentStep === 5) {