Mailspring/internal_packages/N1-Scheduler/lib/calendar/proposed-time-calendar-data-source.es6

18 lines
697 B
Text
Raw Normal View History

import Rx from 'rx-lite'
import {CalendarDataSource} from 'nylas-exports'
import ProposedTimeCalendarStore from '../proposed-time-calendar-store'
export default class ProposedTimeCalendarDataSource extends CalendarDataSource {
buildObservable({startTime, endTime}) {
const $events = super.buildObservable({startTime, endTime});
const $proposedTimes = Rx.Observable.fromStore(ProposedTimeCalendarStore)
.map((store) => store.timeBlocksAsEvents())
const $obs = Rx.Observable.combineLatest([$events, $proposedTimes])
.map(([calEvents, proposedTimes]) => {
return {events: calEvents.concat(proposedTimes)}
})
this.observable = $obs;
return $obs;
}
}