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

[HelpDot] Show platforms and hubs #27932

Merged
merged 13 commits into from
Sep 22, 2023
2 changes: 1 addition & 1 deletion .github/scripts/createDocsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const platformNames = {
* @returns {String}
*/
function toTitleCase(str) {
return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/article-card.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a class="card" href="/articles/{{ include.hub }}/{{ include.href }}">
<a class="card" href="/articles/{{ include.platform }}/{{ include.hub }}/{{ include.href }}">
<div class="body">
<h3 class="title">{{ include.title }}</h3>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/_includes/hub-card.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% assign hub = site.data.routes.hubs | where: "href", include.href | first %}

<a class="card" href="/hubs/{{ hub.href }}">
{% assign hub = include.hub %}
{% assign platform = include.platform %}
<a class="card" href="/{{ platform }}/hubs/{{ hub.href }}">
<div class="row">
<div class="left-icon">
<img class="icon" src="{{ hub.icon }}" alt="{{ hub.href }}"/>
Expand Down
29 changes: 16 additions & 13 deletions docs/_includes/hub.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% assign activeHub = page.url | remove: "/hubs/" | remove: ".html" %}
{% assign hub = site.data.routes.hubs | where: "href", activeHub | first %}
{% assign activePlatform = page.url | replace: '/', ' ' | truncatewords: 1 | remove:'...' %}
{% assign platform = site.data.routes.platforms | where: "href", activePlatform | first %}

{% assign activeHub = page.url | remove: activePlatform | remove: "/hubs/" | remove: "/" | remove: ".html" %}
{% assign hub = platform.hubs | where: "href", activeHub | first %}

<h1 class="title">
{{ hub.title }}
Expand All @@ -9,6 +12,16 @@ <h1 class="title">
{{ hub.description }}
</p>

{% if hub.articles %}
<section>
<div class="cards-group">
{% for article in hub.articles %}
{% include article-card.html hub=hub.href href=article.href title=article.title platform=activePlatform %}
{% endfor %}
</div>
</section>
{% endif %}

{% for section in hub.sections %}
<section>
<h2 id="{{ section.href }}">
Expand All @@ -18,18 +31,8 @@ <h2 id="{{ section.href }}">
<div class="cards-group">
{% for article in section.articles %}
{% assign article_href = section.href | append: '/' | append: article.href %}
{% include article-card.html hub=hub.href href=article_href title=article.title %}
{% include article-card.html hub=hub.href href=article_href title=article.title platform=activePlatform %}
{% endfor %}
</div>
</section>
{% endfor %}

{% if hub.articles %}
<section>
<div class="cards-group">
{% for article in hub.articles %}
{% include article-card.html hub=hub.href href=article.href title=article.title %}
{% endfor %}
</div>
</section>
{% endif %}
2 changes: 1 addition & 1 deletion docs/_includes/lhn-article-link.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li>
<a href="/articles/{{ include.hub }}/{{ include.href }}" class="link">
<a href="/articles/{{ include.platform }}/{{ include.hub }}/{{ include.href }}" class="link">
{{ include.title }}
</a>
</li>
61 changes: 39 additions & 22 deletions docs/_includes/lhn-template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% assign activeHub = page.url | remove: "/hubs/" | remove: ".html" %}
{% assign activePlatform = page.url | replace:'/',' ' | truncatewords: 1 | remove:'...' %}
{% assign activeHub = page.url | remove: activePlatform | remove: "/hubs/" | remove: "/" | remove: ".html" %}

<ul class="lhn-items">
<li class="home-link">
Expand All @@ -9,38 +10,54 @@
{% endif %}
</li>

{% for hub in site.data.routes.hubs %}
{% if hub.href == activeHub %}
{% for platform in site.data.routes.platforms %}
{% if platform.href == activePlatform %}
<li>
<div class="icon-with-link selected">
<img src="/assets/images/down.svg" class="base-icon"></img>
<span>{{ hub.title }}</span>
<span>{{ platform.title }}</span>
</div>
<ul class="nested-treeview">
<!-- First display sections with nested articles -->
{% for section in hub.sections %}
{% for hub in platform.hubs %}
<ul>
{% if hub.href == activeHub %}
<div class="icon-with-link selected">
<img src="/assets/images/down.svg" class="base-icon"></img>
<span>{{ hub.title }}</span>
</div>
<ul class="nested-treeview">
{% for article in hub.articles %}
{% include lhn-article-link.html platform=activePlatform hub=hub.href href=article.href title=article.title %}
{% endfor %}

{% for section in hub.sections %}
<li>
<a href="#{{ section.href }}" class="link">{{ section.title }}</a>
<ul>
{% for article in section.articles %}
{% assign article_href = section.href | append: '/' | append: article.href %}
{% include lhn-article-link.html platform=activePlatform hub=hub.href href=article_href title=article.title %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% else %}
<li>
<a href="#{{ section.href }}" class="link">{{ section.title }}</a>
<ul>
{% for article in section.articles %}
{% assign article_href = section.href | append: '/' | append: article.href %}
{% include lhn-article-link.html hub=hub.href href=article_href title=article.title %}
{% endfor %}
</ul>
<a href="/{{ activePlatform }}/hubs/{{ hub.href }}" class="icon-with-link link">
<img src="/assets/images/arrow-right.svg" class="base-icon"></img>
{{ hub.title }}
</a>
</li>
{% endfor %}

<!-- Then display standalone articles -->
{% for article in hub.articles %}
{% include lhn-article-link.html hub=hub.href href=article.href title=article.title %}
{% endfor %}
{% endif %}
</ul>
{% endfor %}
</li>

{% else %}
<li>
<a href="/hubs/{{ hub.href }}" class="icon-with-link link">
<a href="/{{ platform.href }}/hubs" class="icon-with-link link">
<img src="/assets/images/arrow-right.svg" class="base-icon"></img>
{{ hub.title }}
{{ platform.title }}
</a>
</li>
{% endif %}
Expand Down
13 changes: 13 additions & 0 deletions docs/_includes/platform-card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% assign platform = site.data.routes.platforms | where: "href", include.href | first %}

<a class="card" href="/{{ platform.href }}/hubs">
<div class="row">
<div class="left-icon">
<img class="icon" src="{{ platform.image }}" alt="{{ platform.href }}"/>
</div>
<div class="body">
<h3 class="title with-margin">{{ platform.title }}</h3>
<p class="description with-min-height">{{ platform.description }}</p>
</div>
</div>
</a>
18 changes: 18 additions & 0 deletions docs/_includes/platform.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% assign selectedPlatform = page.url | remove: "/hubs/" | remove: "/" | remove: ".html" %}
{% assign platform = site.data.routes.platforms | where: "href", selectedPlatform | first %}
<div class="homepage">
<h1 class="title">{{ platform.hub-title }}</h1>

<p>{{ site.data.routes.home.description }}</p>

<div class="cards-group">
{% for hub in platform.hubs %}
{% include hub-card.html hub=hub platform=selectedPlatform %}
{% endfor %}
</div>

<div class="cards-group">
<!-- Concierge button anchored globally (rendered on narrow screens) -->
{% include floating-concierge-button.html id="floating-concierge-button-global" %}
</div>
</div>
7 changes: 0 additions & 7 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,5 @@ <h2 class="title with-margin">Didn't find what you were looking for?</h2>
{% include footer.html %}
</div>
</div>

<!-- Use hidden input to pass hubs data to main.js -->
<input
id="hubs-data"
type="hidden"
value={{ site.data.routes.hubs | map: 'href' | jsonify }}
/>
</body>
</html>
Loading
Loading