11import { consume } from '@lit/context' ;
22import { css , html , LitElement , nothing } from 'lit' ;
3- import { customElement , query , state } from 'lit/decorators.js' ;
3+ import { customElement , property , query , state } from 'lit/decorators.js' ;
44import { when } from 'lit/directives/when.js' ;
55import { urls } from '../../../../../constants' ;
66import { proTrialLengthInDays , SubscriptionPlanId , SubscriptionState } from '../../../../../constants.subscription' ;
@@ -39,22 +39,39 @@ export class GLAccountChip extends LitElement {
3939 focusableBaseStyles ,
4040 chipStyles ,
4141 css `
42+ :host {
43+ display: inline-flex;
44+ align-items: center;
45+ gap: 0.8rem;
46+ }
47+
48+ :host-context(.vscode-dark),
49+ :host-context(.vscode-high-contrast) {
50+ --gl-account-chip-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 10%);
51+ --gl-account-chip-media-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 25%);
52+ --gl-account-account-media-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 20%);
53+ }
54+
55+ :host-context(.vscode-light),
56+ :host-context(.vscode-high-contrast-light) {
57+ --gl-account-chip-color: color-mix(in lab, var(--vscode-sideBar-background), #000 7%);
58+ --gl-account-chip-media-color: color-mix(in lab, var(--vscode-sideBar-background), #000 18%);
59+ --gl-account-account-media-color: color-mix(in lab, var(--vscode-sideBar-background), #000 15%);
60+ }
61+
4262 .chip {
4363 padding-right: 0.6rem;
4464
4565 font-size: 1.1rem;
4666 font-weight: 400;
4767 text-transform: uppercase;
68+ line-height: 2rem;
69+ background-color: var(--gl-account-chip-color);
4870 }
4971
50- :host-context(.vscode-dark) .chip,
51- :host-context(.vscode-high-contrast) .chip {
52- background-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 10%);
53- }
54-
55- :host-context(.vscode-light) .chip,
56- :host-context(.vscode-high-contrast-light) .chip {
57- background-color: color-mix(in lab, var(--vscode-sideBar-background), #000 7%);
72+ .chip--outlined {
73+ background-color: transparent;
74+ border: 1px solid var(--gl-account-chip-color);
5875 }
5976
6077 .chip__media {
@@ -69,16 +86,14 @@ export class GLAccountChip extends LitElement {
6986 width: 1.6rem;
7087 aspect-ratio: 1 / 1;
7188 border-radius: 50%;
89+ background-color: var(--gl-account-chip-media-color);
7290 }
7391
74- :host-context(.vscode-dark) img.chip__media,
75- :host-context(.vscode-high-contrast) img.chip__media {
76- background-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 25%);
77- }
78-
79- :host-context(.vscode-light) img.chip__media,
80- :host-context(.vscode-high-contrast-light) img.chip__media {
81- background-color: color-mix(in lab, var(--vscode-sideBar-background), #000 18%);
92+ .chip-group {
93+ display: inline-flex;
94+ flex-direction: row;
95+ gap: 0.8rem;
96+ cursor: pointer;
8297 }
8398
8499 .account-org {
@@ -107,16 +122,7 @@ export class GLAccountChip extends LitElement {
107122 width: 2rem;
108123 aspect-ratio: 1 / 1;
109124 border-radius: 50%;
110- }
111-
112- :host-context(.vscode-dark) img.account__media,
113- :host-context(.vscode-high-contrast) img.account__media {
114- background-color: color-mix(in lab, var(--vscode-sideBar-background), #fff 20%);
115- }
116-
117- :host-context(.vscode-light) img.account__media,
118- :host-context(.vscode-high-contrast-light) img.account__media {
119- background-color: color-mix(in lab, var(--vscode-sideBar-background), #000 15%);
125+ background-color: var(--gl-account-account-media-color);
120126 }
121127
122128 .account__details {
@@ -222,9 +228,37 @@ export class GLAccountChip extends LitElement {
222228 border: none;
223229 border-top: 1px solid var(--color-foreground--25);
224230 }
231+
232+ .upgrade > * {
233+ margin-block: 0.8rem 0;
234+ }
235+
236+ .upgrade ul {
237+ padding-inline-start: 2rem;
238+ }
239+
240+ .upgrade gl-promo::part(text) {
241+ margin-block-start: 0;
242+ border-radius: 0.3rem;
243+ padding: 0.2rem 0.4rem;
244+ background-color: var(--gl-account-chip-color);
245+ }
246+
247+ .upgrade gl-promo:not([has-promo]) {
248+ display: none;
249+ }
225250 ` ,
226251 ] ;
227252
253+ private _showUpgrade = false ;
254+ @property ( { type : Boolean , reflect : true , attribute : 'show-upgrade' } )
255+ get showUpgrade ( ) {
256+ return this . _showUpgrade ;
257+ }
258+ private set showUpgrade ( value : boolean ) {
259+ this . _showUpgrade = value ;
260+ }
261+
228262 @query ( '#chip' )
229263 private _chip ! : HTMLElement ;
230264
@@ -295,58 +329,59 @@ export class GLAccountChip extends LitElement {
295329
296330 override render ( ) : unknown {
297331 return html `< gl-popover placement ="bottom " trigger ="hover focus click " hoist >
298- < span id ="chip " slot ="anchor " class ="chip " tabindex ="0 ">
299- ${ this . accountAvatar
300- ? html `< img class ="chip__media " src =${ this . accountAvatar } / > `
301- : html `< code-icon class ="chip__media " icon ="gl-gitlens " size ="16 "> </ code-icon > ` }
302- < span > ${ this . planTier } </ span >
303- </ span >
304- < div slot ="content " class ="content " tabindex ="-1 ">
305- < div class ="header ">
306- < span class ="header__title "> ${ this . planName } </ span >
307- < span class ="header__actions ">
308- ${ this . hasAccount
309- ? html `< gl-button
310- appearance ="toolbar "
311- href ="${ createCommandLink < Source > ( 'gitlens.views.home.account.resync' , {
312- source : 'account' ,
313- } ) } "
314- tooltip ="Synchronize Status "
315- aria-label ="Synchronize Status "
316- > < code-icon icon ="sync "> </ code-icon
317- > </ gl-button >
318- < gl-button
332+ < span id ="chip " slot ="anchor " class ="chip " tabindex ="0 ">
333+ ${ this . accountAvatar
334+ ? html `< img class ="chip__media " src =${ this . accountAvatar } / > `
335+ : html `< code-icon class ="chip__media " icon ="gl-gitlens " size ="16 "> </ code-icon > ` }
336+ < span > ${ this . planTier } </ span >
337+ </ span >
338+ < div slot ="content " class ="content " tabindex ="-1 ">
339+ < div class ="header ">
340+ < span class ="header__title "> ${ this . planName } </ span >
341+ < span class ="header__actions ">
342+ ${ this . hasAccount
343+ ? html `< gl-button
344+ appearance ="toolbar "
345+ href ="${ createCommandLink < Source > ( 'gitlens.views.home.account.resync' , {
346+ source : 'account' ,
347+ } ) } "
348+ tooltip ="Synchronize Status "
349+ aria-label ="Synchronize Status "
350+ > < code-icon icon ="sync "> </ code-icon
351+ > </ gl-button >
352+ < gl-button
353+ appearance ="toolbar "
354+ href ="${ createCommandLink < Source > ( 'gitlens.plus.manage' , {
355+ source : 'account' ,
356+ } ) } "
357+ tooltip ="Manage Account "
358+ aria-label ="Manage Account "
359+ > < code-icon icon ="gear "> </ code-icon
360+ > </ gl-button >
361+ < gl-button
362+ appearance ="toolbar "
363+ href ="${ createCommandLink < Source > ( 'gitlens.plus.logout' , {
364+ source : 'account' ,
365+ } ) } "
366+ tooltip ="Sign Out "
367+ aria-label ="Sign Out "
368+ > < code-icon icon ="sign-out "> </ code-icon
369+ > </ gl-button > `
370+ : html `< gl-button
319371 appearance ="toolbar "
320- href ="${ createCommandLink < Source > ( 'gitlens.plus.manage ' , {
372+ href ="${ createCommandLink < Source > ( 'gitlens.plus.login ' , {
321373 source : 'account' ,
322374 } ) } "
323- tooltip ="Manage Account "
324- aria-label ="Manage Account "
325- > < code-icon icon ="gear "> </ code-icon
326- > </ gl-button >
327- < gl-button
328- appearance ="toolbar "
329- href ="${ createCommandLink < Source > ( 'gitlens.plus.logout' , {
330- source : 'account' ,
331- } ) } "
332- tooltip ="Sign Out "
333- aria-label ="Sign Out "
334- > < code-icon icon ="sign-out "> </ code-icon
335- > </ gl-button > `
336- : html `< gl-button
337- appearance ="toolbar "
338- href ="${ createCommandLink < Source > ( 'gitlens.plus.login' , {
339- source : 'account' ,
340- } ) } "
341- tooltip ="Sign In "
342- aria-label ="Sign In "
343- > < code-icon icon ="sign-in "> </ code-icon
344- > </ gl-button > ` }
345- </ span >
375+ tooltip ="Sign In "
376+ aria-label ="Sign In "
377+ > < code-icon icon ="sign-in "> </ code-icon
378+ > </ gl-button > ` }
379+ </ span >
380+ </ div >
381+ ${ this . renderOrganization ( ) } ${ this . renderAccountState ( ) }
346382 </ div >
347- ${ this . renderOrganization ( ) } ${ this . renderAccountState ( ) }
348- </ div >
349- </ gl-popover > ` ;
383+ </ gl-popover >
384+ ${ this . renderUpgradeContent ( ) } ` ;
350385 }
351386
352387 show ( ) : void {
@@ -528,6 +563,49 @@ export class GLAccountChip extends LitElement {
528563 return html `< p > Includes access to < a href ="${ urls . platform } "> GitKraken's DevEx platform</ a > </ p > ` ;
529564 }
530565
566+ private renderUpgradeContent ( ) {
567+ if ( this . planTier !== 'Community' && this . planId !== SubscriptionPlanId . Pro ) {
568+ this . showUpgrade = false ;
569+ return nothing ;
570+ }
571+
572+ this . showUpgrade = true ;
573+
574+ return html `< gl-popover placement ="bottom " trigger ="hover focus click " hoist >
575+ < span slot ="anchor " class ="chip chip--outlined " tabindex ="0 ">
576+ < span > Upgrade</ span >
577+ </ span >
578+ < div slot ="content " class ="content " tabindex ="-1 ">
579+ < div class ="header ">
580+ < span class ="header__title "> Upgrade GitLens</ span >
581+ </ div >
582+ < div class ="upgrade ">
583+ < p > Unlock Pro features:</ p >
584+ < ul >
585+ < li > Connect powerful integrations</ li >
586+ < li > Start work on Issues assigned to you</ li >
587+ < li > Leverage Git Worktrees in VS Code</ li >
588+ < li > Monitor PRs and accelerate reviews</ li >
589+ < li > Rich AI features</ li >
590+ < li > Interactive Commit Graph</ li >
591+ < li > Visual File and Folder History</ li >
592+ </ ul >
593+ ${ this . renderPromo ( ) }
594+ < button-container >
595+ < gl-button
596+ full
597+ href ="${ createCommandLink < Source > ( 'gitlens.plus.upgrade' , {
598+ // needs to indicate upgrade menu
599+ source : 'account' ,
600+ } ) } "
601+ > Upgrade to Pro</ gl-button
602+ >
603+ </ button-container >
604+ </ div >
605+ </ div >
606+ </ gl-popover > ` ;
607+ }
608+
531609 private renderPromo ( ) {
532610 return html `< gl-promo
533611 .promoPromise =${ this . promos . getApplicablePromo ( 'account' ) }
0 commit comments