Skip to content

Commit 6095783

Browse files
authored
Merge pull request #574 from IT-Academy-BCN/feature/221-edit-button-mentor
Feature/221 edit button mentor
2 parents ad32945 + d7834d3 commit 6095783

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/app/modules/challenge/components/challenge-header/challenge-header.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ <h3 class="ms-2">{{title | dynamicTranslate}}</h3>
5555
<ng-container *ngIf="!solutionSent; else solutionSentMessage">
5656
<button *ngIf="!challengeStarted" class="btn btn-sm btn-primary" (click)="onStartChallenge()"> {{'modules.challenge.header.buttonStart' | translate }}</button>
5757
<button *ngIf="challengeStarted" class="btn btn-sm btn-primary" (click)="saveChallenge()">{{'modules.challenge.header.buttonSaveChallenge' | translate }}</button>
58-
<button *ngIf="challengeStarted" class="btn btn-sm btn-primary" (click)="openSendSolutionModal()"> {{'modules.challenge.header.buttonSendSolution' | translate }}</button>
58+
<button *ngIf="challengeStarted" class="btn btn-sm btn-primary" (click)="openSendSolutionModal()"> {{'modules.challenge.header.buttonSendSolution' | translate }}</button>
59+
<button *ngIf="userRole === 'ADMIN'" class="btn btn-sm btn-primary"> {{ 'modules.challenge.header.buttonEditChallenge' | translate }}</button>
5960
</ng-container>
6061

6162
<!-- Si ya se envió la solución -->
@@ -65,6 +66,7 @@ <h3 class="ms-2">{{title | dynamicTranslate}}</h3>
6566
<img src="assets/img/icon/tick-pink.svg" alt="tick icon">
6667
</div>
6768
</ng-template>
69+
6870
</div>
6971

7072
</div>

src/app/modules/challenge/components/challenge-header/challenge-header.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export class ChallengeHeaderComponent implements OnInit {
2525
private readonly solutionService = inject(SolutionService)
2626
private readonly authService = inject(AuthService);
2727
public userId: string | null = null;
28+
public userRole: string | null = null;
29+
2830
challengeTab = ChallengeTab;
2931

3032
@Input() title = ''
@@ -80,6 +82,11 @@ export class ChallengeHeaderComponent implements OnInit {
8082
}
8183
});
8284

85+
this.authService.getUserRole().subscribe(role => {
86+
this.userRole = role
87+
})
88+
89+
// Verifica si el reto ya ha comenzado
8390
if (this.challengeStarted) {
8491
this.activeId = ChallengeTab.SOLUTIONS
8592
}

src/assets/i18n/ca.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"buttonSaveChallenge": "Guardar",
3939
"buttonSendSolution": "Finalitzar",
4040
"buttonCancel": "Cancel.lar",
41+
"buttonEditChallenge": "Editar repte",
4142
"solutionSend": "Solució enviada",
4243
"login": "Iniciar sessió",
4344
"logout": "Tancar sessió"

src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"buttonSaveChallenge": "Save",
3939
"buttonSendSolution": "Finish",
4040
"buttonCancel": "Cancel",
41+
"buttonEditChallenge": "Edit challenge",
4142
"solutionSend": "Solution sent",
4243
"login": "Log In",
4344
"logout": "Log Out"

src/assets/i18n/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"buttonSaveChallenge": "Guardar",
3939
"buttonSendSolution": "Finalizar",
4040
"buttonCancel": "Cancelar",
41+
"buttonEditChallenge": "Editar reto",
4142
"solutionSend": "Solución enviada",
4243
"login": "Iniciar sesión",
4344
"logout": "Cerrar sesión"

0 commit comments

Comments
 (0)