Skip to content

Commit

Permalink
DEV: Cleanup and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
OsamaSayegh committed Jan 12, 2024
1 parent e79478c commit ddc2d47
Show file tree
Hide file tree
Showing 14 changed files with 3,336 additions and 12 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint-theme");
11 changes: 11 additions & 0 deletions .github/workflows/discourse-theme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Discourse Theme

on:
push:
branches:
- main
pull_request:

jobs:
ci:
uses: discourse/.github/.github/workflows/discourse-theme.yml@v1
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.swp
*.swo
node_modules
.discourse-site
1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
1 change: 1 addition & 0 deletions .template-lintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Tabs are:

### Screenshots:

<img src="demo-bright-1.png" height="500">
<img src="https://github.com/OsamaSayegh/discourse-tab-bar-theme/assets/17474474/3a5d64c2-7ffb-45a3-bdf3-c9db39c52d7c" height="500">

<img src="demo-bright-2.png" height="300">
<img src="https://github.com/OsamaSayegh/discourse-tab-bar-theme/assets/17474474/f5fcbc64-f88d-448b-9c84-3b2f18a4cc1d" height="300">

<img src="demo-dark-1.png" height="300">
<img src="https://github.com/OsamaSayegh/discourse-tab-bar-theme/assets/17474474/a3548b72-7cd5-4698-b324-600c3bd11630" height="300">

<img src="demo-dark-2.png" height="500">
<img src="https://github.com/OsamaSayegh/discourse-tab-bar-theme/assets/17474474/9028589b-45ff-44aa-8bb9-c6b4cad219fb" height="500">

### Installation

Expand Down
Binary file removed demo-bright-1.png
Binary file not shown.
Binary file removed demo-bright-2.png
Binary file not shown.
Binary file removed demo-dark-1.png
Binary file not shown.
Binary file removed demo-dark-2.png
Binary file not shown.
7 changes: 5 additions & 2 deletions javascripts/d-tab-bar/initializers/init-tab-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function compareURLs(url1, url2) {
url1.replace(/(\?|#).*/g, "") === url2.replace(/(\?|#).*/g, "")
);
}
return false
return false;
}

export default {
Expand Down Expand Up @@ -76,7 +76,10 @@ export default {
if (!router.hasRoute(tab.destination)) {
return compareURLs(tab.destination, data.url);
} else {
return tab.destination === data.currentRouteName && compareURLs(routeToURL(router, tab.destination, user), data.url);
return (
tab.destination === data.currentRouteName &&
compareURLs(routeToURL(router, tab.destination, user), data.url)
);
}
});
if (tab) {
Expand Down
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "discourse-tab-bar",
"version": "0.0.1",
"repository": "https://github.com/OsamaSayegh/discourse-tab-bar-theme",
"author": "Osama Sayegh",
"license": "MIT",
"devDependencies": {
"@discourse/lint-configs": "^1.3.1",
"ember-template-lint": "^5.13.0",
"eslint": "^8.55.0",
"prettier": "^2.8.8"
}
}
8 changes: 4 additions & 4 deletions test/acceptance/tab-bar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";

acceptance("Tab bar component | Logged in users on mobile", function(needs) {
acceptance("Tab bar component | Logged in users on mobile", function (needs) {
needs.user();
needs.mobileView();

test("They see the bar on mobile", async function(assert) {
test("They see the bar on mobile", async function (assert) {
await visit("/latest");
assert.ok(exists(".d-tab-bar"));
});
});

acceptance("Tab bar component | Anon users on mobile", function(needs) {
acceptance("Tab bar component | Anon users on mobile", function (needs) {
needs.mobileView();

test("They don't see the bar on mobile", async function(assert) {
test("They don't see the bar on mobile", async function (assert) {
await visit("/latest");
assert.notOk(exists(".d-tab-bar"));
});
Expand Down
Loading

0 comments on commit ddc2d47

Please sign in to comment.