diff --git a/.eslintrc b/.eslintrc index 77a5731..3fc2057 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,8 @@ "ImportDeclaration": { "minProperties": 12, "multiline": true, "consistent": true }, "ExportDeclaration": { "minProperties": 12, "multiline": true, "consistent": true } }], - "react/jsx-props-no-spreading": [0] + "react/jsx-props-no-spreading": [0], + "quote-props": [0] }, "plugins": [ "react", diff --git a/build/api/getSeason.js b/build/api/getSeason.js index 4b023aa..5cc9dd5 100644 --- a/build/api/getSeason.js +++ b/build/api/getSeason.js @@ -10,18 +10,48 @@ const trackTypeToCatId = { dirt_road: 4, }; -const licenceGroupToMinlicenselevel = { - 5: 18, - 4: 12, - 3: 8, - 2: 4, - 1: 1, +const licenceGroupToMinlicenselevel: {[key: string]: number} = { + '5': 18, + '4': 12, + '3': 8, + '2': 4, + '1': 1, }; type carType = { id: number, sku: number }; -type trackType = { ids: number, pkgid: number }; +type trackType = { ids: Array, pkgid: number }; -export default async function getSeason(cars: Array, tracks: Array) { +type TrackInfo = { + raceweek: number, + config: string, + name: string, + pkgid: number, + start: string, + weekLength: number, + race_time_descriptors: string, + race_lap_limit: number | null, + race_time_limit: number | null, +}; + +type SeasonInfo = { + seriesid: number, + seriesname: string, + start: string, + end: string, + tracks: Array, + catid: number, + isOfficial: boolean, + licenceGroup: 1 | 2 | 3 | 4 | 5, + licenceGroupName: string, + minlicenselevel: number, + isFixedSetup: boolean, + carclasses: Array<{shortname: string}>, + cars: Array<{sku: number}>, + carByWeek: boolean, + seasonid: number, +}; + +export default async function getSeason(cars: Array, tracks: Array): Promise> { const carMap = cars.reduce((carry, car) => ({ ...carry, [car.id]: car, @@ -83,6 +113,7 @@ export default async function getSeason(cars: Array, tracks: Array ({ shortname: carClass.short_name })), cars: seriesCars.map(({ sku }) => ({ sku })), + carByWeek: false, seasonid: series.season_id, }; }); diff --git a/src/config.js b/src/config.js index d890850..493ffa1 100644 --- a/src/config.js +++ b/src/config.js @@ -1,8 +1,8 @@ import moment from 'moment'; -export const seasonStart = moment('2023-09-12T00:00:00+00:00').utc(); -export const seasonEnd = moment('2023-12-12T00:00:00+00:00').utc(); -export const weekSeasonStart = moment('2023-09-12T00:00:00+00:00').utc(); +export const seasonStart = moment('2023-12-12T00:00:00+00:00').utc(); +export const seasonEnd = moment('2024-03-13T00:00:00+00:00').utc(); +export const weekSeasonStart = moment('2024-03-12T00:00:00+00:00').utc(); export const firebaseConfig = { apiKey: 'AIzaSyAWNRqHLhhvhzKl0gkKybocd0nAk2eTlVg', diff --git a/src/data/changelog.js b/src/data/changelog.js index 77efb36..9aadf55 100644 --- a/src/data/changelog.js +++ b/src/data/changelog.js @@ -1,6 +1,11 @@ import moment from 'moment'; export default [{ + date: moment('2023-12-12 00:00:00').utc(), + items: [ + 'Update to 2024S1', + ], +}, { date: moment('2023-12-05 00:00:00').utc(), items: [ 'Update to 2023S4W13', diff --git a/src/data/offWeeks.js b/src/data/offWeeks.js index 2b17d79..21c5a52 100644 --- a/src/data/offWeeks.js +++ b/src/data/offWeeks.js @@ -46,17 +46,17 @@ export default { // ], // }, // 207 │ 4114 │ NASCAR iRacing Series - Fixed | 2023-11-07 - 4114: { - offWeeks: [ - 13.1, 16.1, - ], - }, + // 4114: { + // offWeeks: [ + // 13.1, 16.1, + // ], + // }, // 229 │ 4113 │ NASCAR iRacing Series - Open | 2023-11-07 - 4113: { - offWeeks: [ - 13.1, 16.1, - ], - }, + // 4113: { + // offWeeks: [ + // 13.1, 16.1, + // ], + // }, // 438 │ 4118 │ eNASCAR Road to Pro Qual Series - Round 1 // 4118: { // offWeeks: [ @@ -71,30 +71,30 @@ export default { ], }, // 451 │ 4227 │ Creventic Endurance Series | 2023-12-05 - 4227: { - offWeeks: [ - 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 3.1, - 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, - ], - }, + // 4227: { + // offWeeks: [ + // 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 3.1, + // 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, + // ], + // }, // 495 │ 4222 │ Formula A - Grand Prix Tour | 2023-11-28 - 4222: { - offWeeks: [ - 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1, - ], - }, + // 4222: { + // offWeeks: [ + // 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1, + // ], + // }, // 496 │ 4223 │ Formula A - Grand Prix Tour - Fixed | 2023-11-28 - 4223: { - offWeeks: [ - 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1, - ], - }, + // 4223: { + // offWeeks: [ + // 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1, + // ], + // }, // 275 │ 4251 │ Nurburgring Endurance Championship | 2023-10-31 - 4251: { - offWeeks: [ - 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 4.1, 4.1, 5.1, 5.1, 6.1, 6.1, 7.1, 7.1, 7.1, 7.1, 8.1, 8.1, 8.1, - ], - }, + // 4251: { + // offWeeks: [ + // 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 4.1, 4.1, 5.1, 5.1, 6.1, 6.1, 7.1, 7.1, 7.1, 7.1, 8.1, 8.1, 8.1, + // ], + // }, // 469 │ 4315 | Global Endurance Pure Driving School Series | 2023-09-05 // 4315: { @@ -104,41 +104,61 @@ export default { // ], // }, // 439 │ 4384 │ eNASCAR Road to Pro Qual Series - Round 2 | 2023-10-03 - 4384: { - offWeeks: [ - 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, - ], - }, + // 4384: { + // offWeeks: [ + // 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, + // ], + // }, // 307 │ 4485 │ Dirt │ World of Outlaws Sprint Car Series | 2023-12-05 - 4485: { + // 4485: { // weekStartOffset: { days: -1 }, - }, + // }, // 492 │ 4427 │ Road │ IMSA Michelin Pilot Challenge Series | 2023-12-05 - 4427: { - weekStartOffset: { days: 7 }, + // 4427: { + // weekStartOffset: { days: 7 }, + // offWeeks: [ + // 1.1, 2.1, 3.1, 4.1, 5.1, + // ], + // }, + // 331 │ 4458 │ Road │ European Endurance Pure Driving School Series | 2023-12-05 + // 4458: { + // weekStartOffset: { days: 7 }, + // offWeeks: [ + // 1.1, 2.1, 3.1, 4.1, 5.1, + // ], + // }, + + // 419 │ 4459 │ Road │ IMSA Endurance Series | 2023-11-28 + // 4459: { + // offWeeks: [ + // 1.1, 2.1, 3.1, 4.1, 5.1, + // ], + // }, + // 478 │ 4538 │ Oval │ eNASCAR RTP Contender Series + 4538: { + weekStartOffset: { days: 6 }, offWeeks: [ - 1.1, 2.1, 3.1, 4.1, 5.1, + 6.1, ], }, - // 331 │ 4458 │ Road │ European Endurance Pure Driving School Series | 2023-12-05 - 4458: { + // 492 │ 4589 │ Road │ C │ IMSA Michelin Pilot Challenge Series | 2024-03-05 + 4589: { weekStartOffset: { days: 7 }, offWeeks: [ 1.1, 2.1, 3.1, 4.1, 5.1, ], }, - - // 419 │ 4459 │ Road │ IMSA Endurance Series | 2023-11-28 - 4459: { + // 331 │ 4622 │ Road │ B │ Global Endurance Pure Driving School Tour | 2024-03-05 + 4622: { + weekStartOffset: { days: 7 }, offWeeks: [ 1.1, 2.1, 3.1, 4.1, 5.1, ], }, - // 478 │ 4538 │ Oval │ eNASCAR RTP Contender Series - 4538: { - weekStartOffset: { days: 6 }, + // 419 │ 4623 │ Road │ B │ IMSA Endurance Series | 2024-03-05 + 4623: { offWeeks: [ - 6.1, + 1.1, 2.1, 3.1, 4.1, 5.1, ], }, };