diff --git a/docs/telemetry-events.md b/docs/telemetry-events.md index db68909d4939a..f41bb427bcec7 100644 --- a/docs/telemetry-events.md +++ b/docs/telemetry-events.md @@ -1484,7 +1484,7 @@ void 'repoPrivacy': 'private' | 'public' | 'local', 'repository.visibility': 'private' | 'public' | 'local', // Provided for compatibility with other GK surfaces - 'source': 'account' | 'subscription' | 'graph' | 'patchDetails' | 'settings' | 'timeline' | 'home' | 'view' | 'code-suggest' | 'ai' | 'ai:picker' | 'associateIssueWithBranch' | 'cloud-patches' | 'commandPalette' | 'deeplink' | 'inspect' | 'inspect-overview' | 'integrations' | 'launchpad' | 'launchpad-indicator' | 'launchpad-view' | 'notification' | 'prompt' | 'quick-wizard' | 'remoteProvider' | 'startWork' | 'trial-indicator' | 'scm-input' | 'walkthrough' | 'whatsnew' | 'worktrees' + 'source': 'account' | 'subscription' | 'graph' | 'patchDetails' | 'settings' | 'timeline' | 'home' | 'view' | 'code-suggest' | 'ai' | 'ai:picker' | 'associateIssueWithBranch' | 'cloud-patches' | 'commandPalette' | 'deeplink' | 'inspect' | 'inspect-overview' | 'integrations' | 'launchpad' | 'launchpad-indicator' | 'launchpad-view' | 'merge-target' | 'notification' | 'prompt' | 'quick-wizard' | 'remoteProvider' | 'startWork' | 'trial-indicator' | 'scm-input' | 'walkthrough' | 'whatsnew' | 'worktrees' } ``` diff --git a/src/constants.telemetry.ts b/src/constants.telemetry.ts index 25032103d63c9..9a4cde563b94b 100644 --- a/src/constants.telemetry.ts +++ b/src/constants.telemetry.ts @@ -941,6 +941,7 @@ export type Sources = | 'launchpad' | 'launchpad-indicator' | 'launchpad-view' + | 'merge-target' | 'notification' | 'patchDetails' | 'prompt' diff --git a/src/webviews/apps/plus/home/components/active-work.ts b/src/webviews/apps/plus/home/components/active-work.ts index 1f8f96dc89884..09cb3b429499e 100644 --- a/src/webviews/apps/plus/home/components/active-work.ts +++ b/src/webviews/apps/plus/home/components/active-work.ts @@ -5,6 +5,7 @@ import { css, html, LitElement, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { when } from 'lit/directives/when.js'; +import { isSubscriptionStatePaidOrTrial } from '../../../../../plus/gk/utils/subscription.utils'; import { createCommandLink } from '../../../../../system/commands'; import { createWebviewCommandLink } from '../../../../../system/webview'; import type { GetActiveOverviewResponse, GetOverviewBranch, OpenInGraphParams, State } from '../../../../home/protocol'; @@ -65,6 +66,10 @@ export class GlActiveWork extends SignalWatcher(LitElement) { @consume({ context: activeOverviewStateContext }) private _activeOverviewState!: ActiveOverviewState; + get isPro() { + return isSubscriptionStatePaidOrTrial(this._homeState.subscription.state); + } + override connectedCallback(): void { super.connectedCallback(); @@ -185,6 +190,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) { .branch=${branch} .repo=${repo} ?busy=${isFetching} + ?showUpgrade=${!this.isPro} >`; } diff --git a/src/webviews/apps/plus/home/components/branch-card.ts b/src/webviews/apps/plus/home/components/branch-card.ts index 2baa86cb560fd..a4ea1e04e68a6 100644 --- a/src/webviews/apps/plus/home/components/branch-card.ts +++ b/src/webviews/apps/plus/home/components/branch-card.ts @@ -234,6 +234,9 @@ export abstract class GlBranchCardBase extends GlElement { @property() repo!: string; + @property({ type: Boolean }) + showUpgrade = false; + private _branch!: GetOverviewBranch; get branch(): GetOverviewBranch { return this._branch; @@ -794,6 +797,10 @@ export abstract class GlBranchCardBase extends GlElement { } protected renderMergeTargetStatus(): TemplateResult | NothingType { + if (this.showUpgrade) { + return html``; + } + if (!this.branch.mergeTarget) return nothing; return html` summary { - color: var(--vscode-textLink-foreground); - border-radius: 0.3rem 0.3rem 0 0; - margin-left: 0; - background: var(--vscode-sideBar-background); - } + details[open] > summary { + color: var(--vscode-textLink-foreground); + border-radius: 0.3rem 0.3rem 0 0; + margin-left: 0; + background: var(--vscode-sideBar-background); + } - details[open] > summary code-icon { - transform: rotate(90deg); - } + details[open] > summary code-icon { + transform: rotate(90deg); + } - summary code-icon { - transition: transform 0.2s; - } + summary code-icon { + transition: transform 0.2s; + } - .files { - display: flex; - flex-direction: column; - gap: 0.4rem; + .files { + display: flex; + flex-direction: column; + gap: 0.4rem; - max-height: 8rem; - overflow-y: auto; - padding: 0.4rem 0.8rem; + max-height: 8rem; + overflow-y: auto; + padding: 0.4rem 0.8rem; - background: var(--vscode-sideBar-background); - } + background: var(--vscode-sideBar-background); + } - gl-popover { - --max-width: 80vw; - } + gl-popover { + --max-width: 80vw; + } - .info { - cursor: help; - display: inline-flex; - vertical-align: middle; - } - `, - ]; + .info { + cursor: help; + display: inline-flex; + vertical-align: middle; + } +`; + +@customElement('gl-merge-target-status') +export class GlMergeTargetStatus extends LitElement { + static override shadowRootOptions: ShadowRootInit = { + ...LitElement.shadowRootOptions, + delegatesFocus: true, + }; + + static override styles = [elementBase, linkBase, chipStyles, scrollableBase, mergeTargetStyles]; @property({ type: Object }) branch!: Pick; @@ -528,3 +529,45 @@ export class GlMergeTargetStatus extends LitElement { return html` ${path}`; } } + +@customElement('gl-merge-target-upgrade') +export class GlMergeTargetUpgrade extends LitElement { + static override shadowRootOptions: ShadowRootInit = { + ...LitElement.shadowRootOptions, + delegatesFocus: true, + }; + + static override styles = [elementBase, linkBase, chipStyles, scrollableBase, mergeTargetStyles]; + + override render(): unknown { + const icon = 'warning'; + const status = 'upgrade'; + + return html` + + +
+
+ Detect potential merge conflicts +
+
+

+ Upgrade to GitLens Pro to see when your current branch has potential conflicts with its merge + target branch and take action to resolve them. +

+
+ Upgrade to Pro +
+
+
+
`; + } +}