@@ -7,7 +7,10 @@ import type {
7
7
} from '../../../../../commands/cloudIntegrations' ;
8
8
import type { IntegrationFeatures } from '../../../../../constants.integrations' ;
9
9
import type { Source } from '../../../../../constants.telemetry' ;
10
- import { hasAccountFromSubscriptionState } from '../../../../../plus/gk/utils/subscription.utils' ;
10
+ import {
11
+ hasAccountFromSubscriptionState ,
12
+ isSubscriptionStatePaidOrTrial ,
13
+ } from '../../../../../plus/gk/utils/subscription.utils' ;
11
14
import { createCommandLink } from '../../../../../system/commands' ;
12
15
import type { IntegrationState , State } from '../../../../home/protocol' ;
13
16
import { stateContext } from '../../../home/context' ;
@@ -18,6 +21,7 @@ import '../../../shared/components/button-container';
18
21
import '../../../shared/components/code-icon' ;
19
22
import '../../../shared/components/overlays/popover' ;
20
23
import '../../../shared/components/overlays/tooltip' ;
24
+ import '../../../shared/components/feature-badge' ;
21
25
22
26
@customElement ( 'gl-integrations-chip' )
23
27
export class GLIntegrationsChip extends LitElement {
@@ -67,11 +71,7 @@ export class GLIntegrationsChip extends LitElement {
67
71
color: var(--color-foreground--25);
68
72
}
69
73
70
- .status--connected .status-indicator {
71
- color: var(--status-color--connected);
72
- }
73
-
74
- .status--connected .status-indicator {
74
+ .status--connected:not(.is-locked) .status-indicator {
75
75
color: var(--status-color--connected);
76
76
}
77
77
@@ -96,16 +96,21 @@ export class GLIntegrationsChip extends LitElement {
96
96
color: var(--color-foreground--25);
97
97
}
98
98
99
- .status--disconnected .integration__title {
100
- color: var(--color-foreground--50);
99
+ .integration__title {
100
+ display: block;
101
+ }
102
+
103
+ .integration__title gl-feature-badge {
104
+ vertical-align: super;
101
105
}
102
106
103
107
.integration__details {
104
- display: flex ;
108
+ display: block ;
105
109
color: var(--color-foreground--75);
106
110
font-size: 1rem;
107
111
}
108
112
113
+ .status--disconnected .integration__title,
109
114
.status--disconnected .integration__details {
110
115
color: var(--color-foreground--50);
111
116
}
@@ -141,6 +146,10 @@ export class GLIntegrationsChip extends LitElement {
141
146
return hasAccountFromSubscriptionState ( this . _state . subscription ?. state ) ;
142
147
}
143
148
149
+ private get isProAccount ( ) {
150
+ return isSubscriptionStatePaidOrTrial ( this . _state . subscription ?. state ) ;
151
+ }
152
+
144
153
private get hasConnectedIntegrations ( ) {
145
154
return this . hasAccount && this . integrations . some ( i => i . connected ) ;
146
155
}
@@ -213,6 +222,15 @@ export class GLIntegrationsChip extends LitElement {
213
222
}
214
223
215
224
private renderIntegrationStatus ( integration : IntegrationState , anyConnected : boolean ) {
225
+ if ( integration . requiresPro && ! this . isProAccount ) {
226
+ return html `< span
227
+ class ="integration status--${ integration . connected ? 'connected' : 'disconnected' } is-locked "
228
+ slot ="anchor "
229
+ > < code-icon icon ="${ integration . icon } "> </ code-icon
230
+ > < code-icon class ="status-indicator " icon ="lock " size ="12 "> </ code-icon
231
+ > </ span > ` ;
232
+ }
233
+
216
234
return html `< span
217
235
class ="integration status-- ${ integration . connected ? 'connected' : 'disconnected' } "
218
236
slot ="anchor "
@@ -227,30 +245,54 @@ export class GLIntegrationsChip extends LitElement {
227
245
}
228
246
229
247
private renderIntegrationRow ( integration : IntegrationState ) {
230
- return html `< div class ="integration-row status-- ${ integration . connected ? 'connected' : 'disconnected' } ">
248
+ const shouldLock = integration . requiresPro && ! this . isProAccount ;
249
+ return html `< div
250
+ class ="integration-row status-- ${ integration . connected ? 'connected' : 'disconnected' } ${ shouldLock
251
+ ? ' is-locked'
252
+ : '' } "
253
+ >
231
254
< span slot ="anchor "> < code-icon class ="integration__icon " icon ="${ integration . icon } "> </ code-icon > </ span >
232
255
< span >
233
- < span class ="integration__title "> ${ integration . name } </ span >
256
+ < span class ="integration__title ">
257
+ ${ integration . name }
258
+ ${ shouldLock
259
+ ? html ` < gl-feature-badge
260
+ placement ="right "
261
+ .source =${ { source : 'account' , detail : 'integrations' } }
262
+ cloud
263
+ > </ gl-feature-badge > `
264
+ : nothing }
265
+ </ span >
234
266
< span class ="integration__details "> ${ getIntegrationDetails ( integration ) } </ span >
235
267
</ span >
236
268
< span class ="integration__actions ">
237
- ${ integration . connected
238
- ? html `< gl-tooltip class ="status-indicator status--connected " placement ="bottom " content ="Connected "
239
- > < code-icon class ="status-indicator " icon ="check "> </ code-icon
269
+ ${ shouldLock
270
+ ? html `< gl-tooltip
271
+ class ="status-indicator status--disconnected "
272
+ placement ="bottom "
273
+ content ="Unlock ${ integration . name } features with GitLens Pro "
274
+ > < code-icon class ="status-indicator " icon ="lock "> </ code-icon
240
275
> </ gl-tooltip > `
241
- : html `< gl-button
242
- appearance ="toolbar "
243
- href ="${ createCommandLink < ConnectCloudIntegrationsCommandArgs > (
244
- 'gitlens.plus.cloudIntegrations.connect' ,
245
- {
246
- integrationIds : [ integration . id ] ,
247
- source : 'account' ,
248
- } ,
249
- ) } "
250
- tooltip ="Connect ${ integration . name } "
251
- aria-label ="Connect ${ integration . name } "
252
- > < code-icon icon ="plug "> </ code-icon
253
- > </ gl-button > ` }
276
+ : integration . connected
277
+ ? html `< gl-tooltip
278
+ class ="status-indicator status--connected "
279
+ placement ="bottom "
280
+ content ="Connected "
281
+ > < code-icon class ="status-indicator " icon ="check "> </ code-icon
282
+ > </ gl-tooltip > `
283
+ : html `< gl-button
284
+ appearance ="toolbar "
285
+ href ="${ createCommandLink < ConnectCloudIntegrationsCommandArgs > (
286
+ 'gitlens.plus.cloudIntegrations.connect' ,
287
+ {
288
+ integrationIds : [ integration . id ] ,
289
+ source : 'account' ,
290
+ } ,
291
+ ) } "
292
+ tooltip ="Connect ${ integration . name } "
293
+ aria-label ="Connect ${ integration . name } "
294
+ > < code-icon icon ="plug "> </ code-icon
295
+ > </ gl-button > ` }
254
296
</ span >
255
297
</ div > ` ;
256
298
}
0 commit comments