-
Notifications
You must be signed in to change notification settings - Fork 25
feat: sort dining locations by distance (IN PROGRESS) #722
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
base: sort-locations-by-distance
Are you sure you want to change the base?
Conversation
|
@sjain2025 is attempting to deploy a commit to the ScottyLabs Team on Vercel. A member of the Team first needs to authorize it. |
| if (location.name === "Stack'd Dessert Bar" && stackUnderground?.coordinates) { | ||
| return { | ||
| ...location, | ||
| coordinates: stackUnderground.coordinates, | ||
| }; | ||
| } | ||
| if (location.name === 'Zebra Lounge' && exchange?.coordinates) { | ||
| return { | ||
| ...location, | ||
| coordinates: exchange.coordinates, | ||
| }; | ||
| } | ||
| if (location.name === 'Sweet Plantain' && tasteOfIndia?.coordinates) { | ||
| return { | ||
| ...location, | ||
| coordinates: tasteOfIndia.coordinates, | ||
| }; | ||
| } | ||
| if (location.name === "De Fer Coffee & Tea At Resnik" && tasteOfIndia?.coordinates) { | ||
| return { | ||
| ...location, | ||
| coordinates: tasteOfIndia.coordinates, | ||
| }; | ||
| } | ||
| if (location.name === 'E.a.t. (evenings At Tepper) - Rohr Commons' && tepperTaqueria?.coordinates) { | ||
| return { | ||
| ...location, | ||
| coordinates: tepperTaqueria.coordinates, | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these coordinate overwrites here because cmumaps can't accept the non-ovewritten coordinates?
| server: { | ||
| proxy: { | ||
| '/api/cmu-maps': { | ||
| target: 'https://rust.api.maps.scottylabs.org', | ||
| changeOrigin: true, | ||
| rewrite: (path) => path.replace(/^\/api\/cmu-maps/, ''), | ||
| secure: true, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting! why proxy cmumaps requests through cmueats this way?
| interface CMUMapsApiResponse { | ||
| Fastest: { | ||
| path: { | ||
| path: Array<{ | ||
| id: string; | ||
| coordinate: { | ||
| latitude: number; | ||
| longitude: number; | ||
| }; | ||
| floor: { | ||
| buildingCode: string; | ||
| level: string; | ||
| }; | ||
| roomId: string; | ||
| neighbors: Record< | ||
| string, | ||
| { | ||
| dist: number; | ||
| toFloorInfo: any; | ||
| } | ||
| >; | ||
| }>; | ||
| distance: number; | ||
| }; | ||
| instructions: Array<{ | ||
| action: string; | ||
| distance: number; | ||
| node_id: string; | ||
| }>; | ||
| }; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we write this as a zod schema so we can parse and validate the api response for full typesafety? (or if cmumaps has an openapi schema, we can use that as well)
| @media screen and (max-width: 900px) { | ||
| .Locations-header__filters { | ||
| flex-direction: column; | ||
| gap: 0.5rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just an fyi, cmueats has opted to use px for everything for consistency
|
goated feature |
| const getPriority = (state: LocationState) => { | ||
| if (state === LocationState.OPEN | ||
| || state === LocationState.CLOSES_SOON) return 0; | ||
| if (state === LocationState.OPENS_SOON) return 1; | ||
| if (state === LocationState.CLOSED | ||
| || state === LocationState.CLOSED_LONG_TERM) return 2; | ||
| return 3; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good - although this feels inverted since higher priority elements are sorted last lmao
PR for testing on mobile (feature in progress)