|
1 | 1 | import { combineReducers, reduceReducers, Cmd, loop } from 'redux-loop'
|
2 | 2 | import { createSelector } from 'reselect'
|
3 | 3 | import { set as setToDb } from 'idb-keyval'
|
| 4 | +import { selectors as LanguageSelectors } from '../Languages' |
4 | 5 |
|
5 | 6 | import * as Content from './content'
|
6 | 7 | import * as Selected from './selected'
|
7 | 8 | import * as Ids from './ids'
|
8 | 9 | import { createAction, ActionsUnion } from '@martin_hotell/rex-tils'
|
9 | 10 | import { EXPANSIONS_DB_KEY } from './constants'
|
| 11 | +import { getContentWithLanguageFallback } from './content/selectors' |
10 | 12 |
|
11 | 13 | ///////////
|
12 | 14 | // STATE //
|
@@ -154,16 +156,31 @@ const getPromoIds = createSelector(
|
154 | 156 | )
|
155 | 157 |
|
156 | 158 | const getStandaloneExpansions = createSelector(
|
157 |
| - [Content.selectors.getContent, getStandaloneExpansionIds], |
158 |
| - (content, ids) => ids.map(id => content.ENG[id]) |
| 159 | + [ |
| 160 | + Content.selectors.getContent, |
| 161 | + getStandaloneExpansionIds, |
| 162 | + LanguageSelectors.getLanguagesByExpansion, |
| 163 | + ], |
| 164 | + (content, ids, languages) => |
| 165 | + ids.map(id => getContentWithLanguageFallback(languages, content, id)) |
159 | 166 | )
|
160 | 167 | const getMiniExpansions = createSelector(
|
161 |
| - [Content.selectors.getContent, getMiniExpansionIds], |
162 |
| - (content, ids) => ids.map(id => content.ENG[id]) |
| 168 | + [ |
| 169 | + Content.selectors.getContent, |
| 170 | + getMiniExpansionIds, |
| 171 | + LanguageSelectors.getLanguagesByExpansion, |
| 172 | + ], |
| 173 | + (content, ids, languages) => |
| 174 | + ids.map(id => getContentWithLanguageFallback(languages, content, id)) |
163 | 175 | )
|
164 | 176 | const getPromos = createSelector(
|
165 |
| - [Content.selectors.getContent, getPromoIds], |
166 |
| - (content, ids) => ids.map(id => content.ENG[id]) |
| 177 | + [ |
| 178 | + Content.selectors.getContent, |
| 179 | + getPromoIds, |
| 180 | + LanguageSelectors.getLanguagesByExpansion, |
| 181 | + ], |
| 182 | + (content, ids, languages) => |
| 183 | + ids.map(id => getContentWithLanguageFallback(languages, content, id)) |
167 | 184 | )
|
168 | 185 |
|
169 | 186 | export const selectors = {
|
|
0 commit comments