Skip to content

Commit

Permalink
fix(autotrack): Fix for asana zendesk todoist
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey committed Oct 7, 2024
1 parent 957f3c1 commit 7805c42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/content/asana.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ togglbutton.render('.TaskPane:not(.toggl)', { observe: true }, (taskPaneEl) => {
projectName: projectSelector,
buttonType: 'minimal',
tags: tagsSelector,
autoTrackable: true,
})

const injectContainer = taskPaneEl.querySelector(
Expand Down
6 changes: 4 additions & 2 deletions src/content/todoist.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ togglbutton.render(
projectName: project,
buttonType: "minimal",
tags: tags,
container: '[data-testid="button-container"]'
container: '[data-testid="button-container"]',
autoTrackable: true
});

const existingTogglWrapper = $('.toggl-button-todoist-wrapper');
Expand Down Expand Up @@ -71,7 +72,8 @@ togglbutton.render('[data-item-detail-root] [data-item-actions-root]:not(.toggl)
description: description,
projectName: project,
tags: tags,
buttonType: 'minimal'
buttonType: 'minimal',
autoTrackable: true
});

const wrapper = document.createElement('div');
Expand Down
14 changes: 11 additions & 3 deletions src/content/zendesk.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ setTimeout(() => {
'.ticket-panes-grid-layout.active',
{ observe: true },
function (elem) {
if (elem.querySelector('.toggl-button')) return
const elements = document.querySelectorAll('.ticket-panes-grid-layout:not(.active) .toggl-button')
if(elements.length > 0) {
elements.forEach(element => element.remove())
}
const activeButtonExists = document.querySelector('.ticket-panes-grid-layout.active .toggl-button')
if(activeButtonExists) return

let description;
const projectName = $('title').textContent;

Expand All @@ -108,12 +114,14 @@ setTimeout(() => {
const link = togglbutton.createTimerLink({
className: 'zendesk-button',
description: titleFunc,
projectName: projectName && projectName.split(' – ').shift()
projectName: projectName && projectName.split(' – ').shift(),
buttonType: 'minimal'
});


elem.querySelector('[data-support-suite-trial-onboarding-id="conversationPane"] > div:nth-child(1)').lastChild.prepend(link);
}
},
''
);
}, 1000);

Expand Down

0 comments on commit 7805c42

Please sign in to comment.