Conversation
|
@manojkumarjala-dev is attempting to deploy a commit to the pstaylor-patrick's projects Team on Vercel. A member of the Team first needs to authorize it. |
| for (let i = 0; i < regionNames.length; i++) { | ||
| const name = regionNames[i]; | ||
| const { city, state, country } = getLocation(name, locationsByRegion); | ||
| if (country !== 'United States') continue; |
There was a problem hiding this comment.
Removed this because initially I misunderstood that only united states entries are needed
|
|
||
| return { next, prev }; | ||
| } | ||
|
|
There was a problem hiding this comment.
This function is added to organize country, state and city
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
pstaylor-patrick
left a comment
There was a problem hiding this comment.
👍 I think this is a step in the right direction but still needs some refinement
- I noticed the city and state filters don't populate until you pick a country but that feels a bit silly when we only have one selectable country
I recommend you either hide the country filter and default it to united states or extend this to support the international locations included in the regions data
JamDev Recording of me Testing This
| name, | ||
| city, | ||
| state, | ||
| country: 'United States', |
There was a problem hiding this comment.
By default United states is placed as country in the db seeding script.
I changed it to parse the country from the location row from api.
|
Hey @pstaylor-patrick , In your original logic, the records pulled from the sheets are not being parsed & mapped. They by default have United States as country. https://jam.dev/c/63bf7263-b2c1-4576-9306-70528853a954 This is with my db. Please give your feedback. |
| // City is the 4th-to-last segment, state is the 3rd-to-last | ||
| const city = parts[parts.length - 4]; | ||
| const state = parts[parts.length - 3]; | ||
| const country = parts[parts.length - 1]; |
There was a problem hiding this comment.
This here extracts country from the location, logic is similar to the extracting logic for state & city
| return { next, prev }; | ||
| } | ||
|
|
||
| export async function getCountryStateCityMap(): Promise<Record<string, Record<string, string[]>>> { |
There was a problem hiding this comment.
This function will map countries -> states -> cities
This PR is Part of a Series
TL;DR