Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

659 B
Raw Blame
import { pairwise, filter, map } from 'rxjs/operators';
import { Query } from '@datorama/akita';
import {
  IanBellState,
  IanBellStore,
} from 'core-app/features/in-app-notifications/bell/state/ian-bell.store';

export class IanBellQuery extends Query<IanBellState> {
  unread$ = this.select('totalUnread');

  unreadCountChanged$ = this.unread$.pipe(
    pairwise(),
    filter(([last, curr]) => curr !== last),
    map(([, curr]) => curr),
  );

  unreadCountIncreased$ = this.unread$.pipe(
    pairwise(),
    filter(([last, curr]) => curr > last),
    map(([, curr]) => curr),
  );

  constructor(protected store:IanBellStore) {
    super(store);
  }
}