Skip to content

Issues 41, 42, 43#46

Open
manojkumarjala-dev wants to merge 4 commits intopstaylor-patrick:mainfrom
manojkumarjala-dev:main
Open

Issues 41, 42, 43#46
manojkumarjala-dev wants to merge 4 commits intopstaylor-patrick:mainfrom
manojkumarjala-dev:main

Conversation

@manojkumarjala-dev
Copy link
Contributor

@manojkumarjala-dev manojkumarjala-dev commented Jun 1, 2025

This PR is Part of a Series

TL;DR

  • Bg color modified to make make active tab visible.
  • Extracting Location logic modified to get country and adding filter to not load other countries except United States.
  • Wrongly understood the requirement for 🟠 implement the countries filter #42 and just loaded United States entries. Modified that error.
  • Now all the entries will be loaded along with their country.
  • Modified the region filter logic to drill down from country -> state -> city

@vercel
Copy link

vercel bot commented Jun 1, 2025

@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.

@manojkumarjala-dev manojkumarjala-dev changed the title active-tab bg color modified Issues 41, 42 Jun 1, 2025
@manojkumarjala-dev manojkumarjala-dev changed the title Issues 41, 42 Issues 41, 42, 43 Jun 1, 2025
for (let i = 0; i < regionNames.length; i++) {
const name = regionNames[i];
const { city, state, country } = getLocation(name, locationsByRegion);
if (country !== 'United States') continue;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this because initially I misunderstood that only united states entries are needed


return { next, prev };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is added to organize country, state and city

@vercel
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
f3-xicon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 10:28am

Copy link
Owner

@pstaylor-patrick pstaylor-patrick left a comment

Choose a reason for hiding this comment

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

👍 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

https://jam.dev/c/10f84581-be0c-438f-a363-4a37f2b87782

name,
city,
state,
country: 'United States',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@manojkumarjala-dev
Copy link
Contributor Author

Hey @pstaylor-patrick ,
Thanks for the feedback. I think you might need to reset and seed the db again to get all other countries.

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];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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[]>>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function will map countries -> states -> cities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants