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

Improve "place in" box on dev place pages #4774

Merged
merged 12 commits into from
Dec 9, 2024

Conversation

juliawu
Copy link
Contributor

@juliawu juliawu commented Dec 6, 2024

1) Fix long list of child places on continent place pages

On continent place pages, the list of child places will contain places that are more than one level down in containment (e.g, showing municipalities, not just countries). This PR adds a child place type entry for continents to the child place fetch logic.

Before:

Screenshot 2024-12-05 at 6 18 26 PM

After:

Screenshot 2024-12-05 at 6 18 33 PM

2) Add a "show more" toggle when the list of child places is long

Sometimes the list of child places is very long, which overwhelms the page. This PR also adds a "show more" toggle when the number of child places is greater than 15.

Long lists are truncated initially

Screenshot 2024-12-09 at 9 57 08 AM

Show full list after clicking "show more"

Screenshot 2024-12-05 at 6 12 25 PM

Short lists don't show a toggle

Screenshot 2024-12-05 at 6 11 53 PM

3) Replace place search with link to knowledge graph on current place pages

In preparation for the changes made in PR #4740, this PR also removes the place search bar to avoid showing users double search bars, and instead shows the DCID and a link to the knowledge graph entry, fixing a longstanding feature regression.

Before:
Screenshot 2024-12-09 at 11 53 21 AM

After:
Screenshot 2024-12-09 at 11 47 12 AM

Copy link
Contributor

@gmechali gmechali left a comment

Choose a reason for hiding this comment

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

Looks very neat!!
Did you figure out why we kept hovering between the long list and the short list of child places when looking at the europe page?

const { place, childPlaces } = props;
if (!childPlaces || childPlaces.length === 0) {
return null;
}
const NUM_PLACES = 15;
Copy link
Contributor

Choose a reason for hiding this comment

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

curious - how did we choose 15?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Admittedly a bit arbitrarily -- this looks good to my eyes for now. My thought is to use NUM_PLACES = 15 to unblock experimental release before the code freeze, and we can decide on a better solution after.

Copy link
Contributor

Choose a reason for hiding this comment

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

After thinking about this more, i think a better experience might be to make this responsive and to show more items when the page is larger, and fewer for smaller screen sizes. Wdyt @miss-o-soup ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I'll discuss with @miss-o-soup and add responsive behavior in a follow-up PR, I don't think this needs to block release.

</a>
</div>
))}
{childPlaces
Copy link
Contributor

Choose a reason for hiding this comment

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

I might argue this is starting to add a lot of logic within the render block.
could we maybe store the slice in a different variable called trimmedChildPlaces and then just toggle between trimmedChildPlaces and allChildPlaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call out. Stored the slice in a different variable and now just toggle between the lists which looks much cleaner now.

@juliawu juliawu requested a review from dwnoble December 6, 2024 18:41
@beets
Copy link
Contributor

beets commented Dec 6, 2024

Just from the screenshots -- looks like we are returning Yugoslavia. We should be filtering "deprecated" countries..

@dwnoble
Copy link
Contributor

dwnoble commented Dec 6, 2024

Just from the screenshots -- looks like we are returning Yugoslavia. We should be filtering "deprecated" countries..

Agreed-this is already on our task list

{showToggle && (
<div className="show-more-toggle" onClick={toggleShowMore}>
<span className="show-more-toggle-text">
{isCollapsed ? "Show more" : "Show less"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the count for show more? e.g., "Show 25 more"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea, done! Also updated screenshots in the PR description.

@juliawu juliawu requested review from gmechali and dwnoble December 9, 2024 19:54
@juliawu
Copy link
Contributor Author

juliawu commented Dec 9, 2024

@gmechali @dwnoble @miss-o-soup as per offline discussion, added the removal of the place search bar to this PR. Please take another look!

Copy link
Contributor

@dwnoble dwnoble left a comment

Choose a reason for hiding this comment

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

Thanks Julia!

Hold off on merging until #4740 is in so we'll have the top nav NL search bar

@juliawu juliawu merged commit 480a56e into datacommonsorg:master Dec 9, 2024
8 checks passed
@juliawu juliawu deleted the new-places-in branch December 9, 2024 22:16
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.

4 participants