-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,107 additions
and
3,493 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ROOT } from './common.js' | ||
|
||
import { transport } from '../transport.js' | ||
import { errors } from '../errors.js' | ||
|
||
import type { Prediction } from '../../types.js' | ||
|
||
const getForTuples = async ( | ||
agencyId?: string, | ||
tuples?: string[], | ||
signal?: AbortSignal | ||
) => { | ||
if (!agencyId || !tuples) { | ||
throw errors.create('GET', 400, 'Bad Request') | ||
} | ||
|
||
const preds = await transport.fetch<Prediction[]>( | ||
`${ROOT}/agencies/${agencyId}/tuples/${tuples.join(',')}/predictions`, | ||
{ signal } | ||
) | ||
|
||
return preds.map(pred => { | ||
delete pred._links | ||
|
||
return pred | ||
}) | ||
} | ||
|
||
export { getForTuples } |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { FC } from 'react' | ||
|
||
interface MinutesProps { | ||
affectedByLayover: boolean | ||
minutes: number | ||
} | ||
|
||
const Minutes: FC<MinutesProps> = ({ minutes, affectedByLayover }) => { | ||
return ( | ||
<time dateTime={`PT${minutes}M`}> | ||
{minutes} min{affectedByLayover && <sup>*</sup>} | ||
</time> | ||
) | ||
} | ||
|
||
export { Minutes } | ||
export type { MinutesProps } |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { FC } from 'react' | ||
|
||
interface TimeProps { | ||
epochTime: number | ||
affectedByLayover: boolean | ||
minutes: number | ||
} | ||
|
||
const Time: FC<TimeProps> = ({ epochTime, affectedByLayover }) => { | ||
const date = new Date(epochTime) | ||
const dateTime = date.toISOString() | ||
const time = date.toLocaleTimeString([], { timeStyle: 'short' }) | ||
|
||
return ( | ||
<time dateTime={dateTime}> | ||
{time} | ||
{affectedByLayover && <sup>*</sup>} | ||
</time> | ||
) | ||
} | ||
|
||
export { Time } | ||
export type { TimeProps } |
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
Oops, something went wrong.