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

Home page, about page and build your own Data Commons page, and footer #4599

Merged
merged 107 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 106 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
baa3794
Feature/home page react (#1)
nick-next Sep 3, 2024
1738d8c
This push addresses a number of comments in the PR:
nick-next Sep 5, 2024
4393072
File, path and import renaming.
nick-next Sep 5, 2024
8b3ac39
File formatting, tagged the homepage metadata data container as "meta…
nick-next Sep 5, 2024
547bf5e
To keep full backwards compatibility with templates using the old hom…
nick-next Sep 5, 2024
8758913
Following up from the previous commit, the .ts file for v2 (the new v…
nick-next Sep 5, 2024
3b788c1
Factored out the calls to `document.getElementById` so that it is onl…
nick-next Sep 5, 2024
d468964
Commenting of interfaces, interface properties and files.
nick-next Sep 5, 2024
ea913a3
This push brings back the application container for the original home…
nick-next Sep 5, 2024
db7146f
Used macros to help render the label and route data containers.
nick-next Sep 5, 2024
4bf9b18
Updating the label and route proxy objects to take the type as a gene…
nick-next Sep 5, 2024
8ff02ae
The label proxy object now emits a log when the requested label does …
nick-next Sep 5, 2024
9d35401
Template routes must now be wrapped in `{}` in order to be resolved, …
nick-next Sep 5, 2024
6ea848f
WIP: A functional implementation of the rich menu. A note that this h…
nick-next Sep 6, 2024
12abba5
WIP We now have the ability to put direct links in the header menu (s…
nick-next Sep 6, 2024
c6b98d5
Menu Styles WIP
pablonoel Sep 6, 2024
859a19f
better search bar
pablonoel Sep 6, 2024
baeeb68
Added in {} tags to remaining routes, and removed an extra logo from …
nick-next Sep 6, 2024
1edc0e6
Menu WIP shadow + arrows
pablonoel Sep 6, 2024
585cc29
Menu item link coloring update.
nick-next Sep 6, 2024
8991754
Improvement over menu item behaviour
pablonoel Sep 6, 2024
166e32e
Animated icon when page is open.
nick-next Sep 6, 2024
dfe6c21
WIP improvements for the menu
pablonoel Sep 6, 2024
17a6c45
Added in TODOs to be resolved before the final PR.
nick-next Sep 6, 2024
37ef92a
Improvements on menu structure and sizes
pablonoel Sep 6, 2024
8c97b7b
Cleaned up the menu sliding action so that it has the appearance of a…
nick-next Sep 6, 2024
6e6c296
Update header content to include missing links.
nick-next Sep 6, 2024
bdbd474
Minor tweaks to the header styles.
nick-next Sep 6, 2024
149f0fe
Temporarily removed the stand-in for the mobile menu toggle button.
nick-next Sep 6, 2024
6eae1b4
Breakpoints and responsive spacing
pablonoel Sep 6, 2024
676d0c8
Merge branch 'feature/header' of https://github.com/Half-Integer/data…
pablonoel Sep 6, 2024
b449369
Removal of stray console log and some formatting.
nick-next Sep 6, 2024
1162697
Merge branch 'feature/homepage-revamp' into feature/header
nick-next Sep 6, 2024
a425a31
Refactor search bar component to fix Firefox Issue
pablonoel Sep 6, 2024
bc80cda
Merge branch 'feature/header' of https://github.com/Half-Integer/data…
pablonoel Sep 6, 2024
1466751
new desktop header
jenibelle08 Sep 6, 2024
49aed83
WIP: implementation of the mobile menu version of the rich menu. A no…
nick-next Sep 7, 2024
63423d2
Some refactoring of how the header CSS is applied, so that it is avai…
nick-next Sep 7, 2024
50d4966
Added in a missing route resolver.
nick-next Sep 7, 2024
52e4993
If the user scrolls and the desktop rich menu is open, it now closes …
nick-next Sep 7, 2024
c30cf86
better styles for mobile menu
pablonoel Sep 7, 2024
34e917f
Some component renaming
nick-next Sep 7, 2024
16c4fde
Mobile Menu Design Details
pablonoel Sep 7, 2024
41fe22e
Merge branch 'feature/header-mobile' of https://github.com/Half-Integ…
pablonoel Sep 7, 2024
f914dd1
Small fix on hamburger menu icon font size
pablonoel Sep 7, 2024
34b79ea
Removal of unused prop.
nick-next Sep 7, 2024
e77f40d
Visual fixes
pablonoel Sep 7, 2024
012278b
Merge branch 'new-homepage' into feature/header-mobile
nick-next Sep 7, 2024
027772c
Removal of unneeded files and imports, as well as an unneeded prop.
nick-next Sep 7, 2024
cff3114
New homepage initial commit
pablonoel Sep 7, 2024
c9b6dae
Scaffolding for the two new pages to be built: a revamp of the about …
nick-next Sep 7, 2024
f8bf97e
New Images
pablonoel Sep 8, 2024
629a8b8
Refactor reusable variables
pablonoel Sep 8, 2024
458bc23
The sample questions are now coming through to the React app via the …
nick-next Sep 8, 2024
bd04751
Formatting follow-up to previous push.
nick-next Sep 8, 2024
d42bb0a
Addition of missing keys and minor formatting updates.
nick-next Sep 8, 2024
8433e96
Hero refactor + video
pablonoel Sep 8, 2024
9ba7690
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 8, 2024
1fb4380
remove margin from main container
pablonoel Sep 8, 2024
ab7b553
testing component specific scss files
pablonoel Sep 8, 2024
46ccdb3
refactor component styles
pablonoel Sep 8, 2024
2da79a2
The partners are now being passed through to the about page.
nick-next Sep 8, 2024
33d3d70
New location for files, new basic content components
pablonoel Sep 8, 2024
4eec52b
Cleanup, Refactor images location, WIP component styles
pablonoel Sep 8, 2024
861310c
Font sizes refactor
pablonoel Sep 8, 2024
f3db4df
WIP: Implementation of a slide carousel for the home page and the abo…
nick-next Sep 8, 2024
2c363da
Merge remote-tracking branch 'origin/feature/new-pages' into feature/…
nick-next Sep 8, 2024
112c9c9
SCSS cleanup (formatting fixes) as well as a fix to the height of the…
nick-next Sep 8, 2024
4dc09e0
Fixes carousel shadow visual bug
pablonoel Sep 8, 2024
a786739
Added in a timer (with a TODO to review the length of it) to delay th…
nick-next Sep 8, 2024
35c1aac
Reactify media_text component
pablonoel Sep 8, 2024
476a2e9
Added in a TODO on the server side for moving to version two of the h…
nick-next Sep 8, 2024
3ac04d6
Directory refactor (placing the header-related components in their ow…
nick-next Sep 8, 2024
0e28fcc
Added in a TODO for the potential to fold the rich desktop and rich m…
nick-next Sep 8, 2024
5796151
Directory reorganization, formatting and small fixes.
nick-next Sep 8, 2024
bce27dc
WIP component styles
pablonoel Sep 8, 2024
a7530d9
Merge branch 'new-homepage' into feature/new-pages
nick-next Sep 8, 2024
5c21f14
An interim improvement for the content flash when loading older pages…
nick-next Sep 9, 2024
45ac859
Trimming down the footer in preparation for styling of the new footer.
nick-next Sep 9, 2024
9204678
Clean up and refactor of font sizes and spacing
pablonoel Sep 9, 2024
5be10ce
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 9, 2024
5dbc6ec
Removing the old homepage and converting the v2 fork to the primary h…
nick-next Sep 9, 2024
eaa84cb
Build page WIP
pablonoel Sep 9, 2024
fa1f5ff
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 9, 2024
afb3b52
Fix some spacing
pablonoel Sep 9, 2024
0957590
better styles for text-columns component
pablonoel Sep 9, 2024
b11feb8
Refactoring, making some components generic, and formatting/commenting.
nick-next Sep 9, 2024
3c2d565
Merge remote-tracking branch 'origin/feature/new-pages' into feature/…
nick-next Sep 9, 2024
46ec299
Footer Styles
pablonoel Sep 9, 2024
8b75252
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 9, 2024
52e74eb
The about page slider component (with some stand-in content for the s…
nick-next Sep 9, 2024
90edca0
Responsive behaviour
pablonoel Sep 9, 2024
96274fa
Nicer slider in about
pablonoel Sep 9, 2024
a8d9f68
Update slide_carousel.scss
pablonoel Sep 9, 2024
b015b8a
Initial push of the quote hero on the build page.
nick-next Sep 9, 2024
4a9c58e
Fix the breakpoints for pages
pablonoel Sep 9, 2024
594006d
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 9, 2024
b368f27
fix some shadow biting
pablonoel Sep 9, 2024
aebdbdb
Fix menu position
pablonoel Sep 9, 2024
6bbbb36
Visual improvements on Build page components
pablonoel Sep 9, 2024
7690674
Update to header loader offsets.
nick-next Sep 9, 2024
8932490
Added in template boolean for the ability to selectively show and hid…
nick-next Sep 9, 2024
a8ab0e7
Add extra padding to mobile menu to avoid cropping content
pablonoel Sep 9, 2024
dd6ba42
Merge branch 'feature/new-pages' of https://github.com/Half-Integer/d…
pablonoel Sep 9, 2024
5dfa86c
Update Menu size
pablonoel Sep 9, 2024
e2f07f7
Flipping of about and build pages.
nick-next Sep 9, 2024
c65b305
Merge remote-tracking branch 'dc/new-homepage' into new-homepage
nick-next Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ def create_app(nl_root=DEFAULT_NL_ROOT):
"config/home_page/topics.json")
app.config['HOMEPAGE_PARTNERS'] = libutil.get_json(
"config/home_page/partners.json")
app.config['HOMEPAGE_SAMPLE_QUESTIONS'] = libutil.get_json(
"config/home_page/sample_questions.json")

if cfg.TEST or cfg.LITE:
app.config['MAPS_API_KEY'] = ''
Expand Down Expand Up @@ -443,8 +445,10 @@ def add_language_code(endpoint, values):
@app.context_processor
def inject_common_parameters():
common_variables = {
#TODO: replace HEADER_MENU with V2
'HEADER_MENU': json.dumps(libutil.get_json("config/base/header.json")),
'FOOTER_MENU': json.dumps(libutil.get_json("config/base/footer.json"))
'FOOTER_MENU': json.dumps(libutil.get_json("config/base/footer.json")),
'HEADER_MENU_V2': json.dumps(libutil.get_json("config/base/header_v2.json")),
}
locale_variable = dict(locale=get_locale())
return {**common_variables, **locale_variable}
Expand Down
203 changes: 203 additions & 0 deletions server/config/base/header_v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
[
{
"label": "Overview",
"ariaLabel": "Data Commons overview",
"introduction": "Data Commons is an open-source platform aggregating global public data for easy exploration using natural language.",
"primarySectionGroups": [
{
"title": "Key Features",
"items": [
{
"title": "Large harmonized public dataset",
"description": "240 billion data points across 260K statistical variables, harmonized from governmental, inter-governmental, academic and non-profit organizations"
},
{
"title": "Natural language interface",
"description": "Data Commons uses AI for natural language queries, making public data accessible and useful to all"
}
]
},
{
"title": "Build your Data Commons",
"items": [
{
"title": "Tailor your own Data Commons",
"description": "Launch your own Data Commons and customize it with your own data to better engage your specific audience"
},
{
"title": "Explore your data with natural language",
"description": "Ask questions in your own words and get answers directly from your data"
},
{
"title": "Actionable Insights",
"description": "Gain actionable insights from your data in connection to global data",
"links": [
{
"title": "Learn more & build yours today",
"url": "{place.place}"
}
]
}
]
}
],
"secondarySectionGroups": [
{
"title": "Other Data Commons",
"items": [
{
"title": "Partners",
"description": "Featured organizations who organizations have tailored their own Data Commons to meet their specific needs and goals",
"links": [
{
"title": "United Nations",
"url": "https://www.un.org",
"linkType": "external"
},
{
"title": "One.org",
"url": "https://one.org",
"linkType": "external"
}
]
}
]
}
]
},
{
"label": "Tools",
"ariaLabel": "Show exploration tools",
"introduction": "Explore a variety of tools to visualize, analyze, and interact with the Data Commons knowledge graph and its extensive datasets.",
"primarySectionGroups": [
{
"items": [
{
"title": "Knowledge Graph",
"url": "{browser.browser_main}",
"description": "Explore what data is available and understand the graph structure"
},
{
"title": "Statistical Variable Explorer",
"url": "{tools.stat_var}",
"description": "Explore statistical variable details including metadata and observations"
},
{
"title": "Data Download Tool",
"url": "{tools.download}",
"description": "Download data for selected statistical variables"
}
]
},
{
"items": [
{
"title": "Map Explorer",
"url": "{tools.visualization}#visType=map",
"description": "Study how a selected statistical variable can vary across geographic regions"
},
{
"title": "Scatter Plot Explorer",
"url": "{tools.visualization}#visType=scatter",
"description": "Visualize the correlation between two statistical variables"
},
{
"title": "Timelines Explorer",
"url": "{tools.visualization}#visType=timeline",
"description": "See trends over time for selected statistical variables"
}
]
}
]
},
{
"label": "Documentation",
"ariaLabel": "Show documentation links",
"introduction": "Access in-depth tutorials, guides, and API references to unlock the full potential of Data Commons and integrate it into your projects.",
"primarySectionGroups": [
{
"items": [
{
"title": "Docs",
"url": "https://docs.datacommons.org",
"description": "Learn how to leverage the Data Commons unified database with comprehensive documentation, tutorials, and guides."
},
{
"title": "API",
"url": "https://docs.datacommons.org/api",
"description": "Access a unified knowledge graph with standardized data from diverse sources using Data Commons APIs."
}
]
},
{
"items": [
{
"title": "Tutorials",
"url": "https://docs.datacommons.org/tutorials",
"description": "Get familiar with the Data Commons Knowledge Graph and APIs using analysis examples in Google Colab notebooks written in Python."
},
{
"title": "Contributions",
"url": "https://docs.datacommons.org/contributing/",
"description": "Become part of Data Commons by contributing data, tools, educational materials, or sharing your analysis and insights. Collaborate and help expand the knowledge graph!"
}
]
}
]
},
{
"label": "About",
"ariaLabel": "Show about links",
"introduction": "Data Commons is an initiative from Google. Discover how Data Commons is changing data analysis. Explore diverse data, learn to use its tools through Python examples, and stay updated on the latest news and research.",
"primarySectionGroups": [
{
"items": [
{
"title": "Why Data Commons",
"url": "{static.about}",
"description": "Discover why Data Commons is revolutionizing data access and analysis. Learn how its unified knowledge graph empowers you to explore diverse, standardized data."
},
{
"title": "Data Sources",
"url": "https://docs.datacommons.org/datasets/",
"description": "Get familiar with the Data Commons Knowledge Graph and APIs using analysis examples in Google Colab notebooks written in Python.",
"links": [
{
"title": "Data Updates",
"url": "https://www.datacommons.org/rss",
"linkType": "rss"
}
]
}
]
},
{
"items": [
{
"title": "FAQ",
"url": "{static.faq}",
"description": "Find quick answers to common questions about Data Commons, its usage, data sources, and available resources."
},
{
"title": "Blog",
"url": "https://blog.datacommons.org/",
"description": "Stay up-to-date with the latest news, updates, and insights from the Data Commons team. Explore new features, research, and educational content related to the project.",
"links": [
{
"title": "Blog posts",
"url": "https://blog.datacommons.org/rss",
"linkType": "rss"
}
]
}
]
}
]
},
{
"label": "Feedback",
"ariaLabel": "Give feedback",
"url": "{static.feedback}",
"exposeInMobileBanner": true
}
]
50 changes: 50 additions & 0 deletions server/config/home_page/sample_questions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"category": "Sustainability",
"questions": [
"Which counties in the US have the most smoke pollution?",
"Which countries have the most greenhouse gas emissions?",
"What is the solar energy consumption around the world?"
]
},
{
"category": "Economics",
"questions": [
"Tell me about the economy in Brazil.",
"Show me the breakdown of businesses by industry type in the US.",
"What is the GDP in Iran?"
]
},
{
"category": "Equity",
"questions": [
"Which countries have the lowest Gini index?",
"Which counties in the US have the highest rates of uninsured?",
"What about health equity in Florida?"
]
},
{
"category": "Education, housing and commute",
"questions": [
"When were the houses in NYC built?",
"Which countries have the highest college-educated population in the world?",
"How much time do people in San Francisco spend commuting?"
]
},
{
"category": "Demographics",
"questions": [
"Demographics around the world",
"Which country has the most old people?",
"Which state in the US has the most Tamil speakers?"
]
},
{
"category": "Health",
"questions": [
"How does life expectancy vary across countries in Africa?",
"What is the prevalence of asthma across California counties?",
"What are the rates of child immunization in Pakistan?"
]
}
]
11 changes: 10 additions & 1 deletion server/routes/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,23 @@ def homepage():
"homepage.html",
topics=json.dumps(current_app.config.get('HOMEPAGE_TOPICS', [])),
partners_list=current_app.config.get('HOMEPAGE_PARTNERS', []),
partners=json.dumps(current_app.config.get('HOMEPAGE_PARTNERS', [])))
partners=json.dumps(current_app.config.get('HOMEPAGE_PARTNERS', [])),
sample_questions=json.dumps(current_app.config.get('HOMEPAGE_SAMPLE_QUESTIONS', [])))


@bp.route('/about')
def about():
return lib_render.render_page("static/about.html", "about.html")


@bp.route('/build')
def build():
return lib_render.render_page(
"static/build.html",
"build.html",
partners=json.dumps(current_app.config.get('HOMEPAGE_PARTNERS', [])))


@bp.route('/faq')
def faq():
current_date = date.today().strftime('%-d %b %Y')
Expand Down
10 changes: 8 additions & 2 deletions server/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
page_id: DOM Element ID for the html element

Optional variables:

is_show_header_search_bar: boolean, if true, a search bar will appear in the header. Default false.
is_hide_full_footer: boolean, if true, hides the full expanded footer. Default false
is_hide_sub_footer: boolean, if true, hides the sub footer. Default false
locale: string, value for html lang attr
Expand Down Expand Up @@ -64,6 +66,7 @@
<link href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@300;400;500;700&family=Google+Sans+Text:wght@300;400;500;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined&display=block">
<link rel="stylesheet" href={{url_for('static', filename='css/core.min.css', t=config['VERSION'])}}>
{% block head %}
{% endblock %}
{% if OVERRIDE_CSS_PATH %}
Expand Down Expand Up @@ -95,12 +98,13 @@

<body>
<div id="metadata-base" class="d-none"
data-header="{{ HEADER_MENU }}"
data-header="{{ HEADER_MENU_V2 }}"
data-footer="{{ FOOTER_MENU }}"
data-logo-path="{{ LOGO_PATH }}"
data-name="{{ NAME }}"
data-show-disaster="{{ SHOW_DISASTER }}"
data-show-sustainability="{{ SHOW_SUSTAINABILITY }}"
data-show-header-search-bar="{{ is_show_header_search_bar }}"
data-hide-full-footer="{{ is_hide_full_footer }}"
data-hide-sub-footer="{{ is_hide_sub_footer }}"
data-subfooter-extra="{{ subfooter_extra_content|safe }}"
Expand All @@ -114,7 +118,9 @@
<script src={{url_for('static', filename='base.js', t=config['VERSION'])}} async></script>

<div id="main">
<div id="app-header-container"></div>
<div id="app-header-container">
<div id="app-header-loader"></div>
</div>
<main id="{{ main_id }}" class="main-content">
{% block content %}
{% endblock %}
Expand Down
Loading