diff --git a/build/api/getSeason.js b/build/api/getSeason.js index 2cd3959..85f6b31 100644 --- a/build/api/getSeason.js +++ b/build/api/getSeason.js @@ -8,6 +8,8 @@ const trackTypeToCatId = { road: 2, dirt_oval: 3, dirt_road: 4, + sports_car: 5, + formula_car: 6, }; const licenceGroupToMinlicenselevel: {[key: string]: number} = { diff --git a/src/__tests__/__snapshots__/App.test.js.snap b/src/__tests__/__snapshots__/App.test.js.snap index 9e6f8e5..f821de1 100644 --- a/src/__tests__/__snapshots__/App.test.js.snap +++ b/src/__tests__/__snapshots__/App.test.js.snap @@ -336,16 +336,32 @@ exports[`components/App renders correctly 1`] = ` className="checkbox" > + +
+
- {t('Road')} + {t('Sports Car')} + + + {t('Formula Car')} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+

- Road + Oval

+ +

+ Road +

+
@@ -106,16 +113,16 @@ exports[`components/modal/FavouriteSeriesModal renders with checkbox saving 1`] className="checkbox" >
diff --git a/src/data/__mocks__/season.json b/src/data/__mocks__/season.json index a7485ff..004128c 100644 --- a/src/data/__mocks__/season.json +++ b/src/data/__mocks__/season.json @@ -371,7 +371,7 @@ "race_time_limit": null } ], - "catid": 2, + "catid": 5, "isOfficial": true, "licnceGroup": 3, "licnceGroupName": "Class C", @@ -557,7 +557,7 @@ "race_time_limit": null } ], - "catid": 2, + "catid": 1, "isOfficial": false, "licnceGroup": 1, "licnceGroupName": "Rookie", diff --git a/src/data/changelog.js b/src/data/changelog.js index e0b6520..9e1dd11 100644 --- a/src/data/changelog.js +++ b/src/data/changelog.js @@ -1,6 +1,11 @@ import moment from 'moment'; export default [{ + date: moment('2024-03-06 00:00:00').utc(), + items: [ + 'Update with new categories', + ], +}, { date: moment('2024-03-05 00:00:00').utc(), items: [ 'Update to 2024S1W13', diff --git a/src/lib/races.js b/src/lib/races.js index 6858984..aee771b 100644 --- a/src/lib/races.js +++ b/src/lib/races.js @@ -101,6 +101,8 @@ categoryMap.set(1, 'Oval'); categoryMap.set(2, 'Road'); categoryMap.set(3, 'Dirt'); categoryMap.set(4, 'RX'); +categoryMap.set(5, 'Sports Car'); +categoryMap.set(6, 'Formula Car'); const getType = (catId: number): ?string => categoryMap.get(catId); diff --git a/src/reducers/__tests__/settings.test.js b/src/reducers/__tests__/settings.test.js index 1225548..8379673 100644 --- a/src/reducers/__tests__/settings.test.js +++ b/src/reducers/__tests__/settings.test.js @@ -18,13 +18,6 @@ describe('reducers/settings', () => { expect(state.ownedTracks.length).toBe(22); }); - test('set up legacy state', () => { - window.localStorage.setItem('iracing-state', JSON.stringify({ sort: { key: 'class', order: 'desc' } })); - const state = settingsReducer(undefined, {}); - expect(state.sort).toEqual({ key: 'class', order: 'desc' }); - expect(window.localStorage.getItem('iracing-state')).toEqual(null); - }); - test('localStorageActionTypes.INIT', async () => { const state = settingsReducer( undefined, @@ -34,12 +27,17 @@ describe('reducers/settings', () => { settings: { ownedCars: [5], ownedTracks: [34, 165], + filters: { + type: ['Road', 'Oval'], + } }, }, }, ); expect(state.ownedCars.length).toBe(17); expect(state.ownedTracks.length).toBe(23); + expect(state.filters.type).toInclude('Sports Car'); + expect(state.filters.type.length).toBe(3); const stateNoPayload = settingsReducer( undefined, { @@ -69,7 +67,7 @@ describe('reducers/settings', () => { type: RESET_FILTERS, }, ); - expect(state.filters.type).toEqual(['Road', 'Oval', 'Dirt', 'RX']); + expect(state.filters.type).toEqual(['Sports Car', 'Formula Car', 'Oval', 'Dirt', 'RX']); expect(state.firebaseSynced).toBe(false); }); diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 4450b88..f574986 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -33,7 +33,7 @@ export type FilterOptions = { }; export const defaultFilters: FilterOptions = { - type: ['Road', 'Oval', 'Dirt', 'RX'], + type: ['Sports Car', 'Formula Car', 'Oval', 'Dirt', 'RX'], licence: ['R', 'D', 'C', 'B', 'A', 'P'], official: [false, true], fixed: [false, true], @@ -68,18 +68,10 @@ export const defaultSettings: SettingOptions = { firebaseSynced: false, }; -const LEGACY_STORAGE_KEY = 'iracing-state'; - export default function settings(initState: SettingOptions, { type, payload }): SettingOptions { let state = initState; if (initState === undefined) { - const legacyStored = window.localStorage.getItem(LEGACY_STORAGE_KEY); - - if (legacyStored) { - window.localStorage.removeItem(LEGACY_STORAGE_KEY); - } - - state = legacyStored ? JSON.parse(legacyStored) : defaultSettings; + state = defaultSettings; } if (type === localStorageActionTypes.INIT) { @@ -98,6 +90,13 @@ export default function settings(initState: SettingOptions, { type, payload }): ...persistedStateSettings.ownedTracks, ...defaultSettings.ownedTracks, ]); + + const hasRoadFilter = payload.settings.filters.type.includes('Road'); + + if (hasRoadFilter) { + persistedStateSettings.filters.type = [...persistedStateSettings.filters.type, 'Sports Car', 'Formula Car']; + persistedStateSettings.filters.type = persistedStateSettings.filters.type.filter((t) => t !== 'Road'); + } return { ...state, ...persistedStateSettings }; } diff --git a/translations/de.js b/translations/de.js index 76a3583..8a730e4 100644 --- a/translations/de.js +++ b/translations/de.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Road', + 'Sports Car': 'Sport Auto', + 'Formula Car': 'Formel Auto', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Lizenz', 'Official/Fixed': 'Offiziell/Fixed', diff --git a/translations/es.js b/translations/es.js index 709940e..7a12b17 100644 --- a/translations/es.js +++ b/translations/es.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Road', + 'Sports Car': 'Automóvil de deportivo', + 'Formula Car': 'Automóvil de Fórmula', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Licencia', 'Official/Fixed': 'Oficiales/Fijas', diff --git a/translations/fake.js b/translations/fake.js deleted file mode 100644 index 76037c8..0000000 --- a/translations/fake.js +++ /dev/null @@ -1,114 +0,0 @@ -export default { - translation: { - 'iRacing Week Planner': 'abc', - 'Purchase guide': 'abc', - 'Set my tracks': 'abc', - 'Set my cars': 'abc', - 'Set favorite series': 'abc', - 'Options': 'abc', - 'About': 'abc', - 'Week {{week}}': 'abc', - 'Races for date: {{date, YYYY MMM DD}}': 'abc', - 'No time data': 'abc', - - // Filters - 'Filters': 'abc', - 'Type': 'abc', - 'Oval': 'abc', - 'Dirt': 'abc', - 'Road': 'abc', - 'RX': 'abc', // Rally Cross/Road Dirt - 'Licence': 'abc', - 'Official/Fixed': 'abc', - 'Unofficial': 'abc', - 'Official': 'abc', - 'Open setup': 'abc', - 'Fixed setup': 'abc', - 'Content': 'abc', - 'Owned cars only': 'abc', - 'Owned tracks only': 'abc', - 'Favorite series only': 'abc', - 'Favorite cars only': 'abc', - 'Favorite tracks only': 'abc', - 'Reset filters': 'abc', - 'Reset all settings': 'abc', - - // Column Headers - 'Columns': 'abc', - 'ID': 'abc', - 'Class': 'abc', - 'Series': 'abc', - 'Track': 'abc', - 'Car': 'abc', - 'Start': 'abc', - 'End': 'abc', - 'Fixed': 'abc', - 'Race times': 'abc', - 'Next race': 'abc', - 'Season end': 'abc', - 'Link': 'abc', - 'Week': 'abc', - 'Count': 'abc', - 'Length': 'abc', - - // Race length - 'No data': 'abc', - '{{laps}}L': 'abc', - '{{minutes}}m': 'abc', - '{{hours}}h': 'abc', - - // Modals - 'Use the checkbox to set the content you own, and use the star to set your favourite content.': - 'abc', - 'Select all': 'abc', - 'Select all oval': 'abc', - 'Select all road': 'abc', - 'Choose favorite series': 'abc', - 'Close': 'abc', - 'Contributors': 'abc', - 'Changelog': 'abc', - 'Purchase Guide': 'abc', - 'This tool was created by <2>tmoitie (<5>Tom Moitié on iRacing). Feel free to contact me via twitter or iRacing if you have any feedback or questions. The code is hosted publicly on <9>Github. Thanks!': - 'abc', - 'Loading': 'abc', - 'Cars for {{series}}': 'abc', - 'Tracks for {{series}}': 'abc', - 'These unowned tracks from your favorite series appear multiple times for this season. You can purchase these tracks with the direct link.': 'abc', - - // Dates - '{{date, YYYY MMMM DD}}': 'abc', - '{{date, YYYY-MM-DD}}': 'abc', - 'Every {{every}} starting at {{time, H:mm}} UTC': 'abc', - '{{timeLocal, ddd h:mma}} ({{timeUtc, ddd h:mma z}})': 'abc', - 'Set times': 'abc', - '{{date, ddd k:mm}}': 'abc', - - //New Auth strings - 'This is now costing me a few quid a month to run, so if you like using this tool, please feel free to <2>buy me a coffee.': - 'abc', - 'Buy me a coffee': 'abc', - 'Synced': 'abc', - 'Awaiting sync': 'abc', - '(refresh browser to download latest)': 'abc', - 'Reset Password': 'abc', - 'Enter your email address to reset your password.': 'abc', - 'Email address': 'abc', - 'Submit': 'abc', - 'Thanks, please check your email for further details.': 'abc', - 'Sign in/Create account': 'abc', - 'Signing in will sync your settings across multiple browsers or devices.': 'abc', - 'When you first sign in it will use your current settings to set up the account, but once an account is set-up logging in will overwrite any settings you stored as a guest.': - 'abc', - 'Password': 'abc', - 'Forgotten password?': 'abc', - 'Sign in': 'abc', - 'Sign out': 'abc', - 'Create account': 'abc', - 'There is no user record corresponding to this identifier. The user may have been deleted.': 'abc', - 'The password is invalid or the user does not have a password.': 'abc', - 'The email address is badly formatted.': 'abc', - 'The password must be 6 characters long or more.': 'abc', - 'The email address is already in use by another account.': 'abc', - 'Password should be at least 6 characters': 'abc', - }, -}; diff --git a/translations/fr.js b/translations/fr.js index 8f9c7a2..1f83b4d 100644 --- a/translations/fr.js +++ b/translations/fr.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Route', + 'Sports Car': 'Voiture sportive', + 'Formula Car': 'Voiture de Formule', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Licence', 'Official/Fixed': 'Officielle/Configuration fixe', diff --git a/translations/it.js b/translations/it.js index 7f07294..b26cec6 100644 --- a/translations/it.js +++ b/translations/it.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Ovale', 'Dirt': 'Sterrato', 'Road': 'Circuito', + 'Sports Car': 'Auto sportiva', + 'Formula Car': 'Formula auto', 'RX': 'RX', // Rally Cross/Circuito Sterrato 'Licence': 'Licenza', 'Official/Fixed': 'Ufficiale/Fisso', diff --git a/translations/jp.js b/translations/jp.js index 170e2ac..b329dc5 100644 --- a/translations/jp.js +++ b/translations/jp.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval (オーバル)', 'Dirt': 'Dirt (ダート)', 'Road': 'Road (ロード)', + 'Sports Car': 'Sports Car (スポーツカー)', + 'Formula Car': 'Formula Car (フォーミュラカー)', 'RX': 'RX (ラリークロス)', // Rally Cross/Road Dirt 'Licence': 'ライセンス', 'Official/Fixed': '公式/一定', diff --git a/translations/nl.js b/translations/nl.js index 1176d27..9d92aaa 100644 --- a/translations/nl.js +++ b/translations/nl.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Weg', + 'Sports Car': 'Sports Auto', + 'Formula Car': 'Formule Auto', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Licentie', 'Official/Fixed': 'Officieel/Setup', diff --git a/translations/pl.js b/translations/pl.js index 89a26f9..fd8e6a8 100644 --- a/translations/pl.js +++ b/translations/pl.js @@ -17,6 +17,8 @@ export default { Oval: 'Owale', Dirt: 'Szutry', Road: 'Torowe', + 'Sports Car': 'Samochód sportowy', + 'Formula Car': 'Samochód Formuły', RX: 'RX', // Rally Cross/Road Dirt Licence: 'Licencja', 'Official/Fixed': 'Oficialne/Zamknięty setup', diff --git a/translations/pt-BR.js b/translations/pt-BR.js index 30c2da2..abf976c 100644 --- a/translations/pt-BR.js +++ b/translations/pt-BR.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Road', + 'Sports Car': 'Carro esportivo', + 'Formula Car': 'Fórmula Car', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Licença', 'Official/Fixed': 'Oficial/Fixo', diff --git a/translations/tr.js b/translations/tr.js index 62ebaf0..933ceef 100644 --- a/translations/tr.js +++ b/translations/tr.js @@ -17,6 +17,8 @@ export default { 'Oval': 'Oval', 'Dirt': 'Dirt', 'Road': 'Road', + 'Sports Car': 'Spor Araba', + 'Formula Car': 'Formula Arabası', 'RX': 'RX', // Rally Cross/Road Dirt 'Licence': 'Lisans', 'Official/Fixed': 'Resmi/Sabit',