Skip to content
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

feat: add Repo Activity Racing Bar #696

Merged
merged 10 commits into from
Aug 13, 2023

Conversation

andyhuang18
Copy link
Collaborator

Brief Information

This pull request is in the type of (more info about types):

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • test

Related issues (all available keywords):

Details

I have laid a foundation for this feature, which can be viewed in the option list. But the actual functionality has not yet been implemented. I'll follow up as soon as I have time!

image

Checklist

Others

@menbotics menbotics bot added the kind/feature Category issues or prs related to feature request. label Jun 14, 2023
@andyhuang18
Copy link
Collaborator Author

The function of the main body has been initially realized, and the following is a demonstration video. I have not modified the text on the right.

2023-07-09.21-22-46.mp4

@tyn1998
Copy link
Member

tyn1998 commented Jul 15, 2023

Hey @andyhuang18, the animation in your demo is very laggy, do you know why?

@andyhuang18
Copy link
Collaborator Author

I changed the updateFrequency to 4000. Maybe updateFrequency should be adjusted to an appropriate value.

@andyhuang18 andyhuang18 marked this pull request as ready for review July 17, 2023 08:42
@andyhuang18
Copy link
Collaborator Author

I have successfully completed the development of this feature, and the replay function is also available. In the future, other new functions can be added, such as positioning time, etc. 😄

@wxharry
Copy link
Collaborator

wxharry commented Jul 18, 2023

I have successfully completed the development of this feature, and the replay function is also available. In the future, other new functions can be added, such as positioning time, etc. 😄

Nicely done! I just tested your work ant it is amazing! It moves smoothly and looks awesome. Here is some advice on this:

  1. style change. To make style identical, would you mind wrapping up chart with a div container with hypertrons-crx-border like the other two graphs in the perceptor tab.
  2. layout change. The Period: 90 days is meaningless here. I think we could move that replay button to that place and also change the style of the button a little to make it more natural. What do you say?

Again, thanks for your incredible work! 👍

@andyhuang18
Copy link
Collaborator Author

Hi~ @wxharry .Thanks for the great suggestions! I have modified the styles of the chart and replay. Any suggestions for a style like this?
As for the position of replay,I think it would be reasonable to put the replay button below the chart, and maybe add other buttons to manipulate the chart in the future~

image

@tyn1998
Copy link
Member

tyn1998 commented Jul 18, 2023

Hey @andyhuang18, thanks for your hard work!

one

I pulled your code and tested it with my hands, finding that the feature occasionally cannot be displayed with the following error output in the console:

image

I have not found a way to replicate the bug yet. But I guess it is possibly related to feature loading timing.

two

As for the position of replay,I think it would be reasonable to put the replay button below the chart, and maybe add other buttons to manipulate the chart in the future~

Please give the Replay button a new home:

image

The displacement of the button may require you to learn and use more skills in HTML, CSS, React. Good luck :)

three

I have not read the code changes yet. I assume they will be reviewed in days.

@andyhuang18 andyhuang18 changed the title feat: added feature to option list but didn't implement it feat: implement Repo Activity Racing Bar Jul 19, 2023
@wxharry
Copy link
Collaborator

wxharry commented Jul 19, 2023

Hi @andyhuang18, just change the to "feat: add Repo Activity Racing Bar". You are not just implementing this, you are adding the entire feature in this pr. 😄

@andyhuang18 andyhuang18 changed the title feat: implement Repo Activity Racing Bar feat: add Repo Activity Racing Bar Jul 19, 2023
feat: initial implementation of activity racing bar(need to be modified)

feat: initial implementation of activity racing bar(need to be modified v1)

feat: initial implementation of activity racing bar(need to be modified v2)

feat: implementation of activity racing bar

feat: change the style of chart and button
@andyhuang18 andyhuang18 force-pushed the feat/activity-racing-bar branch from 804e2a7 to 7aedbc3 Compare August 10, 2023 07:22
@wxharry
Copy link
Collaborator

wxharry commented Aug 12, 2023

Hi, @andyhuang18 . There are two style changes required for this PR:

  1. add a 15px padding to the border or a 15px margin to the racing bar. This is because some username is long and the name is at the edge
  2. move the replay button to the top-right corner. I understand your concern about adding more features, but we should move the button for now. The top-right corner is a place for user interaction which is used in the insight tab at Github.

Thanks for your contributions and feel free to leave comments or dm me~

@andyhuang18
Copy link
Collaborator Author

OK! Thanks harry for the suggestion! I am modifying my code. Commit can be done today. 😆

@andyhuang18
Copy link
Collaborator Author

Hi~ @tyn1998 @wxharry I've done all the development of this feature so far.
A brief description of the last few updates:

  • Moved the Replay button to the upper right corner of the interface, and modified the style to match the GitHub button.

image

  • Provides i18n support.
  • Since I am using the webstorm editor, I updated gitignore. In the future, updates in the .idea folder will be ignored by git.

PS: I didn't know enough about the update mode of echart before, so [ECharts] Instance ec_1691746561518 has been disposed will always be prompted in the console of the browser during replay. At present, this problem has been solved, and the reason is: because I achieved the purpose of replay by re-creating the echart instance, the first instance has been dispose after re-creation, and the second hook function is still updating the data of the first instance chart , so an error will be reported. The solution is to first determine whether an instance exists when updating data.

If you have any additional suggestions, please let me know, thank you~

@wxharry
Copy link
Collaborator

wxharry commented Aug 12, 2023

Hi~ @tyn1998 @wxharry I've done all the development of this feature so far. A brief description of the last few updates:
...
If you have any additional suggestions, please let me know, thank you~

Hey! Thanks again for your contributions. This feature is really awesome! I have reviewed your code and left a comment. It won't take long to resolve and I think this feature is ready to merge. I am so excited to see the racing bar released.

@andyhuang18
Copy link
Collaborator Author

Hi~ @tyn1998 @wxharry I've done all the development of this feature so far. A brief description of the last few updates:
...
If you have any additional suggestions, please let me know, thank you~

Hey! Thanks again for your contributions. This feature is really awesome! I have reviewed your code and left a comment. It won't take long to resolve and I think this feature is ready to merge. I am so excited to see the racing bar released.

Hi @wxharry. Where is the problem? Seems like I didn't see your comment. 🤔

Copy link
Member

@tyn1998 tyn1998 left a comment

Choose a reason for hiding this comment

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

Hi @andyhuang18, I have pushed several commits to improve the code.

Your contribution is great, thank you very much!

Comment on lines +187 to +190
// clear timer if user replay the chart before it finishes
if (timer) {
clearTimeout(timer);
}
Copy link
Member

Choose a reason for hiding this comment

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

Timer should be cleared.

Comment on lines +129 to +137
const playNext = () => {
updateMonth(instance, data, months[i]);
i++;
if (i < months.length) {
timer = setTimeout(playNext, updateFrequency);
}
};

playNext();
Copy link
Member

Choose a reason for hiding this comment

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

another way to play

Comment on lines +108 to +113
// @ts-ignore
option.yAxis.axisLabel.rich = rich;
// @ts-ignore
option.series[0].data = data[month];
// @ts-ignore
option.graphic.elements[0].style.text = month;
Copy link
Member

Choose a reason for hiding this comment

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

// @ts-ignore is like xxx: any, we should fix them all one day :D

Comment on lines +115 to +121
// it seems that hidden bars are also rendered, so when each setOption merge more data into the chart,
// the fps goes down. So we use notMerge to avoid merging data. But this disables the xAxis animation.
// Hope we can find a better solution.
instance.setOption(option, {
notMerge: true,
});
};
Copy link
Member

Choose a reason for hiding this comment

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

microsoft/vscode has a lot of contributors, which slows down the animation when played at ~2018 or so.

image

notMerge: true is the best resolution I can give for now.

@tyn1998
Copy link
Member

tyn1998 commented Aug 13, 2023

Hi @wxharry, please take some time to review my recent commits to this branch. If you think the PR is ready to go, just /approve it :)

@tyn1998
Copy link
Member

tyn1998 commented Aug 13, 2023

Seems like I didn't see your comment. 🤔

+1

})(i);
}

// @ts-ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed there are many directive in this part, I think it would be better if we could remove some of these. The @ts-ignore could be convenient but there are too many of them which may ignore type errors. Please confirm they are necessary. Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, @ts-ignore and any should be avoided with best effort. In my commits, I removed some of them, but still left some others. My time is limited🤣 .

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can have Andy fixing this later as a patch. I will merge this feature anyway but you can still improve your work. @andyhuang18 What do you say?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK

@wxharry
Copy link
Collaborator

wxharry commented Aug 13, 2023

There is an inconsistence when open perceptor tab in different repos. For our repo, the racing bar is the first section, but in repos like vscode, it is the last one. It is not strongly related to this feature, so I will create a new issue. This feature looks good to me. Thanks @andyhuang18 @tyn1998 for your contributions!

/approve

@menbotics menbotics bot added the pull/approved If a pull is approved, it will be automatically merged label Aug 13, 2023
@menbotics menbotics bot merged commit 2e5abf4 into hypertrons:master Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Category issues or prs related to feature request. pull/approved If a pull is approved, it will be automatically merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] activity-racing-bars
3 participants