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

[No QA] DRY up LHN for HelpDot #12310

Merged
merged 10 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 1 addition & 42 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,48 +148,7 @@ In order to add a new Card button in the respective hub page ([send-money/index.
Then replace the article title accordingly (in this case replace the value `SmartScan` with the new article title) and add a link to the relative path of the article (in this case replace `./request-money/SmartScan` accordingly to the path of the new article file without the file extension).

## Add a new entry in the LHN page

There are 2 main components in the LHN page associated with the hub you're adding an article to:
1. Stage title anchor: which navigates the Stage title in the hub page and contains an unordered list of Article links.
2. Article links: which navigate to the corresponding article page.

```html
<!-- 1.Stage title anchor -->
<li><a href="#request-money">Request Money</a>
<!-- 2. Article links -->
<ul>
<li><a href="./request-money/SmartScan">SmartScan</a></li>
<li><a href="./request-money/AnotherArticle">Another Article</a></li>
<!-- More Article links here... -->
</ul>
</li>

<!-- More Stage title anchors here... -->
```

### Add a new Stage title anchor (optional)

Just add copy and paste the following HTML block in the corresponding navigation tree file (either for [Request Money](https://github.com/Expensify/App/blob/main/docs/_includes/request-money-lhn.html) or [Send Money](https://github.com/Expensify/App/blob/main/docs/_includes/send-money-lhn.html)):

```
<li><a href="#request-money">Request Money</a>
<!-- Article links will be here -->
</li>
```

Where `"#request-money"` is the ID of Stage title in the hub page (the same as in the example of the `Add a Stage title (optional)` section).

### Add a new Article link

Add the next HTML block inside of the corresponding Stage title anchor:

```
<ul>
<li><a href="./request-money/SmartScan">SmartScan</a></li>
</ul>
```

Where `./request-money/SmartScan` will be the relative path of the file name (exactly the same as in the `Add a Card button` example above).
To add a new entry to the LHN, simply update the _data/hubs.yml file with the new entry. Note that LHN "hubs" contain 1 or more stages, and stages can be either 1 article or multiple articles.

# How the site is deployed
This site is hosted on GitHub Pages. GitHub Pages has a built-in Jekyll integration, and we have it configured such that whenever code is merged to main, GitHub will automatically build the Jekyll site housed in the `/docs` directory and deploy it straight to production. The help site is publicly discoverable at https://help.expensify.com/
15 changes: 15 additions & 0 deletions docs/_data/hubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- href: send-money
title: Send money
stages:
- href: workspaces
title: Workspaces
articles:
- href: The-Free-Plan
title: The Free Plan
- href: request-money
title: Request money
- href: other
title: Other
stages:
- href: Account-Management
title: Account Management
23 changes: 0 additions & 23 deletions docs/_includes/home-lhn.html

This file was deleted.

48 changes: 48 additions & 0 deletions docs/_includes/lhn-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<ul class="lhn-items">
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
<li class="home-link">
{% if include.activeHub == "home" %}
<div class="selected">Home</div>
{% else %}
<a href="/main">Home</a>
{% endif %}
</li>

{% for hub in site.data.hubs %}
{% if hub.href == include.activeHub %}
<li>
<div class="icon-with-link selected">
<i class="fa-solid fa-angle-down icon"></i>
<span>{{ hub.title }}</span>
</div>
<ul class="nested-treeview">
{% for stage in hub.stages %}
<li>
<!-- Stages may have nested articles, or they may be just a single article. -->
{% if stage.articles %}
<a href="#{{ stage.href }}">{{ stage.title }}</a>
<ul>
{% for article in stage.articles %}
<li>
<a href="/articles/{{ hub.href }}/{{ article.href }}">
{{ article.title }}
</a>
</li>
{% endfor %}
</ul>
{% else %}
<a href="/articles/{{ hub.href }}/{{ stage.href }}">{{ stage.title }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</li>
{% else %}
<li>
<a href="/hubs/{{ hub.href }}" class="icon-with-link">
<i class="fa-solid fa-angle-right icon"></i>
{{ hub.title }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
34 changes: 0 additions & 34 deletions docs/_includes/other-lhn.html

This file was deleted.

31 changes: 0 additions & 31 deletions docs/_includes/request-money-lhn.html

This file was deleted.

40 changes: 0 additions & 40 deletions docs/_includes/send-money-lhn.html

This file was deleted.

118 changes: 56 additions & 62 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>Expensify Help</title>
Expand All @@ -16,82 +15,77 @@
<!-- SEO tags -->
{% seo %}
</head>

<body>

<!-- Show temporarily the "Coming Soon" page until the Expensify Help site is ready -->
{% if page.lhn_content == 'coming_soon' %}
{{ content }}
{% else %}
<div id="lhn">

<div id="lhn">
<div class="lhn-header">
<div id="header-button">
<i id="angle-up-icon" class="fa-solid fa-angle-up icon hide"></i>
<i id="bars-icon" class="fa-solid fa-bars icon"></i>
</div>
<img src="/assets/images/expensify-help.svg" class="logo" />
</div>

<div class="lhn-header">
<div id="header-button">
<i id="angle-up-icon" class="fa-solid fa-angle-up icon hide"></i>
<i id="bars-icon" class="fa-solid fa-bars icon"></i>
<!-- LHN content (Main navigation tree or Article TOC) -->
<div id="lhn-content">
{% case page.lhn_content %}
{% when "homepage" %}
{% include lhn-template.html activeHub="home" %}
{% when "request-money" %}
{% include lhn-template.html activeHub="request-money" %}
{% when "send-money" %}
{% include lhn-template.html activeHub="send-money" %}
{% when "other" %}
{% include lhn-template.html activeHub="other" %}
{% else %}
<div id="back-button" class="icon-with-link">
<i class="fa-solid fa-angle-left icon"></i>
<div class="link">Back</div>
</div>
{% if page.lhn_content == nil %}
<span class="in-this-article">In this article</span>
<div class="article-toc"></div>
{% endif %}
{% endcase %}
</div>
<img src="/assets/images/expensify-help.svg" class="logo" />
</div>

<!-- LHN content (Main navigation tree or Article TOC) -->
<div id="lhn-content">
{% case page.lhn_content %}
{% when "homepage" %}
{% include home-lhn.html %}
{% when "request-money" %}
{% include request-money-lhn.html %}
{% when "send-money" %}
{% include send-money-lhn.html %}
{% when "other" %}
{% include other-lhn.html %}
{% else %}
<div id="back-button" class="icon-with-link">
<i class="fa-solid fa-angle-left icon"></i>
<div class="link">Back</div>
</div>
{% if page.lhn_content == nil %}
<span class="in-this-article">In this article</span>
<div class="article-toc"></div>
{% endif %}
{% endcase %}
<!-- Concierge button anchored at the bottom of the LHN (rendered on wider screens) -->
{% include floating-concierge-button.html id="floating-concierge-button-lhn" %}
</div>

<div id="content-area">

<!-- Concierge button anchored at the bottom of the LHN (rendered on wider screens) -->
{% include floating-concierge-button.html id="floating-concierge-button-lhn" %}
</div>

<div id="content-area">

<!-- Article title (only shown in article pages) -->
{% if page.lhn_content == nil %}
<h1 class="title">
{{ page.name | remove: '.md' | split: "-" | join: " " }}
</h1>
<!-- Article title (only shown in article pages) -->
{% if page.lhn_content == nil %}
<h1 class="title">
{{ page.name | remove: '.md' | split: "-" | join: " " }}
</h1>

<div class="article-toc-content article">
{{ content }}
</div>
{% else %}
<div class="article-toc-content lhn">
{{ content }}
</div>
{% endif %}
<div class="article-toc-content article">
{{ content }}
</div>
{% else %}
<div class="article-toc-content lhn">
{{ content }}
</div>
{% endif %}

<!-- Concierge button at the bottom of the page -->
<a class="card get-help" href="{{ CONCIERGE_CHAT_URL }}" target="_blank">
<div class="body">
<h3 class="title">Didn't find what you were looking for?</h3>
<p class="description">Concierge is here to answer all your questions.</p>
</div>
<div class="submit-button">
<button class="success">Send a message</button>
</div>
</a>
</div>
<!-- Concierge button at the bottom of the page -->
<a class="card get-help" href="{{ CONCIERGE_CHAT_URL }}" target="_blank">
<div class="body">
<h3 class="title">Didn't find what you were looking for?</h3>
<p class="description">Concierge is here to answer all your questions.</p>
</div>
<div class="submit-button">
<button class="success">Send a message</button>
</div>
</a>
</div>
{% endif %}

</body>

</html>