diff --git a/src/components/StatusWidget.tsx b/src/components/StatusWidget.tsx index 9be3e83ac..5fac83d6e 100644 --- a/src/components/StatusWidget.tsx +++ b/src/components/StatusWidget.tsx @@ -10,7 +10,8 @@ import { gitIcon } from '../style/icons'; import { badgeClass, statusAnimatedIconClass, - statusIconClass + statusIconClass, + currentBranchNameClass } from '../style/StatusWidget'; import { toolbarButtonClass } from '../style/Toolbar'; import { IGitExtension } from '../tokens'; @@ -27,6 +28,8 @@ export class StatusWidget extends ReactWidget { super(); this._model = model; this._trans = trans; + + this.addClass('jp-git-StatusWidget'); } /** @@ -41,39 +44,51 @@ export class StatusWidget extends ReactWidget { render(): JSX.Element { return ( - - {(_, needsCredentials) => ( - - this._showGitOperationDialog() - : undefined - } - title={ - needsCredentials - ? `Git: ${this._trans.__('credentials required')}` - : `Git: ${this._trans.__(this._status)}` - } - /> - - )} - + <> + + {(_, needsCredentials) => ( + + this._showGitOperationDialog() + : undefined + } + title={ + needsCredentials + ? `Git: ${this._trans.__('credentials required')}` + : `Git: ${this._trans.__(this._status)}` + } + /> + + )} + + + + {() => + this._model.currentBranch && ( + + {this._model.currentBranch.name} + + ) + } + + ); } diff --git a/src/index.ts b/src/index.ts index 9515ff1a3..2154982c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -149,6 +149,7 @@ async function activate( change: IChangedArgs ) => { gitExtension.pathRepository = change.newValue; + gitExtension.refreshBranch(); }; // Whenever the file browser path changes, sync the Git extension path diff --git a/src/style/StatusWidget.ts b/src/style/StatusWidget.ts index c00d0d4a8..088644b46 100644 --- a/src/style/StatusWidget.ts +++ b/src/style/StatusWidget.ts @@ -38,3 +38,8 @@ export const badgeClass = style({ } } }); + +export const currentBranchNameClass = style({ + fontSize: 'var(--jp-ui-font-size1)', + lineHeight: '100%' +}); diff --git a/style/base.css b/style/base.css index 7bbb128ca..0a1857c04 100644 --- a/style/base.css +++ b/style/base.css @@ -8,3 +8,4 @@ @import url('diff-nb.css'); @import url('diff-text.css'); @import url('variables.css'); +@import url('status-widget.css'); diff --git a/style/status-widget.css b/style/status-widget.css new file mode 100644 index 000000000..7f4e15908 --- /dev/null +++ b/style/status-widget.css @@ -0,0 +1,4 @@ +.jp-git-StatusWidget { + display: flex; + align-items: center; +} \ No newline at end of file