-
Notifications
You must be signed in to change notification settings - Fork 324
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 current branch name on status bar #1131
add current branch name on status bar #1131
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
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.
Thanks @BoscoCHW
Added current branch name on the status bar I managed to style it but I'm not sure how to center the text vertically. I should make the parent element a flex box and do align-item: center but I don't know how to select the parent class. Also I'm not sure how to change the padding of the git icon so that the text could be closer to the icon.
You can add a class in StatusWidget
(the parent element) within the constructor by adding the following line:
this.addClass('jp-git-StatusWidget')
Note: by design it is not possible to select parent of an element with CSS selectors.
Another issue is when navigate to another repo (change file directory), the branch name stays unless you click on the git extension icon on the left menu bar, which is a bit weird.
The default behavior is to not refresh the Git model status when the sidebar is hidden to avoid useless calls to the backend. You could solve this by forcing refreshing the branch calling GitExtension.refreshBranch when we set a new repository.
src/components/StatusWidget.tsx
Outdated
{this._model.currentBranch && ( | ||
<span className={currentBranchClass}> | ||
{this._model.currentBranch.name}* | ||
</span> | ||
)} |
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.
You should place this outside the UseSignal
component as it does not need to be refreshed if the credentials status of the extension changes.
But you should wrap it in another UseSignal
component to listen to this._model.headChanged
to react when the git head is changed.
I managed to style the status widget by adding a class like you suggested, but I was unable to reduce the right-padding of the git icon on the status bar because I'm afraid overriding the pre-set would lead to unexpected results. |
)} | ||
</UseSignal> | ||
|
||
<UseSignal signal={this._model.headChanged}> |
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.
👍
Thanks for the update @BoscoCHW
Let's discuss that on Thursday's meeting. |
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.
Let's remove the star next to the branch name. And it is good to go.
Co-authored-by: Frédéric Collonval <[email protected]>
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.
Thanks @BoscoCHW
Fixes #1100
@fcollonval
Added current branch name on the status bar
I managed to style it but I'm not sure how to center the text vertically.
I should make the parent element a flex box and do align-item: center but I don't know how to select the parent class.
Also I'm not sure how to change the padding of the git icon so that the text could be closer to the icon.
Another issue is when navigate to another repo (change file directory), the branch name stays unless you click on the git extension icon on the left menu bar, which is a bit weird.
Edited to link the related issue.