Skip to content

Add Clockify extension - #165

Merged
mattisssa merged 20 commits into
raycast:mainfrom
ismamz:main
Oct 25, 2021
Merged

mattisssa merged 20 commits into
raycast:mainfrom
ismamz:main

Conversation

@ismamz

@ismamz ismamz commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Description

Raycast extension to control Clockify time tracker.

Type of change

  • New extension

Screencast

01

02

Checklist

@pernielsentikaer

Copy link
Copy Markdown
Contributor

There is a few things that needs to be addressed before this extension is ready to be merged

  • At the setup screen, its not possible to submit the API Key by pressing Enter

  • If a wrong API Key is added then there is no way to go back leaving the user stuck here

sdMxj2GnhjwEjohl

  • The extension needs to follow the defined naming convention

  • Sometimes when starting a timer and opening Clockify extension I get the below error and there is no way to continue without reinstall extension

exNHrhuRkFabXD2J

Other things to take into consideration

  • Shouldn't it be possible to start a timer without a project now that its possible from the Clockify interface
  • If a timer is started there is no way to "see that its running"
  • When a timer is stopped its not added to the list before reopening the extension

@ismamz

ismamz commented Oct 21, 2021

Copy link
Copy Markdown
Contributor Author

Hi @pernielsentikaer!

  1. I believe that is a Raycast issue (same happens in Vercel extension). When you have a form control focused, pressing "enter" doesn't trigger the main action.
  2. I'm not sure how to fix that. Once the token is cleared, Raycast doesn't show the setup screen again. Is there any way to show that screen via API?
  3. "Clockify Controls" is ok?
  4. I will fix it.
  5. The problem is that you need to add a project to be able to stop the timer. I will consider it.
  6. There is a little change in the icon (Icon.Clock when is running, Icon.Circle otherwise)
  7. I will fix it.

@pernielsentikaer pernielsentikaer left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the update, looking forward to trying it out 📦

I'll give your extension a new run in a few hours, just found some more strings that need to follow the guidelines.

EDIT: Just had a few minutes left so I gave it a quick run but I'm not able to get any further than the API Key screen before it gets an error.

HiS7iGxAnzg9J9X7.mp4

Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
@ismamz

ismamz commented Oct 22, 2021

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer I've open an issue here to show preferences screen manually from the extension, meanwhile I've added a workaround to handle invalid API Key.

Let me know if it works for you now.

@pernielsentikaer

pernielsentikaer commented Oct 22, 2021 •

Copy link
Copy Markdown
Contributor

Thanks for the update @ismamz 💣

The new way you're handling the wrong API Key is much better, I do think that you should remove the "Go Back" button since escape has that purpose already.

3Q5R6IsuxkBllpkm

After correcting the API key it seems like its accepting as it should, but now I get this screen instead

bZL0NrhrXjQ9EwI1

Stack trace

2021-10-22 19:57:51.059 F  Raycast[11539:2240b9] [com.raycast.extensions.clockify-controls:index] (node:11542) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
2021-10-22 19:57:51.208 F  Raycast[11539:223fb2] [com.raycast.extensions.clockify-controls:index] The above error occurred in the <Main> component:

    at null.Main (/Users/pernielsentikaer/Desktop/extensions/extensions/clockify/src/index.tsx:25:36)
    at ray-navigation-stack
    at Mc (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:6684)
    at oa (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:6789)
    at Bo (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:5905)
    at vp (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:5559)
    at ray-root
    at Ns (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:6209)

React will try to recreate this component tree from scratch using the error boundary you provided, InternalErrorBoundary.
2021-10-22 19:57:51.218 F  Raycast[11539:2240a8] [com.raycast.extensions.clockify-controls:index] 
TypeError: (intermediate value) is not iterable

Main:index.tsx:25:36

---
22: 
23: export default function Main() {
24:   // const isValidToken = useToken();
25:   const { config, isValidToken } = useConfig();
26:   const [entries, setEntries] = useState<TimeEntry[]>([]);
27:   const [isLoading, setIsLoading] = useState<boolean>(false);
28:   const { push } = useNavigation();
---

    at ray-navigation-stack
Mc:index.js:5:6684
oa:index.js:5:6789
Bo:index.js:5:5905
vp:index.js:5:5559
    at ray-root
Ns:index.js:5:6209

I checked the code and see that its validating on the right key length - if changing one character I get to the next screen if I then click start I get this

1wbVhjeSCaMbi1JW

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some suggestions that follow the Naming convention

Comment thread extensions/clockify/package.json Resolved
Comment thread extensions/clockify/package.json Resolved
@PitNikola PitNikola added the new extension Label for PRs with new extensions label Oct 22, 2021
@ismamz

ismamz commented Oct 22, 2021

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer Sorry, but I can't reproduce that error. Could you please tell me step by step how to get there?

@pernielsentikaer

Copy link
Copy Markdown
Contributor

Hi @ismamz 💪

Still having the crash and I'm not sure what's causing it, please see the attached video to see step by step.

Zgo4k8OOYJtD7d9L.mp4

Hope it helps you understand what's going wrong

@ismamz

ismamz commented Oct 23, 2021

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer I still can't reproduce it but I've added some extra validations that may help. Hope it works now!

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @ismamz 💪 It's almost ready to launch 🚀

Finally found what's causing the error and made sense why you didn't have the same problem - it's based on the data I have in the Clockify account I've created to test.

Besides the suggestions, there is something with the "Manual" section that does not function very well for my eyes but can't tell you what it is.

Maybe remove "Stop current" now that it's possible to stop directly from the entry and then just have "Start Timer"

Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
@ismamz

ismamz commented Oct 23, 2021

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer Great suggestion!

I've also added a time elapsed counter.

image

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid work @ismamz 💯 💪

Just a few last suggestions left and we're ready to launch 🚀

Just ping me when you're done and lets ship it 🚢

Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
Comment thread extensions/clockify/src/index.tsx Resolved
Co-authored-by: Per Nielsen Tikær <[email protected]>
ismamz and others added 2 commits October 25, 2021 09:55
@ismamz

ismamz commented Oct 25, 2021

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer Done! Thank you very much for the support! 🙏