Skip to content

Commit

Permalink
Replace Canny with Nolt
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdias committed Oct 21, 2020
1 parent 2005649 commit 98aab24
Show file tree
Hide file tree
Showing 26 changed files with 1,801 additions and 1,438 deletions.
29 changes: 0 additions & 29 deletions app/components/canny-feedback-script.js

This file was deleted.

13 changes: 13 additions & 0 deletions app/components/nolt-feedback-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint no-undef: "off" */
import Component from '@ember/component';

export default Component.extend({
didInsertElement() {
this._super(...arguments);

nolt('init', {
selector: '.nolt-button',
url: 'https://kitsu.nolt.io/',
});
},
});
5 changes: 5 additions & 0 deletions app/gql/queries/noltToken.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
query noltToken {
noltToken{
token
}
}
15 changes: 7 additions & 8 deletions app/initializers/browser-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ function adwords() {
}

/**
* Inject Canny's SDK script into the `head` on initialization.
* Inject Nolt's SDK script into the `head` on initialization.
*/
function canny() {
const c = function() {
c.q.push(arguments);
function nolt() {
window.noltQueue = window.noltQueue || [];
window.nolt = function() {
noltQueue.push(arguments); /* eslint no-undef: "off" */
};
c.q = [];
window.Canny = c;
injectScript('https://canny.io/sdk.js').catch(() => {});
injectScript('https://cdn.nolt.io/widgets.js').catch(() => {});
}

/**
Expand Down Expand Up @@ -61,7 +60,7 @@ export function initialize() {

// Inject scripts
adwords();
canny();
nolt();
onesignal();
}

Expand Down
13 changes: 0 additions & 13 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,6 @@ RouterInstance.map(function() {
this.route('account');
});

this.route('feedback', function() {
this.route('bugs');
this.route('bugs-anything', { path: '/bugs/*path' });
this.route('feature-requests');
this.route('feature-requests-anything', { path: '/feature-requests/*path' });
this.route('database-requests');
this.route('database-requests-anything', { path: '/database-requests/*path' });
this.route('mobile-bugs');
this.route('mobile-bugs-anything', { path: '/mobile-bugs/*path' });
this.route('mobile-features');
this.route('mobile-features-anything', { path: '/mobile-features/*path' });
});

this.route('admin', function() {
this.route('reports', function() {
this.route('index', { path: '/open' });
Expand Down
14 changes: 14 additions & 0 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import moment from 'moment';
import preferredLocale from 'preferred-locale';
import LANGUAGES from 'client/utils/languages';
import config from 'client/config/environment';
import noltTokenQuery from 'client/gql/queries/noltToken';

export default Route.extend(ApplicationRouteMixin, {
features: service(),
Expand All @@ -17,6 +18,7 @@ export default Route.extend(ApplicationRouteMixin, {
metrics: service(),
moment: service(),
raven: service(),
apollo: service(),
cache: storageFor('last-used'),
local: storageFor('local-cache'),

Expand Down Expand Up @@ -149,6 +151,9 @@ export default Route.extend(ApplicationRouteMixin, {
this._loadTheme(user);
get(this, 'moment').changeTimeZone(get(user, 'timeZone') || moment.tz.guess());

// nolt
this._setupNolt();

// notifications
this._registerNotifications();

Expand All @@ -171,6 +176,15 @@ export default Route.extend(ApplicationRouteMixin, {
});
},

_setupNolt() {
get(this, 'apollo').query({ query: noltTokenQuery }, 'noltToken').then(({ token }) => {
// eslint-disable-next-line no-undef
nolt('identify', {
jwt: token,
});
}).catch(() => {});
},

_registerNotifications() {
if (get(this, 'session.account.feedCompleted')) {
window.OneSignal.push(() => {
Expand Down
20 changes: 0 additions & 20 deletions app/routes/feedback.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/routes/feedback/bugs-anything.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/routes/feedback/bugs.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/routes/feedback/database-requests-anything.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/routes/feedback/database-requests.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/routes/feedback/feature-requests-anything.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/routes/feedback/feature-requests.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/routes/feedback/mobile-bugs-anything.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/routes/feedback/mobile-bugs.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/routes/feedback/mobile-features-anything.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/routes/feedback/mobile-features.js

This file was deleted.

13 changes: 4 additions & 9 deletions app/templates/components/application/site-header.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{nolt-feedback-script}}

<nav id="kitsu-navbar" class="navbar navbar-fixed-top navbar-light primary-nav" role="navigation">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -88,17 +90,10 @@
{{link-to (t "header.groups") "groups.index" class="nav-link"}}
</li>
{{! Feedback}}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle {{if isFeedbackRoute "active"}}" href="#" data-toggle="dropdown" data-href-to-ignore=true>
<li class="nav-item nolt-button">
<a class="nav-link" href="#" data-href-to-ignore=true>
{{t "header.feedback"}}
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href={{href-to "feedback.bugs"}}>{{t "feedback.bugs"}}</a>
<a class="dropdown-item" href={{href-to "feedback.feature-requests"}}>{{t "feedback.features"}}</a>
<a class="dropdown-item" href={{href-to "feedback.database-requests"}}>{{t "feedback.database"}}</a>
<a class="dropdown-item" href={{href-to "feedback.mobile-bugs"}}>{{t "feedback.mobile-bugs"}}</a>
<a class="dropdown-item" href={{href-to "feedback.mobile-features"}}>{{t "feedback.mobile-features"}}</a>
</div>
</li>
</ul>
</div>
Expand Down
46 changes: 0 additions & 46 deletions app/templates/feedback.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions app/templates/feedback/bugs.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions app/templates/feedback/database-requests.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions app/templates/feedback/feature-requests.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions app/templates/feedback/mobile-bugs.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions app/templates/feedback/mobile-features.hbs

This file was deleted.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"cropperjs": "~1.5.6",
"d3": "~5.15.0",
"ember-ajax": "5.0.0",
"ember-apollo-client": "~2.0.0",
"ember-apollo-client": "2.0.0-beta.3",
"ember-auto-import": "^1.2.19",
"ember-basic-dropdown": "~1.1.2",
"ember-batcher": "~3.0.0",
Expand Down Expand Up @@ -138,5 +138,8 @@
},
"resolutions": {
"ember-power-select/ember-concurrency": "0.8.27"
},
"dependencies": {
"@apollo/client": "^3.1.1"
}
}
Loading

0 comments on commit 98aab24

Please sign in to comment.