Commit 3fbd78ef authored by Juraj Fiala's avatar Juraj Fiala
Browse files

feat: Use list for missions

parent fdbae058
<div *ngIf="state === requestState.ERROR"> <div *ngIf="state === requestState.ERROR">
Error occured: {{ errorMessage }} Error occured: {{ errorMessage }}
</div> </div>
<div *ngIf="state === requestState.SUCCESS"> <div *ngIf="state === requestState.SUCCESS" class="main-container">
<table mat-table [dataSource]="missions" class="w-full"> <mat-action-list>
<ng-container matColumnDef="name"> <mat-list-item *ngFor="let mission of missions" [routerLink]="['/auth/mission/', mission.id]">
<th mat-header-cell *matHeaderCellDef>Name</th> <p matLine class="!text-xs !tracking-widest uppercase"> {{mission.country.name}} </p>
<td mat-cell *matCellDef="let mission"> <p matLine> {{mission.name}} </p>
{{ mission.name }} <mat-divider></mat-divider>
</td> </mat-list-item>
</ng-container> </mat-action-list>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <button mat-fab color="accent" class="!fixed right-8 bottom-20" aria-label="Example icon button with a delete icon">
<tr <mat-icon>add</mat-icon>
mat-row </button>
class="hover:bg-gray-200"
routerLink="../mission/{{ row.id }}"
*matRowDef="let row; columns: displayedColumns"
></tr>
</table>
</div> </div>
...@@ -6,11 +6,6 @@ import { environment } from '../../environments/environment'; ...@@ -6,11 +6,6 @@ import { environment } from '../../environments/environment';
import { RequestState } from '../request-state.enum'; import { RequestState } from '../request-state.enum';
import { Mission } from './mission.interface'; import { Mission } from './mission.interface';
interface MissionTableItem {
id: string;
name: string;
}
@Component({ @Component({
selector: 'mission-list', selector: 'mission-list',
templateUrl: 'mission-list.component.html', templateUrl: 'mission-list.component.html',
...@@ -19,7 +14,7 @@ export class MissionListComponent implements OnInit { ...@@ -19,7 +14,7 @@ export class MissionListComponent implements OnInit {
requestState = RequestState; requestState = RequestState;
state: RequestState = this.requestState.PENDING; state: RequestState = this.requestState.PENDING;
errorMessage = ''; errorMessage = '';
missions: MissionTableItem[] = []; missions: Mission[] = [];
displayedColumns: string[] = ['name']; displayedColumns: string[] = ['name'];
constructor(private httpClient: HttpClient, private router: Router) {} constructor(private httpClient: HttpClient, private router: Router) {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment