-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: FRON-9 main filter dropdowns have a loader
- Loading branch information
1 parent
72eb543
commit ec9ebd3
Showing
19 changed files
with
312 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
import { atom } from 'jotai'; | ||
|
||
import { raceAtom } from './races'; | ||
import { seasonAtom } from './seasons'; | ||
|
||
// Drivers | ||
export const allDriversAtom = atom<DriverResult[]>([]); | ||
export const allDriversAtom = atom<DriverResult[] | null>(null); | ||
export const driverAtom = atom<DriverResult | 'All Drivers'>('All Drivers'); | ||
|
||
export const handleDriverChangeAtom = atom( | ||
null, | ||
async (get, set, driverName: string) => { | ||
const baseUrl = '/' + get(seasonAtom); | ||
|
||
const race = get(raceAtom); | ||
const raceLoc = race !== 'All Races' && race.Location.toLowerCase(); | ||
|
||
const drivers = get(allDriversAtom); | ||
const driver = drivers.find((driver) => driver.FullName === driverName); | ||
const driver = drivers?.find((driver) => driver.FullName === driverName); | ||
|
||
if (driver) { | ||
set(driverAtom, driver); | ||
return baseUrl + (raceLoc && `/${raceLoc}/${driver.DriverId}`); | ||
} | ||
// return nagivation url | ||
set(driverAtom, 'All Drivers'); | ||
}, | ||
); |
Oops, something went wrong.