Skip to content

Commit

Permalink
Update f1-standings extension (raycast#10959)
Browse files Browse the repository at this point in the history
* Update f1-standings extension

- Fixed crash on loading DriverStandings
- Initial commit

* Update f1-standings extension

- Fixed crash on loading DriverStandings
- Fixed crash on loading DriverStandings
  • Loading branch information
csigritz authored Feb 26, 2024
1 parent c1a9b96 commit ee6fcbb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions extensions/f1-standings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# Raycast specific files
raycast-env.d.ts
.raycast-swift-build
.swiftpm
compiled_raycast_swift

# misc
.DS_Store
4 changes: 4 additions & 0 deletions extensions/f1-standings/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# F1 Standings Changelog

## [🕦 Show Fastest Lap] - 2024-02-26

- Fixed an error when displaying DriverStats for not started seasons

## [🕦 Show Fastest Lap] - 2023-03-20

- If available the fastest lap is now shown in race results
Expand Down
2 changes: 1 addition & 1 deletion extensions/f1-standings/src/hooks/useDriverStandings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const useDriverStandings = (season: string | null): [DriverStanding[], boolean]
setState((previous) => ({
...previous,
isLoading: false,
driverStandings: data.MRData.StandingsTable.StandingsLists[0].DriverStandings,
driverStandings: data.MRData.StandingsTable.StandingsLists[0]?.DriverStandings ?? [],
}));
} catch (error) {
await showToast({
Expand Down
8 changes: 8 additions & 0 deletions extensions/f1-standings/src/views/DriverStandingsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function DriverList() {
setSelectedStanding(standings.find((standing) => standing.Driver.driverId === selectedId) || null);
}}
>
<EmptyView season={season} />
{season && (
<List.Section title={season}>
{standings.map((standing) => (
Expand Down Expand Up @@ -57,4 +58,11 @@ function DriverList() {
);
}

function EmptyView({ season }: { season: string | null }) {
if (!season) {
return null;
}
return <List.EmptyView icon="empty-view.png" description="No results" />;
}

export default DriverList;

0 comments on commit ee6fcbb

Please sign in to comment.