Skip to content

Commit d3bd470

Browse files
authored
Fix selection in new branch dialog (#996)
Fix string to be translated not captured
1 parent 02c6d9a commit d3bd470

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/components/NewBranchDialog.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ import {
3535
} from '../style/NewBranchDialog';
3636
import { Git, IGitExtension, Level } from '../tokens';
3737

38-
const BRANCH_DESC = {
39-
current:
40-
'The current branch. Pick this if you want to build on work done in this branch.',
41-
default:
42-
'The default branch. Pick this if you want to start fresh from the default branch.'
43-
};
44-
4538
const ITEM_HEIGHT = 27.5; // HTML element height for a single branch
4639
const CURRENT_BRANCH_HEIGHT = 66.5; // HTML element height for the current branch with description
4740
const HEIGHT = 200; // HTML element height for the branches list
@@ -245,7 +238,9 @@ export class NewBranchDialog extends React.Component<
245238
itemKey={(index, data) => data[index].name}
246239
itemSize={index => {
247240
const branch = branches[index];
248-
return branch.name === this.props.currentBranch
241+
return [this.props.currentBranch, 'master', 'main'].includes(
242+
branch.name
243+
)
249244
? CURRENT_BRANCH_HEIGHT
250245
: ITEM_HEIGHT;
251246
}}
@@ -295,25 +290,31 @@ export class NewBranchDialog extends React.Component<
295290
const { data, index, style } = props;
296291
const branch = data[index] as Git.IBranch;
297292

293+
const isBase = branch.name === this.state.base;
298294
const isCurrent = branch.name === this.props.currentBranch;
299295

300296
let isBold;
301297
let desc;
302298
if (isCurrent) {
303299
isBold = true;
304-
desc = BRANCH_DESC['current'];
300+
desc = this.props.trans.__(
301+
'The current branch. Pick this if you want to build on work done in this branch.'
302+
);
303+
} else if (['master', 'main'].includes(branch.name)) {
304+
isBold = true;
305+
desc = this.props.trans.__(
306+
'The default branch. Pick this if you want to start fresh from the default branch.'
307+
);
305308
}
309+
306310
return (
307311
<ListItem
308312
button
309313
title={this.props.trans.__(
310314
'Create a new branch based on: %1',
311315
branch.name
312316
)}
313-
className={classes(
314-
listItemClass,
315-
isCurrent ? activeListItemClass : null
316-
)}
317+
className={classes(listItemClass, isBase ? activeListItemClass : null)}
317318
onClick={this._onBranchClickFactory(branch.name)}
318319
style={style}
319320
>

0 commit comments

Comments
 (0)