import { StoreState } from 'app/common/store/store.types'; import { createSelector } from 'reselect'; import { TceAggregation } from './earnings.types'; const vesselEarningsStateSlice = (state: StoreState) => state.earnings; export const selectBenchmarkMode = (state: StoreState) => vesselEarningsStateSlice(state)?.tce?.benchmarkMode; export const selectIsBenchmarkAvailable = createSelector( store => store.earnings.tce?.aggregations, (aggregations) => { return aggregations?.some(item => item.benchmark?.year || item.benchmark?.spot) ?? false; } ); export const selectIsBenchmarkModeChangeAvailable = createSelector( store => store.earnings.tce?.aggregations, (aggregations) => { return aggregations?.some(item => item.benchmark?.year && item.benchmark?.spot) ?? false; } );