Skip to content

Commit

Permalink
Use PageConfig info if git repository is the root folder (#1001)
Browse files Browse the repository at this point in the history
Fixes #992
  • Loading branch information
fcollonval authored Aug 4, 2021
1 parent 1c07f6f commit 9426de5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PathExt } from '@jupyterlab/coreutils';
import { PageConfig, PathExt } from '@jupyterlab/coreutils';
import {
caretDownIcon,
caretUpIcon,
Expand Down Expand Up @@ -228,25 +228,26 @@ export class Toolbar extends React.Component<IToolbarProps, IToolbarState> {
* @returns React element
*/
private _renderRepoMenu(): React.ReactElement {
const repositoryName =
PathExt.basename(
this.props.repository || PageConfig.getOption('serverRoot')
) || 'Jupyter Server Root';
return (
<div className={toolbarMenuWrapperClass}>
<button
disabled
className={toolbarMenuButtonClass}
title={this.props.trans.__(
'Current repository: %1',
'/' + this.props.repository
PageConfig.getOption('serverRoot') + '/' + this.props.repository
)}
>
<desktopIcon.react className={toolbarMenuButtonIconClass} />
<div className={toolbarMenuButtonTitleWrapperClass}>
<p className={toolbarMenuButtonTitleClass}>
{' '}
{this.props.trans.__('Current Repository')}{' '}
</p>
<p className={toolbarMenuButtonSubtitleClass}>
{PathExt.basename(this.props.repository) || '/'}
{this.props.trans.__('Current Repository')}
</p>
<p className={toolbarMenuButtonSubtitleClass}>{repositoryName}</p>
</div>
</button>
</div>
Expand Down

0 comments on commit 9426de5

Please sign in to comment.