import { selectVesselName } from 'app/modules/vesselDetails/root/store/vesselDetails.selectors'; import { createSelector } from 'reselect'; import { selectCurrentPeriodShortName, selectKeyFigures } from 'app/modules/bunkerAdjustment/store/bunkerAdjustment.selectors'; import { Figures } from 'app/shared/components/infoBox/infoBox'; interface Props { boxes: Figures[], hint?: string, header?: string, period?: string, vesselName?: string, } export const selectBunkerConsumptionFigures = createSelector( selectKeyFigures, selectVesselName, (boxes, vesselName): Props => ({ header: 'Bunker Consumption', boxes: [ { value: boxes?.consumptionActual, unit: 'mt', type: 'text', description: vesselName.toString().length ? vesselName : '-', }, { value: boxes?.consumptionDifference, unit: 'mt', type: 'text', description: 'Total difference from virtual pool vessel', }, ], })); export const selectBunkerPricesFigures = createSelector( selectKeyFigures, (boxes): Props => ({ header: 'Bunker Prices', hint: 'The prices used for calculating the Bunker Adjustment and Scrubber Bonus are based on actual purchase price and actual tons consumed for the voyages completed in that month at end of quarter. For future months, latest monthly price is used as estimate. Reconciliation is done on quarterly basis.', boxes: [ { value: boxes?.bunkerCompliant, unit: '/mt', type: 'money', description: 'Compliant', }, { value: boxes?.bunkerNonCompliant, unit: '/mt', type: 'money', description: 'Non-compliant', }, ], })); export const selectTotalBunkerAdjustmentFigures = createSelector( selectKeyFigures, selectCurrentPeriodShortName, (boxes, period): Props => ({ header: `Total Bunker adjustment / ${period}`, hint: 'The total bunker adjustment for the month including the prior period adjustments.', boxes: [ { value: boxes?.bunkerAdjustment, description: 'Bunker adjustment', type: 'money', }, { value: boxes?.scrubberBonus, description: 'Scrubber Bonus', type: 'money', }, ], }));