From 7d8251f616de09e018ac301cf026dc77c8759212 Mon Sep 17 00:00:00 2001 From: Lorena Ponsico Date: Tue, 14 Nov 2023 13:08:37 +0100 Subject: [PATCH] Show or hide solution user box --- .../challenge-info/challenge-info.component.html | 2 +- .../challenge-info/challenge-info.component.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/modules/challenge/components/challenge-info/challenge-info.component.html b/src/app/modules/challenge/components/challenge-info/challenge-info.component.html index f5a9bec3..20ba40e5 100644 --- a/src/app/modules/challenge/components/challenge-info/challenge-info.component.html +++ b/src/app/modules/challenge/components/challenge-info/challenge-info.component.html @@ -25,7 +25,7 @@

{{'modules.challenge.info.notes' | translate }}

{{ notes }}

- + diff --git a/src/app/modules/challenge/components/challenge-info/challenge-info.component.ts b/src/app/modules/challenge/components/challenge-info/challenge-info.component.ts index 8e0f7768..4662d9c5 100644 --- a/src/app/modules/challenge/components/challenge-info/challenge-info.component.ts +++ b/src/app/modules/challenge/components/challenge-info/challenge-info.component.ts @@ -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", @@ -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; @@ -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)