Skip to content

Commit

Permalink
fix: pass selected task to footer's user icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jakerenzella committed Jan 30, 2023
1 parent 5ef2f2c commit 28782b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/app/common/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mat-toolbar class="footer" style="min-height: 85px" fxLayout="row" fxLayoutAlign="center center">
<f-user-badge fxFlex fxFlexAlign="start start" [project]="selectedTask?.project"></f-user-badge>
<f-user-badge fxFlex fxFlexAlign="start start" [selectedTask]="selectedTask"></f-user-badge>

<span fxFlex fxFlexAlign="center center" class="center-buttons" fxLayoutAlign="center center">
<button
Expand Down
19 changes: 6 additions & 13 deletions src/app/common/user-badge/user-badge.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<div fxLayout="row" fxLayoutAlign="start start" *ngIf="project?.student !== null">
<div fxLayout="row" fxLayoutAlign="start start" *ngIf="selectedTask?.project?.student !== null">
<a (click)="goToStudent()" style="display: flex">
<user-icon size="40" [user]="project.student" style="margin-right: 8px"></user-icon>
<user-icon size="40" [user]="selectedTask.project.student" style="margin-right: 8px"></user-icon>
<div fxLayout="column" fxLayoutAlign="center start" style="line-height: 0.5em; font-family: 'Grotesk'">
<h4 style="margin-bottom: 1px" class="mat-h4">{{ project.student.firstName }} {{ project.student.lastName }}</h4>
<p class="mat-caption">{{ project.activeTasks()[0].definition.name }}</p>
<h4 style="margin-bottom: 1px" class="mat-h4">
{{ selectedTask.project.student.firstName }} {{ selectedTask.project.student.lastName }}
</h4>
<p class="mat-caption">{{ selectedTask.definition.name }}</p>
</div>
</a>
</div>
<!--
<mat-chip-list *ngIf="project" #chipList aria-label="user badge" (click)="goToStudent()">
<mat-chip fxLayout="row" style="padding-left: -0px">
<span>{{ project.student.name }}</span>
</mat-chip>
<mat-chip>
<span>{{ project.targetGradeAcronym }}</span>
</mat-chip>
</mat-chip-list> -->
9 changes: 4 additions & 5 deletions src/app/common/user-badge/user-badge.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { Component, Input } from '@angular/core';
import { UIRouter } from '@uirouter/angular';
import { Project, ProjectService } from 'src/app/api/models/doubtfire-model';
import { UserService } from 'src/app/api/services/user.service';
import { Task } from 'src/app/api/models/doubtfire-model';

@Component({
selector: 'f-user-badge',
templateUrl: './user-badge.component.html',
styleUrls: ['./user-badge.component.scss'],
})
export class UserBadgeComponent {
constructor(private userService: UserService, private router: UIRouter, private projectService: ProjectService) {}
@Input() project: Project;
constructor(private router: UIRouter) {}
@Input() selectedTask: Task;

goToStudent(): void {
this.router.stateService.go('projects/dashboard', {
projectId: this.project.id,
projectId: this.selectedTask.project.id,
tutor: true,
taskAbbr: '',
});
Expand Down

0 comments on commit 28782b1

Please sign in to comment.