1
1
import { consume } from '@lit/context' ;
2
+ import { SignalWatcher } from '@lit-labs/signals' ;
2
3
import { css , html } from 'lit' ;
3
- import { customElement , state } from 'lit/decorators.js' ;
4
+ import { customElement } from 'lit/decorators.js' ;
4
5
import { ifDefined } from 'lit/directives/if-defined.js' ;
5
6
import { createWebviewCommandLink } from '../../../../system/webview' ;
6
- import type { State } from '../../../plus/graph/protocol' ;
7
7
import { GlElement } from '../../shared/components/element' ;
8
8
import { linkStyles } from '../shared/components/vscode.css' ;
9
- import { stateContext } from './context ' ;
9
+ import { graphStateContext } from './stateProvider ' ;
10
10
import '../../shared/components/feature-badge' ;
11
11
import '../../shared/components/feature-gate' ;
12
12
13
13
@customElement ( 'gl-graph-gate' )
14
- export class GlGraphGate extends GlElement {
14
+ export class GlGraphGate extends SignalWatcher ( GlElement ) {
15
15
static override styles = [
16
16
linkStyles ,
17
17
css `
@@ -23,29 +23,28 @@ export class GlGraphGate extends GlElement {
23
23
` ,
24
24
] ;
25
25
26
- @consume ( { context : stateContext , subscribe : true } )
27
- @state ( )
28
- state ! : State ;
26
+ @consume ( { context : graphStateContext , subscribe : true } )
27
+ graphState ! : typeof graphStateContext . __context__ ;
29
28
30
29
override render ( ) {
31
30
return html `< gl-feature-gate
32
- .featurePreview =${ this . state . featurePreview }
31
+ .featurePreview =${ this . graphState . featurePreview }
33
32
featurePreviewCommandLink =${ ifDefined (
34
- this . state . featurePreview
33
+ this . graphState . featurePreview
35
34
? createWebviewCommandLink (
36
35
'gitlens.plus.continueFeaturePreview' ,
37
- this . state . webviewId ,
38
- this . state . webviewInstanceId ,
39
- { feature : this . state . featurePreview . feature } ,
36
+ this . graphState . webviewId ,
37
+ this . graphState . webviewInstanceId ,
38
+ { feature : this . graphState . featurePreview . feature } ,
40
39
)
41
40
: undefined ,
42
41
) }
43
42
appearance="alert"
44
43
featureWithArticleIfNeeded="the Commit Graph"
45
- ?hidden=${ this . state . allowed !== false }
44
+ ?hidden=${ this . graphState . allowed !== false }
46
45
.source=${ { source : 'graph' , detail : 'gate' } as const }
47
- .state=${ this . state . subscription ?. state }
48
- .webroot=${ this . state . webroot }
46
+ .state=${ this . graphState . subscription ?. state }
47
+ .webroot=${ this . graphState . webroot }
49
48
>
50
49
< p slot ="feature ">
51
50
< a href ="https://help.gitkraken.com/gitlens/gitlens-features/#commit-graph-pro "> Commit Graph</ a >
0 commit comments