Skip to content

Commit

Permalink
Show or hide solution user box
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenaPonsico committed Nov 14, 2023
1 parent 757c276 commit 7d8251f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h3>{{'modules.challenge.info.notes' | translate }}</h3>
<p>{{ notes }}</p>
</div>
<!-- only if user logeed in -->
<app-solution *ngIf="isLogged" style="background-color: greenyellow;" [isUserSolution]="true" [languageExt]="'java'"></app-solution>
<app-solution *ngIf="isLogged && isUserSolution" style="background-color: greenyellow;" [isUserSolution]="true" [languageExt]="'java'"></app-solution>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DataChallenge } from "../../../../models/data-challenge.model";
import { Challenge } from "../../../../models/challenge.model";
import { NgbNav } from "@ng-bootstrap/ng-bootstrap";
import { AuthService } from "src/app/services/auth.service";
import { SolutionService } from "src/app/services/solution.service";

@Component({
selector: "app-challenge-info",
Expand All @@ -16,9 +17,13 @@ import { AuthService } from "src/app/services/auth.service";
providers: [ChallengeService],
})
export class ChallengeInfoComponent {

isUserSolution: boolean = true;

constructor(
private challengeService: ChallengeService,
private authService: AuthService
private authService: AuthService,
private solutionService: SolutionService
) {}
@ViewChild("nav") nav!: NgbNav;

Expand Down Expand Up @@ -54,10 +59,14 @@ export class ChallengeInfoComponent {
related_id = this.related;

ngOnInit() {
this.solutionService.solutionSent$.subscribe((value) => {
this.isUserSolution = !value;});
//this.isLogged = this.authService.isLoggedIn();
this.loadRelatedChallenge(this.related_id);

}


loadRelatedChallenge(id: string) {
this.challengeSubs$ = this.challengeService
.getChallengeById(id)
Expand Down

0 comments on commit 7d8251f

Please sign in to comment.