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

List some branches #1126

Merged
merged 49 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
72450eb
Extract branch list from branch foldout component
niik Apr 3, 2017
4e65870
:fire: obsolete border
niik Apr 3, 2017
358310f
Make the branches list styles stand-alone
niik Apr 3, 2017
3aab6da
Use branch list in merge dialog
niik Apr 3, 2017
2e9b829
Remove obsolete styles
niik Apr 3, 2017
9af6210
Give that merge dialog an id
niik Apr 3, 2017
627c7dd
Style button group, not whole footer
niik Apr 3, 2017
10368ea
Add initial merge dialog styles
niik Apr 3, 2017
bbea319
Wider
niik Apr 3, 2017
97b639c
Enable experimental features for ResizeObserver
niik Apr 4, 2017
a9a63fc
Use ResizeObserver when available instead of AutoSizer
niik Apr 4, 2017
c1f86dc
Fix interactions on scroll bar on Windows
niik Apr 4, 2017
9d2961b
Remove one layer of nesting in lists on Windows
niik Apr 4, 2017
2eef0a3
Add an event for selection changed on filter list
niik Apr 4, 2017
5ef1ab1
Use props to determine selected branch
niik Apr 4, 2017
8a2cc7d
Only check out branch if it's not already checked out
niik Apr 4, 2017
6ac4967
Select current branch initially
niik Apr 4, 2017
d367136
Keep track of selection
niik Apr 4, 2017
ff5d43c
Branch list keeps track of selection
niik Apr 4, 2017
380adb4
Select the default branch by default
niik Apr 4, 2017
e6d2a13
Keep track of selection in merge
niik Apr 4, 2017
47395fb
Dismiss merge dialog on escape
niik Apr 4, 2017
e453636
Notify consumers if selection has changed due to filtering
niik Apr 4, 2017
08481e2
Better types
niik Apr 4, 2017
5ca1e14
Only update commit count if we have a selection
niik Apr 4, 2017
4bbea8b
This shouldn't work but it does... why?
niik Apr 4, 2017
6283322
And this is the correct version
niik Apr 4, 2017
67fbac4
Ditch the cancel button :/
niik Apr 4, 2017
3ac6ab3
Clear out old code
niik Apr 4, 2017
e2ea315
Some styling of the merge dialog
niik Apr 4, 2017
d3b772c
Secondary color and alignment for info text
niik Apr 4, 2017
7c8a0e7
Cleanup list header styles
niik Apr 4, 2017
cd8d451
line it all up
niik Apr 4, 2017
a334069
Better padding
niik Apr 4, 2017
f56f78a
Style the merge info
niik Apr 4, 2017
a8f7532
Readonly and :book:
niik Apr 4, 2017
447d2af
:book:
niik Apr 4, 2017
89360a0
:fire: whitespace
niik Apr 4, 2017
5bfbc79
Revert test change
niik Apr 4, 2017
95df1ee
:book: IBranchesState
niik Apr 4, 2017
88ecf8d
:book:
niik Apr 4, 2017
58dd4d4
Don't render previous commit count while calculating
niik Apr 4, 2017
f9313d8
:book:
niik Apr 4, 2017
4f9e132
:art: cleanup
niik Apr 4, 2017
e33f09d
Merge remote-tracking branch 'origin/master' into list-some-branches
niik Apr 5, 2017
c076478
Sentence case on Windows
niik Apr 5, 2017
6d2c7a0
:art: typo
niik Apr 5, 2017
613eb53
Optional onItemClick prop
niik Apr 5, 2017
8b70b50
:art: indentation
niik Apr 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions app/src/ui/branches/branch-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface IBranchListProps {
readonly onFilterKeyDown?: (filter: string, event: React.KeyboardEvent<HTMLInputElement>) => void

/** Called when an item is clicked. */
readonly onItemClick: (item: Branch) => void
readonly onItemClick?: (item: Branch) => void

/**
* This function will be called when the selection changes as a result of a
Expand All @@ -56,7 +56,7 @@ interface IBranchListProps {
* selected row is clicked on.
*
* @param selectedItem - The Branch that was just selected
* @param source - The kind of user action that provoced the change,
* @param source - The kind of user action that provoked the change,
* either a pointer device press, or a keyboard event
* (arrow up/down)
*/
Expand Down Expand Up @@ -107,11 +107,11 @@ export class BranchList extends React.Component<IBranchListProps, IBranchListSta

private getGroupLabel(identifier: BranchGroupIdentifier) {
if (identifier === 'default') {
return 'Default Branch'
return __DARWIN__ ? 'Default Branch' : 'Default branch'
} else if (identifier === 'recent') {
return 'Recent Branches'
return __DARWIN__ ? 'Recent Branches' : 'Recent branches'
} else if (identifier === 'other') {
return 'Other Branches'
return __DARWIN__ ? 'Other Branches' : 'Other branches'
} else {
return assertNever(identifier, `Unknown identifier: ${identifier}`)
}
Expand All @@ -122,8 +122,9 @@ export class BranchList extends React.Component<IBranchListProps, IBranchListSta
}

private onItemClick = (item: IBranchListItem) => {
const branch = item.branch
this.props.onItemClick(branch)
if (this.props.onItemClick) {
this.props.onItemClick(item.branch)

This comment was marked as spam.

This comment was marked as spam.

}
}

private onSelectionChanged = (selectedItem: IBranchListItem | null, source: SelectionSource) => {
Expand Down
13 changes: 8 additions & 5 deletions app/src/ui/lib/filter-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface IFilterListProps<T extends IFilterListItem> {
readonly renderPreList?: () => JSX.Element | null

/** Called when an item is clicked. */
readonly onItemClick: (item: T) => void
readonly onItemClick?: (item: T) => void

/**
* This function will be called when the selection changes as a result of a
Expand All @@ -71,7 +71,7 @@ interface IFilterListProps<T extends IFilterListItem> {
* selected row is clicked on.
*
* @param selectedItem - The item that was just selected
* @param source - The kind of user action that provoced the change,
* @param source - The kind of user action that provoked the change,
* either a pointer device press, or a keyboard event
* (arrow up/down)
*/
Expand Down Expand Up @@ -212,10 +212,13 @@ export class FilterList<T extends IFilterListItem> extends React.Component<IFilt
}

private onRowClick = (index: number) => {
const row = this.state.rows[index]
if (row.kind !== 'item') { return }
if (this.props.onItemClick) {
const row = this.state.rows[index]

this.props.onItemClick(row.item)
if (row.kind === 'item') {
this.props.onItemClick(row.item)
}
}
}

private onRowKeyDown = (row: number, event: React.KeyboardEvent<any>) => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/ui/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ interface IListProps {
* selected row is clicked on.
*
* @param row - The index of the row that was just selected
* @param source - The kind of user action that provoced the change, either
* @param source - The kind of user action that provoked the change, either
* a pointer device press, hover (if selectOnHover is set) or
* a keyboard event (arrow up/down)
*/
Expand Down
4 changes: 0 additions & 4 deletions app/src/ui/merge-branch/merge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ export class Merge extends React.Component<IMergeProps, IMergeState> {
}
}

private onItemClick = (item: Branch) => {
}

private onSelectionChanged = (selectedBranch: Branch | null) => {
if (selectedBranch) {
this.setState({ selectedBranch })
Expand Down Expand Up @@ -136,7 +133,6 @@ export class Merge extends React.Component<IMergeProps, IMergeState> {
defaultBranch={this.props.defaultBranch}
recentBranches={this.props.recentBranches}
onFilterKeyDown={this.onFilterKeyDown}
onItemClick={this.onItemClick}
selectedBranch={selectedBranch}
onSelectionChanged={this.onSelectionChanged}
/>
Expand Down