Skip to content

feat: add timed docs to top nav #570

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
18c6207
feat: add timed docs to top nav
MitanOmar Jan 20, 2025
39a17d1
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Feb 14, 2025
fb6ad61
refactor(docs-service): use router name instate of uri
MitanOmar Mar 20, 2025
1555471
fix(docs-service-test): lint issue
MitanOmar Mar 20, 2025
df2f480
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Mar 20, 2025
fb87afa
fix(docs-service-test): linting issue
MitanOmar Mar 20, 2025
47159f4
refactor(docs-service): move the base domain to env
MitanOmar Mar 20, 2025
d342948
fix(docs-service): lint
MitanOmar Mar 20, 2025
9f3dbe7
fix(docs-service): nav icon
MitanOmar Mar 20, 2025
593b203
test(docs-service): write acceptance test for docs service
MitanOmar Mar 20, 2025
b81e0ff
feat: add timed docs to the tour
MitanOmar Mar 21, 2025
4c88f97
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Mar 24, 2025
f82a919
refactor(docs-service): update docs variable name with URL fixing
MitanOmar Mar 24, 2025
933b1cd
refactor: better text, and tests all routes
MitanOmar Apr 9, 2025
378d6e4
refactor: the docs nav link icon to `circle-question`
MitanOmar Apr 10, 2025
8cb8516
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Apr 10, 2025
90cd9d2
refactor: delete unuseful tests
MitanOmar Apr 10, 2025
f8685cb
refactor: use only docs icon instate of `docs` word
MitanOmar Apr 10, 2025
8e63b56
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Apr 23, 2025
d928843
refactor: implement the change requests
MitanOmar Apr 23, 2025
d430841
Merge branch 'main' into Add-Timed-Docs-To-Top-Nav
MitanOmar Apr 25, 2025
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
11 changes: 11 additions & 0 deletions frontend/app/components/topnav.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@
</Topnav::List>
<Topnav::List class="md:ml-auto md:border-t-0">
<ReportReviewWarning @class="max-md:hidden" />
<Topnav::ListItem>
<Topnav::LinkTo
@onClick={{fn (mut this.expand) false}}
title="Timed Documentation Of This Page"
href={{this.docs.docsEndpoint}}
target="_blank"
>
<FaIcon @icon="book" />
Docs
</Topnav::LinkTo>
</Topnav::ListItem>
<Topnav::ListItem>
<Topnav::LinkTo
@onClick={{fn (mut this.expand) false}}
Expand Down
2 changes: 2 additions & 0 deletions frontend/app/components/topnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class Topnav extends Component {

@service media;

@service docs;

@tracked expand = false;

get navMobile() {
Expand Down
31 changes: 31 additions & 0 deletions frontend/app/services/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Service, { service } from "@ember/service";

export default class DocsService extends Service {
timedDocsURL = "https://timed.dev/docs/";
@service router;

docsUrlMatch = {
// index.name: DocsUrl
"index.attendances": "tracking/attendances",
"index.reports": "tracking/timesheet",
"analysis.index": "analysis",
statistics: "statistics",
projects: "projects",
"users.index": "users",
"users.edit.index": "users",
"index.activities.index": "tracking/activities",
};

get docsEndpoint() {
return this.timedDocsURL + this.getDocsURL;
}

get getDocsURL() {
for (const timedRouterName of Object.keys(this.docsUrlMatch)) {
if (this.router.currentRouteName === timedRouterName) {
return this.docsUrlMatch[timedRouterName];
}
}
return "";
}
}
2 changes: 1 addition & 1 deletion frontend/tests/acceptance/external-employee-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module("Acceptance | external employee", function (hooks) {
test("can only view tracking in top navigation", async function (assert) {
await visit("/");

assert.dom("section > ul > li").exists({ count: 3 });
assert.dom("section > ul > li").exists({ count: 4 });
assert.dom("section > ul > li").includesText("Tracking");
});

Expand Down
12 changes: 12 additions & 0 deletions frontend/tests/unit/services/docs-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { module, test } from "qunit";
import { setupTest } from "timed/tests/helpers";

module("Unit | Service | docs", function (hooks) {
setupTest(hooks);

// TODO: Replace this with your real tests.
test("it exists", function (assert) {
const service = this.owner.lookup("service:docs");
assert.ok(service);
});
});
Loading