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

🎉 update header nav to new taxonomy #3178

Merged
merged 3 commits into from
Feb 8, 2024
Merged

🎉 update header nav to new taxonomy #3178

merged 3 commits into from
Feb 8, 2024

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Feb 7, 2024

Updates the nav to the new structure as agreed upon by the D&R team.

Here's a preview:

new.header.nav.mp4

And a screenshot of the tree as an unordered list, from a small observable util I made

new nav structure

Summary by CodeRabbit

  • New Features
    • Updated navigation categories and entries to enhance content representation.
    • Added new entries like "Alcohol Consumption" and "Opioids, Cocaine, Cannabis, and Other Illicit Drugs" for improved navigation.
  • Refactor
    • Refined site navigation structure for better user experience.

@ikesau ikesau requested a review from mlbrgl February 7, 2024 16:40
@ikesau ikesau self-assigned this Feb 7, 2024
Copy link

coderabbitai bot commented Feb 7, 2024

Walkthrough

The recent update involves refining the website's navigation structure by renaming categories and entries within the SiteNavigationStatic object. This update aims to improve the user experience by providing a more intuitive and accurate representation of content, including the addition of new entries and the removal of outdated ones.

Changes

Files Change Summary
site/SiteNavigation.tsx - Renamed categories and entries
- Added new entries like "Alcohol Consumption"
- Removed some entries

🐇🌟
Amidst the digital woods, we dance and play,
Paths retitled under the moon's gentle sway.
New stories sprout, old tales take flight,
Guiding all through the digital night.
🌌📖

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 83c8974 and 169e363.
Files selected for processing (1)
  • site/SiteNavigation.tsx (26 hunks)
Additional comments: 14
site/SiteNavigation.tsx (14)
  • 299-299: Ensure the new category "Geography of the World Population" aligns with the intended taxonomy updates. The name and slug should accurately reflect the content under this category.
  • 324-337: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [317-334]

The addition of "Health Risks" subcategory with entries like "Lead Pollution", "Alcohol Consumption", and "Opioids, Cocaine, Cannabis, and Other Illicit Drugs" is noted. Verify these entries are correctly categorized and the titles are appropriately chosen to reflect the content.

  • 378-394: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [362-408]

The "Infectious Diseases" subcategory has been updated with entries like "Coronavirus Pandemic (COVID-19)", "Pandemics", "Mpox (monkeypox)", and "Smallpox". Ensure these updates are in line with the latest research insights and the titles are consistent with the terminology used in the field.

  • 415-425: The "Health Institutions and Interventions" subcategory now includes "Vaccination", "Healthcare Spending", and "Eradication of Diseases". Confirm these additions and ensure the titles accurately represent the content and are consistent with the site's taxonomy.
  • 402-458: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [431-471]

Updates to the "Life and Death" subcategory, including new entries like "Causes of Death", "Mental Health", and "Global Health", are observed. Verify the appropriateness of these entries within this subcategory and check for consistency in naming.

  • 480-514: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [483-541]

The "Energy and Environment" category has been expanded with subcategories like "Energy Systems", "Waste and Pollution", and "Climate and Air". Ensure these subcategories and their entries are correctly organized and named to reflect the updated taxonomy.

  • 576-588: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [579-597]

The addition of the "Environment and Ecosystems" subcategory with entries such as "Natural Disasters" and "Animal Welfare" is noted. Confirm these updates align with the site's content strategy and the entries are accurately categorized.

  • 620-659: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [613-668]

The "Food and Agriculture" category updates, including the "Nutrition" and "Food Production" subcategories with entries like "Food Prices" and "Animal Welfare", are observed. Verify these changes accurately reflect the intended updates to the site's navigation taxonomy.

  • 714-729: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [717-743]

Updates to the "Poverty and Economic Development" category, specifically the "Public Sector" subcategory with entries like "State Capacity" and "Corruption", are noted. Ensure these updates are consistent with the site's content and the taxonomy updates.

  • 754-757: The addition of "Economic Inequality" to the "Poverty and Prosperity" subcategory is observed. Confirm this entry is appropriately named and categorized according to the updated taxonomy.
  • 820-919: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [787-1034]

The "Violence and War" category has been updated with entries like "War and Peace", "Nuclear Weapons", and "Biological and Chemical Weapons". Ensure these updates are in line with the site's content strategy and the entries are accurately categorized and named.

  • 852-875: The "Innovation and Technological Change" category now includes entries such as "Artificial Intelligence" and "Space Exploration and Satellites". Verify these additions and ensure they are correctly categorized and named to reflect the updated taxonomy.
  • 820-919: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [881-949]

Updates to the "Living Conditions, Community, and Wellbeing" category, including the "Housing and Infrastructure" and "Relationships" subcategories with entries like "Access to Energy" and "Trust", are observed. Confirm these updates align with the intended taxonomy changes and the entries are accurately categorized.

  • 971-999: The "Human Rights and Democracy" category has been updated with entries like "Human Rights", "Democracy", and "Violence Against Children and Children’s Rights". Ensure these updates are consistent with the site's content strategy and the entries are accurately categorized and named.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 169e363 and 6f0b3d3.
Files ignored due to path filters (3)
  • devTools/navigationTest/tsconfig.json is excluded by: !**/*.json
  • package.json is excluded by: !**/*.json
  • tsconfig.json is excluded by: !**/*.json
Files selected for processing (2)
  • devTools/navigationTest/navigationTest.ts (1 hunks)
  • site/SiteNavigation.tsx (27 hunks)
Files skipped from review as they are similar to previous changes (1)
  • site/SiteNavigation.tsx
Additional comments: 1
devTools/navigationTest/navigationTest.ts (1)
  • 22-26: Using the "HEAD" method is efficient for checking URL validity without downloading the entire resource. However, ensure that the server supports HEAD requests for all URLs being tested.

// Test all the slugs in the SiteNavigationStatic object and makes sure
// https://ourworldindata.org/{slug} returns a 200

import { SiteNavigationStatic } from "../../site/SiteNavigation.js"
Copy link

Choose a reason for hiding this comment

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

Consider using TypeScript's type annotations for SiteNavigationStatic to ensure type safety and clarity in the code.

Comment on lines +6 to +39
const testSiteNavigation = async () => {
const slugs = SiteNavigationStatic.categories
.map((category) => {
const categorySlugs = category.entries
.map((entry) => entry.slug)
.concat(
(category.subcategories?.length &&
category.subcategories.flatMap((subcategory) =>
subcategory.entries.map((entry) => entry.slug)
)) ||
[]
)
return categorySlugs
})
.flat()

let promises = slugs.map((slug) => {
return fetch(`https://ourworldindata.org/${slug}`, {
method: "HEAD",
})
})

const responses: Response[] = await Promise.all(promises)
if (responses.some((response) => !response.ok)) {
console.error(
"❌ One or more fetches failed: ",
responses
.filter((response) => !response.ok)
.map((response) => response.url)
)
return
}
console.log("✅ All fetches completed")
}
Copy link

Choose a reason for hiding this comment

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

  • The function testSiteNavigation lacks error handling for network issues or exceptions thrown by fetch. Wrap the fetch call in a try-catch block to handle these cases.
  • The function does not return any value indicating success or failure, which might be useful for automated testing or integration into a larger test suite.

Comment on lines +28 to +37
const responses: Response[] = await Promise.all(promises)
if (responses.some((response) => !response.ok)) {
console.error(
"❌ One or more fetches failed: ",
responses
.filter((response) => !response.ok)
.map((response) => response.url)
)
return
}
Copy link

Choose a reason for hiding this comment

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

  • The error logging could be more informative by including the status code and status text.
  • Returning early from the function upon failure prevents any further processing or cleanup that might be necessary. Consider how this behavior integrates with the broader testing framework or CI/CD pipeline.

console.log("✅ All fetches completed")
}

testSiteNavigation()
Copy link

Choose a reason for hiding this comment

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

Invoking testSiteNavigation directly in the script makes it less modular and harder to integrate into automated testing environments. Consider exporting the function and moving the invocation to a separate script or test runner.

Copy link
Member

@mlbrgl mlbrgl left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

I've added a basic test for it: yarn testSiteNavigation. This checks that all slugs in the navigation tree return a 200.

Screenshot 2024-02-08 at 14.17.03.png

@ikesau ikesau merged commit a9497ba into master Feb 8, 2024
17 checks passed
@ikesau ikesau deleted the nav-updates branch February 8, 2024 15:46
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