Skip to content

Commit

Permalink
Event list support feature (#184)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip

* wip
  • Loading branch information
AdiMakkar authored Nov 24, 2023
1 parent afc9b19 commit 6c2ec61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MaterialButtonType } from 'src/app/shared/models/material-button-type';
import { Router } from '@angular/router';
import { CoreRoutes } from 'src/app/core/constants/routes.constants';
import { TooltipDirection } from 'src/app/shared/models/tooltip-direction';
import { EventCardView } from '../../models/eventcardview';

@Component({
selector: 'app-event-card',
Expand All @@ -15,7 +16,7 @@ import { TooltipDirection } from 'src/app/shared/models/tooltip-direction';
export class EventCardComponent {
@Input() model?: Event;
@Input() loading: boolean = false;
@Input() view: string = 'small';
@Input() view: string | EventCardView = EventCardView.Small;
@Output() confirm = new EventEmitter();
@Output() decline = new EventEmitter();

Expand All @@ -32,7 +33,7 @@ export class EventCardComponent {

this.model.confirmed = !this.model.confirmed;

if (this.model.confirmed && this.model.declined)
if (this.model.confirmed && this.model.declined)
this.model.declined = false;

if (this.model.confirmed)
Expand All @@ -45,7 +46,7 @@ export class EventCardComponent {

this.model.declined = !this.model.declined;

if (this.model.declined && this.model.confirmed)
if (this.model.declined && this.model.confirmed)
this.model.confirmed = false;

if (this.model.declined)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<div class="event-list-container">
<div *ngFor="let event of model" class="event-card-wrapper">
<app-event-card [model]="event"
[view]="view"
(confirm)="confirmEvent(event)"
(decline)="declineEvent(event)">
</app-event-card>
</div>

<div *ngIf="isLoading">
<div *ngFor="let num of loadingItems" class="event-card-wrapper">
<app-event-card [loading]="true"></app-event-card>
<app-event-card [loading]="true" [view]="view"></app-event-card>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { Event } from '../../models/event';
import { EventCardView } from '../../models/eventcardview';

@Component({
selector: 'app-event-list',
Expand All @@ -11,7 +12,7 @@ export class EventListComponent {
@Input() model?: Event[];
@Input() isLoading: boolean = false;
@Input() loadingCount: number = 3;

@Input() view: string | EventCardView = EventCardView.Small;
@Output() confirm = new EventEmitter();
@Output() decline = new EventEmitter();

Expand Down
5 changes: 5 additions & 0 deletions src/app/features/events/models/eventcardview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export enum EventCardView {
Large = 'large',
Small = 'small',
}

0 comments on commit 6c2ec61

Please sign in to comment.