Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Fixes Bugs in the record ide #36

Merged
merged 2 commits into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/app/record-ide/components/record-ide.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class RecordIDEComponent implements OnInit {
currentPos: number
};
snakeActive: boolean = false;
firstVisit: boolean = true;
vertical: boolean = true;


Expand Down Expand Up @@ -102,16 +101,13 @@ export class RecordIDEComponent implements OnInit {
this.project$ = this.projectApolloService.getProjectById(projectId);
this.subscriptions$.push(this.project$.subscribe((project) => {
this.project = project;
if (this.firstVisit) {
this.runRecordIde();
this.firstVisit = false;
}
this.runRecordIde(true);
}));
return this.project$.pipe(first());
}

runRecordIde() {
if (this.code.indexOf("import easteregg") != -1) {
runRecordIde(firstVisit: boolean = false) {
if (!firstVisit && this.code.indexOf("import easteregg") != -1) {
this.snakeActive = true;
} else {
this.loading = true;
Expand Down Expand Up @@ -157,13 +153,13 @@ export class RecordIDEComponent implements OnInit {
nextRecord() {
this.clearIde();
this.router.navigate(["projects", this.project.id, "record-ide", this.session], { queryParams: { pos: Math.min(this.position + 1, this.sessionData.recordIds.length) } });
this.firstVisit = true;
setTimeout(() => this.runRecordIde(), 200);
}

prevRecord() {
this.clearIde();
this.router.navigate(["projects", this.project.id, "record-ide", this.session], { queryParams: { pos: Math.max(this.position - 1, 1) } });
this.firstVisit = true;
setTimeout(() => this.runRecordIde(), 200);
}

}
Expand Down