mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-08 21:15:09 +00:00
35 lines
1003 B
TypeScript
35 lines
1003 B
TypeScript
import { Component, inject } from '@angular/core'
|
|
import { toSignal } from '@angular/core/rxjs-interop'
|
|
import {
|
|
NgbDropdownModule,
|
|
NgbProgressbarModule,
|
|
} from '@ng-bootstrap/ng-bootstrap'
|
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
|
import { map } from 'rxjs'
|
|
import { Toast, ToastService } from 'src/app/services/toast.service'
|
|
import { ToastComponent } from '../../common/toast/toast.component'
|
|
|
|
@Component({
|
|
selector: 'pngx-toasts-dropdown',
|
|
templateUrl: './toasts-dropdown.component.html',
|
|
styleUrls: ['./toasts-dropdown.component.scss'],
|
|
imports: [
|
|
ToastComponent,
|
|
NgbDropdownModule,
|
|
NgbProgressbarModule,
|
|
NgxBootstrapIconsModule,
|
|
],
|
|
})
|
|
export class ToastsDropdownComponent {
|
|
toastService = inject(ToastService)
|
|
|
|
readonly toasts = toSignal(
|
|
this.toastService.getToasts().pipe(map((toasts) => [...toasts])),
|
|
{ initialValue: [] as Toast[] }
|
|
)
|
|
|
|
onOpenChange(open: boolean): void {
|
|
this.toastService.suppressPopupToasts = open
|
|
}
|
|
}
|