import { Feedback } from '@ulangi/ulangi-common/enums' ; import { NextReviewData , Vocabulary } from '@ulangi/ulangi-common/interfaces' ; import { ObservableReviewFeedbackBarState } from '@ulangi/ulangi-observable' ; import { ReviewFeedbackButtonDelegate } from './ReviewFeedbackButtonDelegate' ; import { ReviewFeedbackDataDelegate } from './ReviewFeedbackDataDelegate' ; export class ReviewFeedbackBarDelegate { private reviewFeedbackBarState : ObservableReviewFeedbackBarState ; private reviewFeedbackDataDelegate : ReviewFeedbackDataDelegate ; private reviewFeedbackButtonDelegate : ReviewFeedbackButtonDelegate ; public constructor ( reviewFeedbackBarState , reviewFeedbackDataDelegate , reviewFeedbackButtonDelegate ) { this . reviewFeedbackBarState = reviewFeedbackBarState ; this . reviewFeedbackDataDelegate = reviewFeedbackDataDelegate ; this . reviewFeedbackButtonDelegate = reviewFeedbackButtonDelegate ; } public calculateNextReviewData ( vocabulary , numberOfFeedbackButtons ) { this . reviewFeedbackBarState . nextReviewByFeedback . replace ( this . reviewFeedbackButtonDelegate . getButtonsToShow ( numberOfFeedbackButtons ) . map ( ( feedback ) : [ Feedback , NextReviewData ] => { return [ feedback as Feedback , this . reviewFeedbackDataDelegate . calculateNextReviewData ( vocabulary , feedback as Feedback , true , true ) , ] ; } ) ) ; console . log ( this . reviewFeedbackBarState . nextReviewByFeedback ) ; } }