clockify / browser-extension

Clockify Browser Extension
https://clockify.me/chrome-time-tracking
BSD 3-Clause "New" or "Revised" License
183 stars 172 forks source link

Linear.app Integration #175

Closed alexknutson closed 2 years ago

alexknutson commented 2 years ago

As suggested here: https://forum.clockify.me/t/linear-app-chrome-extension-integration/1200/2, I'm working on adding integration for Linear.app but I ran into an issue. The linear.js is never injected into the DOM and I can't figure out why. I know my local setup is working correctly because I can run npm run compile.dev.chrome, refresh the chrome extension and I see console log statements that I've added to other integrations like Gitlab.

If I compare against some of the other integration PRs, I feel like what I have should be working. Can anyone point me in the right direction?

Thank you for your time!

strahinjaclockify commented 2 years ago

Hey Alex,

Thanks for your comment! So, you've:

  1. created Linear.js and
  2. added it to integrations.json
  3. can you please confirm if you've checked Linear in integration Options?

Please find below an example of how you can create StartButton, and let me know if you need any additional info, so I can pass it forward to the dev team.


clockifyButton.render('[aria-label="Edit issue"]:not(.clockify)', {observe: true}, function (elem) {
    const pathArray = window.location.pathname.split('/');
    console.log(pathArray);

    const description = $('span[placeholder="Issue title"]')
    const project = $$('header > div > span')[0];
    const container = elem;
    const link = clockifyButton.createButton({
        description: description ? description.textContent : '',
        projectName:  project ? project.textContent : ''
    });
    link.style.marginLeft = "10px";
    container.appendChild(link);    
});``
alexknutson commented 2 years ago

Hey Alex,

Thanks for your comment! So, you've:

  1. created Linear.js and
  2. added it to integrations.json
  3. can you please confirm if you've checked Linear in integration Options?

Thank you for the response @strahinjaclockify ! I can't really explain it, but after checking for Linear in integration Options (and confirming it was already enabled) everything seems to be working correctly. :confetti_ball:

I've flushed out the button logic and this is now ready for review!

https://user-images.githubusercontent.com/905228/146266512-f08d78ea-48f7-405c-bd1e-90bc3ce36da1.mp4

strahinjaclockify commented 2 years ago

Hi Alex, just to let you know, Linear.app integration will be available in the next update (hopefully by tomorrow), so stay tuned. Happy holidays! 🎅🏼