Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BART departures #17970

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add BART departures #17970

wants to merge 2 commits into from

Conversation

quacksire
Copy link

@quacksire quacksire commented Mar 19, 2025

Description

This Raycast extension provides real-time BART (Bay Area Rapid Transit) departure schedules and service alerts, allowing users to view upcoming train departures by station and stay informed about delays or disruptions.

Screencast

2025-03-19.00-49-25.mp4

Checklist

Greptile Summary

This PR adds a new BART (Bay Area Rapid Transit) extension that provides real-time departure schedules and service alerts for Bay Area stations, with station selection and detailed departure information.

  • Hardcoded API key Q58Q-PEEI-9DLT-DWEI in src/departures.tsx should be moved to preferences for better security and user customization
  • React version ^19.0.0 in package.json is invalid and should be downgraded as React 19 doesn't exist yet
  • Missing required metadata folder with screenshots for view commands as per Raycast Documentation
  • Command subtitle in package.json has typo: "depatures" should be "departures"
  • Installation instructions in README.md should be removed since users should only install through Raycast Store

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

@raycastbot raycastbot added the new extension Label for PRs with new extensions label Mar 19, 2025
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days

Once the PR is approved and merged, the extension will be available on our Store.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

"dependencies": {
"@raycast/api": "^1.93.2",
"@raycast/utils": "^1.19.1",
"react": "^19.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: React 19 does not exist yet. Should be ^18.0.0

Suggested change
"react": "^19.0.0"
"react": "^18.0.0"

"commands": [{
"name": "departures",
"title": "BART Departures",
"subtitle": "Show BART depatures from a given station",
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: 'depatures' is misspelled, should be 'departures'

Suggested change
"subtitle": "Show BART depatures from a given station",
"subtitle": "Show BART departures from a given station",

Comment on lines +23 to +25
1. Clone this repository or download the extension from the Raycast Store.
2. Run `npm install` to install dependencies.
3. Use `npm run dev` to start the extension in development mode or `npm run build` to build it for production.
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: These installation instructions are incorrect for end users. The extension should only be installed through the Raycast Store, not by cloning the repo. Remove the npm commands since they are only relevant for development.

Suggested change
1. Clone this repository or download the extension from the Raycast Store.
2. Run `npm install` to install dependencies.
3. Use `npm run dev` to start the extension in development mode or `npm run build` to build it for production.
1. Install the extension from the Raycast Store.

Comment on lines +334 to +339
const { isLoading: isDeparturesLoading, data: departuresData } = useFetch(
DEPARTURE_URL,
{
parseResponse: (res) => res.json() as Promise<DepartureResponse>,
},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Add error handling for API failures using try/catch with showFailureToast from @raycast/utils

Suggested change
const { isLoading: isDeparturesLoading, data: departuresData } = useFetch(
DEPARTURE_URL,
{
parseResponse: (res) => res.json() as Promise<DepartureResponse>,
},
);
const { isLoading: isDeparturesLoading, data: departuresData } = useFetch(
DEPARTURE_URL,
{
parseResponse: async (res) => {
if (!res.ok) {
throw new Error(`Failed to fetch departures: ${res.statusText}`);
}
return res.json() as Promise<DepartureResponse>;
},
onError: (error) => showFailureToast(error),
},
);

Comment on lines +351 to +353
alertData?.root?.bsa?.[0]?.description["#cdata-section"] !=
"No delays reported."
? alertData?.root?.bsa?.[0]?.description["#cdata-section"]
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Using != for string comparison instead of !==. This can cause type coercion issues

Suggested change
alertData?.root?.bsa?.[0]?.description["#cdata-section"] !=
"No delays reported."
? alertData?.root?.bsa?.[0]?.description["#cdata-section"]
alertData?.root?.bsa?.[0]?.description["#cdata-section"] !==
"No delays reported."
? alertData?.root?.bsa?.[0]?.description["#cdata-section"]

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +9 to +13
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider removing allConfig since it's not being used. The recommendedConfig is sufficient when extending @raycast's config.

}

function DepartureDetail({ station }: { station: string }) {
const API_KEY = "Q58Q-PEEI-9DLT-DWEI";
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Move API_KEY to preferences using @raycast/api's getPreferenceValues() for better security

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new extension Label for PRs with new extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants