Skip to content

Commit 582415b

Browse files
committed
fix: resolve merge conflicts
2 parents 894009b + 27a6da6 commit 582415b

File tree

5 files changed

+113
-0
lines changed

5 files changed

+113
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<div style="width: 100%; min-height: 100vh; padding: 4rem 0">
2+
<div class="flex-column-center">
3+
<div style="width: 50%">
4+
<h6 style="font-size: 2rem; color: salmon" class="mb-4">We encountered an error.</h6>
5+
<div style="font-size: 1.5rem; line-height: normal" class="mb-4">
6+
While running the task, we ran into an error. In order to report this and help us fix it as fast as
7+
possible, please do the following:
8+
</div>
9+
<div class="steps-container">
10+
<div class="number-container text">1</div>
11+
<div class="content-container">
12+
<span class="my-3" style="font-size: 1.5rem; line-height: normal">
13+
The task information and error is displayed below. Please click the
14+
<span style="color: #3f51b5">Copy Error</span> button to copy it to your clipboard.
15+
</span>
16+
<div style="background-color: rgb(233, 233, 233); padding: 1rem; border-radius: 8px">
17+
<div style="text-align: start" class="mb-2">
18+
<button mat-flat-button [cdkCopyToClipboard]="copyableErrString" color="primary">
19+
<span>Copy Error</span>
20+
<mat-icon class="ml-3">content_copy</mat-icon>
21+
</button>
22+
</div>
23+
<div style="color: salmon; max-height: 200px; overflow-y: auto; white-space: pre-line">
24+
{{ copyableErrString }}
25+
</div>
26+
</div>
27+
</div>
28+
</div>
29+
<div class="steps-container">
30+
<div class="number-container text">2</div>
31+
<div class="content-container">
32+
<span class="my-2" style="font-size: 1.5rem; line-height: normal">
33+
Paste the error into an email and send it to
34+
<a href="mailto:[email protected]">sharplab.neuro&#64;mcgill.ca</a>
35+
</span>
36+
</div>
37+
</div>
38+
<div class="steps-container">
39+
<div class="number-container text">3</div>
40+
<div class="content-container">
41+
<span class="my-2" style="font-size: 1.5rem; line-height: normal"> Go back to the main menu.</span>
42+
<span style="font-size: 1.5rem; line-height: normal">
43+
Thank for your participation and your assistance!
44+
</span>
45+
<div class="mt-2">
46+
<button mat-flat-button color="primary" (click)="navigateToMain()">Back to main menu</button>
47+
</div>
48+
</div>
49+
</div>
50+
</div>
51+
</div>
52+
</div>

src/app/pages/participant/error-page/error-page.component.scss

Whitespace-only changes.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { Router } from '@angular/router';
3+
import { SessionStorageService } from '../../../services/sessionStorage.service';
4+
import { SnackbarService } from '../../../services/snackbar/snackbar.service';
5+
import { Role } from 'src/app/models/enums';
6+
import { UserStateService } from 'src/app/services/user-state-service';
7+
8+
export interface IErrorNavigationState {
9+
studyId?: number;
10+
taskIndex?: number;
11+
stackTrace?: string;
12+
userId?: string;
13+
}
14+
15+
@Component({
16+
selector: 'app-error-page',
17+
templateUrl: './error-page.component.html',
18+
styleUrls: ['./error-page.component.scss', '../final-page/final-page.component.scss'],
19+
})
20+
export class ErrorPageComponent implements OnInit {
21+
constructor(
22+
private _snackbar: SnackbarService,
23+
private _router: Router,
24+
private _sessionStorage: SessionStorageService,
25+
private _userStateService: UserStateService
26+
) {
27+
const params = this._router.getCurrentNavigation()?.extras?.state as IErrorNavigationState;
28+
this.copyableErrString = `User ID: ${params?.userId}\nStudy ID: ${params?.studyId}\nTask Index: ${params?.taskIndex}\n\n${params?.stackTrace}`;
29+
this.copyableErrString = this.copyableErrString.trim();
30+
}
31+
32+
copyableErrString: string = '';
33+
34+
ngOnInit(): void {}
35+
36+
navigateToMain() {
37+
if (this._userStateService.isCrowdsourcedUser) {
38+
if (this._userStateService.currentlyRunningStudyId) {
39+
this._router.navigateByUrl(
40+
`crowdsource-participant?studyid=${this._userStateService.currentlyRunningStudyId}`
41+
);
42+
} else {
43+
this._router.navigate([`crowdsource-participant`]);
44+
}
45+
} else if (this._userStateService.userIsAdmin) {
46+
this._router.navigate([`admin-dashboard`]);
47+
} else if (this._userStateService.userIsParticipant) {
48+
this._router.navigate([`participant-dashboard`]);
49+
} else if (this._userStateService.userIsGuest || this._userStateService.userIsOrgMember) {
50+
this._router.navigate([`organization-member-dashboard`]);
51+
} else {
52+
throw new Error('Unsupported user role!');
53+
}
54+
}
55+
}

src/app/pages/participant/participant.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import { FinalPageComponent } from './final-page/final-page.component';
1111
import { ConsentDialogComponent } from './participant-dashboard/participant-studies/consent-dialog/consent-dialog.component';
1212
import { TranslateModule } from '@ngx-translate/core';
1313
import { LanguageDialogComponent } from './participant-dashboard/language-dialog/language-dialog.component';
14+
import { ErrorPageComponent } from './error-page/error-page.component';
1415

1516
@NgModule({
1617
declarations: [
1718
ParticipantDashboardComponent,
1819
ParticipantStudiesComponent,
1920
FinalPageComponent,
21+
ErrorPageComponent,
2022
ConsentDialogComponent,
2123
LanguageDialogComponent,
2224
],

src/app/routing/app-routing.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ const routes: Routes = [
4141
path: 'playtask',
4242
component: TaskPlayerComponent,
4343
},
44+
{
45+
path: 'error',
46+
component: ErrorPageComponent,
47+
},
4448
{
4549
path: 'studies',
4650
children: [

0 commit comments

Comments
 (0)