@@ -5,6 +5,7 @@ import { ICompareState, IConstrainedValue } from '../../lib/app-state'
55import {
66 commitGraph_getStoredViewMode ,
77 commitGraph_setStoredViewMode ,
8+ CommitHistoryViewMode ,
89} from '../../lib/stores/commit-graph-state'
910import { Repository } from '../../models/repository'
1011import { Branch , BranchType } from '../../models/branch'
@@ -37,17 +38,6 @@ import {
3738} from './commit-graph-model'
3839import { CommitGraphCommitListItem } from './commit-graph-commit-list-item'
3940
40- enum CommitGraphViewMode {
41- List = 'list' ,
42- Tree = 'tree' ,
43- }
44-
45- function commitGraph_getInitialViewMode ( ) {
46- return commitGraph_getStoredViewMode ( ) === 'list'
47- ? CommitGraphViewMode . List
48- : CommitGraphViewMode . Tree
49- }
50-
5141type CommitGraphBranchGroup =
5242 | 'local'
5343 | 'origin'
@@ -90,7 +80,7 @@ interface ICommitGraphSidebarProps {
9080interface ICommitGraphSidebarState {
9181 readonly keyboardReorderData ?: KeyboardInsertionData
9282 readonly isSearching : boolean
93- readonly commitGraphViewMode : CommitGraphViewMode
83+ readonly commitGraphViewMode : CommitHistoryViewMode
9484 readonly commitGraphSelectedBranchRef : string | null
9585}
9686
@@ -527,7 +517,7 @@ export class CommitGraphSidebar extends React.Component<
527517
528518 this . state = {
529519 isSearching : false ,
530- commitGraphViewMode : commitGraph_getInitialViewMode ( ) ,
520+ commitGraphViewMode : commitGraph_getStoredViewMode ( ) ,
531521 commitGraphSelectedBranchRef : null ,
532522 }
533523 }
@@ -568,7 +558,7 @@ export class CommitGraphSidebar extends React.Component<
568558 { this . commitGraph_renderViewModeSwitch ( ) }
569559 </ div >
570560
571- { this . state . commitGraphViewMode === CommitGraphViewMode . Tree
561+ { this . state . commitGraphViewMode === CommitHistoryViewMode . Graph
572562 ? this . commitGraph_renderView ( )
573563 : this . renderCommitList ( false ) }
574564 </ div >
@@ -582,10 +572,10 @@ export class CommitGraphSidebar extends React.Component<
582572 size = "small"
583573 className = { classNames ( 'button-group-item' , {
584574 selected :
585- this . state . commitGraphViewMode === CommitGraphViewMode . List ,
575+ this . state . commitGraphViewMode === CommitHistoryViewMode . List ,
586576 } ) }
587577 ariaPressed = {
588- this . state . commitGraphViewMode === CommitGraphViewMode . List
578+ this . state . commitGraphViewMode === CommitHistoryViewMode . List
589579 }
590580 ariaLabel = "List view"
591581 tooltip = "List view"
@@ -597,10 +587,10 @@ export class CommitGraphSidebar extends React.Component<
597587 size = "small"
598588 className = { classNames ( 'button-group-item' , {
599589 selected :
600- this . state . commitGraphViewMode === CommitGraphViewMode . Tree ,
590+ this . state . commitGraphViewMode === CommitHistoryViewMode . Graph ,
601591 } ) }
602592 ariaPressed = {
603- this . state . commitGraphViewMode === CommitGraphViewMode . Tree
593+ this . state . commitGraphViewMode === CommitHistoryViewMode . Graph
604594 }
605595 ariaLabel = "Graph view"
606596 tooltip = "Graph view"
@@ -1166,24 +1156,24 @@ export class CommitGraphSidebar extends React.Component<
11661156 }
11671157
11681158 private commitGraph_onListModeClicked = ( ) => {
1169- commitGraph_setStoredViewMode ( 'list' )
1170- this . setState ( { commitGraphViewMode : CommitGraphViewMode . List } )
1159+ commitGraph_setStoredViewMode ( CommitHistoryViewMode . List )
1160+ this . setState ( { commitGraphViewMode : CommitHistoryViewMode . List } )
11711161 void this . props . dispatcher . setCommitSearchQuery (
11721162 this . props . repository ,
11731163 this . props . compareState . commitSearchQuery
11741164 )
11751165 }
11761166
11771167 private commitGraph_onTreeModeClicked = ( ) => {
1178- commitGraph_setStoredViewMode ( 'tree' )
1179- this . setState ( { commitGraphViewMode : CommitGraphViewMode . Tree } , ( ) =>
1168+ commitGraph_setStoredViewMode ( CommitHistoryViewMode . Graph )
1169+ this . setState ( { commitGraphViewMode : CommitHistoryViewMode . Graph } , ( ) =>
11801170 this . commitGraph_ensureLoaded ( )
11811171 )
11821172 }
11831173
11841174 private commitGraph_ensureLoaded ( ) {
11851175 if (
1186- this . state . commitGraphViewMode !== CommitGraphViewMode . Tree ||
1176+ this . state . commitGraphViewMode !== CommitHistoryViewMode . Graph ||
11871177 this . commitGraph_getHiddenBranchRefs ( ) === null
11881178 ) {
11891179 return
@@ -1278,7 +1268,7 @@ export class CommitGraphSidebar extends React.Component<
12781268
12791269 private onScroll = ( start : number , end : number ) => {
12801270 const commitGraphIsTreeMode =
1281- this . state . commitGraphViewMode === CommitGraphViewMode . Tree
1271+ this . state . commitGraphViewMode === CommitHistoryViewMode . Graph
12821272 const commits = commitGraphIsTreeMode
12831273 ? this . commitGraph_getFilteredCommitSHAs ( )
12841274 : this . props . compareState . filteredHistoryCommitSHAs
@@ -1324,7 +1314,7 @@ export class CommitGraphSidebar extends React.Component<
13241314 }
13251315
13261316 private onCommitSearchQueryChanged = async ( text : string ) => {
1327- if ( this . state . commitGraphViewMode === CommitGraphViewMode . Tree ) {
1317+ if ( this . state . commitGraphViewMode === CommitHistoryViewMode . Graph ) {
13281318 this . props . dispatcher . updateCompareForm ( this . props . repository , {
13291319 commitSearchQuery : text ,
13301320 } )
0 commit comments