Skip to content

Commit

Permalink
refactor: value -> alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
d-koppenhagen committed Jan 4, 2024
1 parent d036313 commit 41a6576
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/app/alert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,26 @@ export class AlertService {
constructor() {}

addAlert(alert: Alert) {
this.alerts.update((value) => [
...value,
this.alerts.update((alerts) => [
...alerts,
{ ...alert, active: true }
])
}

private activateOrDeactivateAlert(title: string, active: boolean) {
this.alerts.update((value) => [
...value.map(a => {
this.alerts.update(alerts =>
alerts.map(a => {
if (a.title === title) {
a.active = active
return { ...a, active };
} else {
return a;
}
return a
}),
])
})
)
}

removeAlert(title: string) {
this.alerts.update( (value) => value.filter(a => a.title !== title))
this.alerts.update( (alerts) => alerts.filter(alert => alert.title !== title))
}

activateAlert(title: string) {
Expand Down
3 changes: 2 additions & 1 deletion src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* You can add global styles to this file, and also import other style files */
@use '@angular/cdk';
@import '@angular/cdk/overlay-prebuilt.css';
@include cdk.a11y-visually-hidden();

@import '@angular/cdk/overlay-prebuilt.css';

:root {
--font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
Expand Down

0 comments on commit 41a6576

Please sign in to comment.