@@ -13,7 +13,6 @@ import { ipcContext } from '../../shared/contexts/ipc';
13
13
import type { TelemetryContext } from '../../shared/contexts/telemetry' ;
14
14
import { telemetryContext } from '../../shared/contexts/telemetry' ;
15
15
import { emitTelemetrySentEvent } from '../../shared/telemetry' ;
16
- import { stateContext } from './context' ;
17
16
import type { GlGraphWrapper } from './graph-wrapper/graph-wrapper' ;
18
17
import type { GlGraphHover } from './hover/graphHover' ;
19
18
import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap' ;
@@ -36,11 +35,8 @@ export class GraphApp extends SignalWatcher(LitElement) {
36
35
return this ;
37
36
}
38
37
39
- @consume ( { context : stateContext , subscribe : true } )
40
- state ! : typeof stateContext . __context__ ;
41
-
42
38
@consume ( { context : graphStateContext , subscribe : true } )
43
- graphApp ! : typeof graphStateContext . __context__ ;
39
+ graphState ! : typeof graphStateContext . __context__ ;
44
40
45
41
@consume ( { context : ipcContext } )
46
42
private readonly _ipc ! : typeof ipcContext . __context__ ;
@@ -76,27 +72,33 @@ export class GraphApp extends SignalWatcher(LitElement) {
76
72
@gl-select-commits =${ this . handleHeaderSearchNavigation }
77
73
> </ gl-graph-header >
78
74
< div class ="graph__workspace ">
79
- ${ when ( ! this . state . allowed , ( ) => html `< gl-graph-gate class ="graph__gate "> </ gl-graph-gate > ` ) }
75
+ ${ when (
76
+ ! this . graphState . state . allowed ,
77
+ ( ) => html `< gl-graph-gate class ="graph__gate "> </ gl-graph-gate > ` ,
78
+ ) }
80
79
< main id ="main " class ="graph__panes ">
81
80
< div class ="graph__graph-pane ">
82
81
${ when (
83
- this . state . config ?. minimap !== false ,
82
+ this . graphState . state . config ?. minimap !== false ,
84
83
( ) => html `
85
84
< gl-graph-minimap-container
86
- .activeDay =${ this . graphApp . activeDay }
87
- .disabled =${ ! this . state . config ?. minimap }
88
- .rows=${ this . state . rows ?? [ ] }
89
- .rowsStats=${ this . state . rowsStats }
90
- .dataType=${ this . state . config ?. minimapDataType ?? 'commits' }
91
- .markerTypes=${ this . state . config ?. minimapMarkerTypes ?? [ ] }
92
- .refMetadata=${ this . state . refsMetadata }
93
- .searchResults=${ this . graphApp . searchResults }
94
- .visibleDays=${ this . graphApp . visibleDays }
85
+ .activeDay =${ this . graphState . activeDay }
86
+ .disabled =${ ! this . graphState . state . config ?. minimap }
87
+ .rows=${ this . graphState . state . rows ?? [ ] }
88
+ .rowsStats=${ this . graphState . state . rowsStats }
89
+ .dataType=${ this . graphState . state . config ?. minimapDataType ?? 'commits' }
90
+ .markerTypes=${ this . graphState . state . config ?. minimapMarkerTypes ?? [ ] }
91
+ .refMetadata=${ this . graphState . state . refsMetadata }
92
+ .searchResults=${ this . graphState . searchResults }
93
+ .visibleDays=${ this . graphState . visibleDays }
95
94
@gl-graph-minimap-selected=${ this . handleMinimapDaySelected }
96
95
> </ gl-graph-minimap-container >
97
96
` ,
98
97
) }
99
- ${ when ( this . state . config ?. sidebar , ( ) => html `< gl-graph-sidebar > </ gl-graph-sidebar > ` ) }
98
+ ${ when (
99
+ this . graphState . state . config ?. sidebar ,
100
+ ( ) => html `< gl-graph-sidebar > </ gl-graph-sidebar > ` ,
101
+ ) }
100
102
< gl-graph-hover id ="commit-hover " distance =${ 0 } skidding =${ 15 } > </ gl-graph-hover >
101
103
< gl-graph-wrapper
102
104
@gl-graph-change-selection =${ this . handleGraphSelectionChanged }
@@ -119,15 +121,15 @@ export class GraphApp extends SignalWatcher(LitElement) {
119
121
}
120
122
121
123
private handleMinimapDaySelected ( e : CustomEvent < GraphMinimapDaySelectedEventDetail > ) {
122
- if ( ! this . state . rows ) return ;
124
+ if ( ! this . graphState . state . rows ) return ;
123
125
124
126
let { sha } = e . detail ;
125
127
if ( sha == null ) {
126
128
const date = e . detail . date ?. getTime ( ) ;
127
129
if ( date == null ) return ;
128
130
129
131
// Find closest row to the date
130
- const closest = this . state . rows . reduce ( ( prev , curr ) => {
132
+ const closest = this . graphState . state . rows . reduce ( ( prev , curr ) => {
131
133
return Math . abs ( curr . date - date ) < Math . abs ( prev . date - date ) ? curr : prev ;
132
134
} ) ;
133
135
sha = closest . sha ;
@@ -161,7 +163,7 @@ export class GraphApp extends SignalWatcher(LitElement) {
161
163
}
162
164
163
165
private handleGraphVisibleDaysChanged ( { detail } : CustomEventType < 'gl-graph-change-visible-days' > ) {
164
- this . graphApp . visibleDays = detail ;
166
+ this . graphState . visibleDays = detail ;
165
167
}
166
168
167
169
private handleGraphRowContextMenu ( _e : CustomEventType < 'gl-graph-row-context-menu' > ) {
0 commit comments