-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wakatime integration #2923
Add Wakatime integration #2923
Conversation
…ge from Markdown to Snippet BoostIO#2810
Can you fix the conflict? And also check if the wakatime-cli is installed on the user system? Maybe display a small alert saying, the wakatime-cli is not found, please install it. |
Sure, I will do this weekend. |
@LuisReinoso ping:) Do you still interested in this PR? |
Oh oh oh.. I was forgot it.. Yes |
Haha no worries, glad you can contribute this feature 👍 |
@LuisReinoso ping |
@LuisReinoso ping! |
@LuisReinoso The CI fetch the original repo first the check out to the branch that contain your PR: I tried to checkout to your PR and my lint also result same as on CI Which is very strange, have you run lint on the right branch? or try updating lint by delete |
Thanks! I will tried again. Maybe some cache. |
I'm back I removed node_modules and installed again via yarn and it works.. Thanks..! |
Please review my changes. ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix your code and also provide i18n
for this please?
@@ -1,6 +1,5 @@ | |||
{ | |||
"trailingComma": "es5", | |||
"tabWidth": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why you changed this setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you remember that I had an issue on CI step.?
Now it has the same as master branch:
https://github.com/BoostIO/Boostnote/blob/master/.prettierrc
{
"singleQuote": true,
"semi": false,
"jsxSingleQuote": true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay
} | ||
|
||
checkPluginsRequirements() { | ||
this.checkWakatimePluginRequirement() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method online call one method, why can't we directly call checkWakatimePluginRequirement
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking on this page is named plugins so on future new user could use this function to check if their developed plugins has all requirements. But I will remove it.
isWrite, | ||
hasFileChanges, | ||
isFileChange | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last 3 variable is all booleans. I suggest we change to object type for more clarification. For example, if we change this function to:
function sendWakatimeHeartBeat(storagePath, noteKey, storageName, {isWrite, hasFileChanges, isFileChange}) {
...
}
We can keep the code inside the same but when we call this function, we will call it like this:
sendWakatimeHeartBeat(
storagePath,
noteKey,
storageName,
{ isWrite: true, hasFileChanges: false, isFileChange: true}
)
browser/components/CodeEditor.js
Outdated
false, | ||
false, | ||
false | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seem to be a bit repeative. Surely we can improve the quality of this code by doing something similar to this:
if (this.props.onChange) {
this.props.onChange(editor)
}
const isWrite = !!this.props.onChange;
const hasFileChanges = isWrite;
if (storage) {
sendWakatimeHeartBeat(
storage.path,
noteKey,
storage.name,
isWrite,
hasFileChanges,
false
)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE, It was very old code XD
Please review my new changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change your code and also add support translation for other languages too?
|
||
checkWakatimePluginRequirement() { | ||
const { wakatime } = this.state.config | ||
if (wakatime.isActive && !commandExists('wakatime-cli')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong command name 😄 Should be like this:
if (wakatime.isActive && !commandExists('wakatime-cli')) { | |
if (wakatime.isActive && !commandExists('wakatime')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
<div styleName='root'> | ||
<div styleName='group'> | ||
<div styleName='group-header'>{i18n.__('Plugins')}</div> | ||
<div styleName='group-section'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Wakatime isn't the only plugin that we support so it's better to create a section for Wakatime in this plugin setting page. Just a simple section with title Wakatime and bellow is a check box saying enable wakatime? and below it is the text box for wakatime key. If we plan to only have 1 plugin then this plugin page should change the name to Wakatime which I think will be worst cus harder to change when we want to support more plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
@LuisReinoso ping |
NOTE: Just a simple section with title Wakatime and bellow is a check box saying enable wakatime? and below it is the text box for wakatime key.
Please review my new changes :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERY COOL! I'll approve this. Thanks for this PR 😄
Description
Add Wakatime support to track time spend writing in Boostnote.
Result on wakatime.
Issue fixed
#2810
Type of changes
Checklist: