Skip to content

Commit

Permalink
fix(clickup): Improve description auto-pick
Browse files Browse the repository at this point in the history
Closes #2170
  • Loading branch information
nunofmn authored and Alissonsz committed Aug 28, 2023
1 parent d2e8363 commit c84cd90
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/content/clickup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
togglbutton.render('#timeTrackingItem:not(.toggl)', { observe: true }, function (
elem
) {
const description = $('.task-name', elem).textContent;
const project = $('.space-name', elem).textContent;

const descriptionParts = description?.split('#')
const description = document.querySelector('title').textContent.split('|')[0];
const taskID = document.querySelector('div[role="dialog"]').getAttribute('data-task-id');

const formattedDescription = descriptionParts?.reduce((acc, value, index) => {
if (index === descriptionParts.length - 1)
return acc += `#${value.trim()}`
else
return acc += `#${value}`
}, '')
const project = elem.querySelector('.space-name').textContent;

const link = togglbutton.createTimerLink({
className: 'clickup',
description: formattedDescription,
description: `${description} - #${taskID}`,
projectName: project,
buttonType: 'minimal'
});
Expand Down

0 comments on commit c84cd90

Please sign in to comment.