This repository has been archived by the owner on Jun 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(front-end): Implement a preview version of notifications
- Loading branch information
1 parent
994481b
commit b1c7a44
Showing
8 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Kaizen/ClientApp/src/app/shared/components/notifications/notifications.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<button mat-icon-button [matTooltip]="'Notificaciones'" [matMenuTriggerFor]="notificationsMenu"> | ||
<mat-icon [matBadge]="notifications.length" [matBadgeHidden]="notifications.length === 0">notifications</mat-icon> | ||
</button> | ||
<mat-menu #notificationsMenu="matMenu"> | ||
<div mat-menu-item class="notification-button" *ngFor="let notification of notifications"> | ||
<div class="icon-text-container"> | ||
<mat-icon>{{ notification.icon }}</mat-icon> | ||
<span> | ||
{{ notification.title }} | ||
<small> | ||
{{ notification.message }} | ||
</small> | ||
</span> | ||
</div> | ||
<div class="spacer"></div> | ||
<mat-icon [routerLink]="notification.url" *ngIf="notification.url; else notUrl">visibility</mat-icon> | ||
<ng-template #notUrl> | ||
<mat-icon [matTooltip]="'Eliminar notificación'">delete</mat-icon> | ||
</ng-template> | ||
</div> | ||
</mat-menu> |
34 changes: 34 additions & 0 deletions
34
Kaizen/ClientApp/src/app/shared/components/notifications/notifications.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.notification-button { | ||
max-width: 600px; | ||
max-height: 300px; | ||
min-height: 70px; | ||
height: auto; | ||
align-content: center !important; | ||
align-items: center !important; | ||
display: flex !important; | ||
line-height: 30px !important; | ||
white-space: normal; | ||
|
||
span { | ||
display: block; | ||
} | ||
small { | ||
display: block; | ||
color: rgba(0, 0, 0, 0.5); | ||
line-height: 20px; | ||
} | ||
} | ||
|
||
.mat-menu-panel { | ||
max-width: fit-content !important; | ||
max-height: 300px; | ||
} | ||
|
||
::ng-deep.notification-menu { | ||
width: fit-content; | ||
} | ||
|
||
::ng-deep.mat-menu-panel { | ||
max-width: none !important; | ||
max-height: 300px !important; | ||
} |
28 changes: 28 additions & 0 deletions
28
Kaizen/ClientApp/src/app/shared/components/notifications/notifications.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { AppModule } from '@app/app.module'; | ||
import { SharedModule } from '@shared/shared.module'; | ||
import { NotificationsComponent } from './notifications.component'; | ||
|
||
describe('NotificationsComponent', () => { | ||
let component: NotificationsComponent; | ||
let fixture: ComponentFixture<NotificationsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ HttpClientTestingModule, RouterTestingModule, SharedModule, AppModule ], | ||
declarations: [ NotificationsComponent ] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(NotificationsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
Kaizen/ClientApp/src/app/shared/components/notifications/notifications.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { NewClientSignalrService } from '@modules/clients/services/new-client-signalr.service'; | ||
import { NotificationItem } from '@shared/models/notification-item'; | ||
|
||
@Component({ | ||
selector: 'app-notifications', | ||
templateUrl: './notifications.component.html', | ||
styleUrls: [ './notifications.component.scss' ] | ||
}) | ||
export class NotificationsComponent implements OnInit, OnDestroy { | ||
notifications: NotificationItem[] = []; | ||
|
||
constructor(private clientSignalR: NewClientSignalrService) {} | ||
|
||
ngOnInit(): void {} | ||
|
||
ngOnDestroy(): void {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface NotificationItem { | ||
icon: string; | ||
title: string; | ||
message: string; | ||
url?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters