Skip to content

Commit

Permalink
make sure event coords are not NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
heybereket committed May 10, 2023
1 parent 731b248 commit 5008abf
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions components/screens/EventsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ const Event = (props: any) => {
<h2 className="text-lightGray absolute bottom-3 left-5 md:text-left text-left">
📌 {props.event.city}, {props.event.state_prov},{" "}
{props.event.country} <br />
{!props.invalidNavigation && (
<p className="text-sm">
<span className="text-gray-400 font-medium">
{String(
Math.trunc(props.eventDistances[props.event.event_code])
).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}
km
</span>{" "}
away
</p>
)}
{!props.invalidNavigation &&
!isNaN(props.eventDistances[props.event.event_code]) && (
<p className="text-sm">
<span className="text-gray-400 font-medium">
{String(
Math.trunc(props.eventDistances[props.event.event_code])
).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}
km
</span>{" "}
away
</p>
)}
</h2>
</div>
</a>
Expand Down Expand Up @@ -164,9 +165,8 @@ export const EventsScreen = (props: any) => {
event.name +
event.location_name +
event.city +
event.district?.abbreviation +
event.event_code +
event.week
event.country +
event.district?.abbreviation
)
.toLowerCase()
.includes(searchQuery.toLowerCase()),
Expand Down

1 comment on commit 5008abf

@vercel
Copy link

@vercel vercel bot commented on 5008abf May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

machine – ./

machine-git-main-6070.vercel.app
machine-6070.vercel.app
scoutmachine.vercel.app
machine.frc6070.ca

Please sign in to comment.