Skip to content

Commit ffe5dbf

Browse files
committed
Adds merge target message for community
1 parent 3205ea8 commit ffe5dbf

File tree

5 files changed

+211
-154
lines changed

5 files changed

+211
-154
lines changed

docs/telemetry-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ void
14841484
'repoPrivacy': 'private' | 'public' | 'local',
14851485
'repository.visibility': 'private' | 'public' | 'local',
14861486
// Provided for compatibility with other GK surfaces
1487-
'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'
1487+
'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'
14881488
}
14891489
```
14901490

src/constants.telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ export type Sources =
942942
| 'launchpad'
943943
| 'launchpad-indicator'
944944
| 'launchpad-view'
945+
| 'merge-target'
945946
| 'notification'
946947
| 'patchDetails'
947948
| 'prompt'

src/webviews/apps/plus/home/components/active-work.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { css, html, LitElement, nothing } from 'lit';
55
import { customElement, state } from 'lit/decorators.js';
66
import { ifDefined } from 'lit/directives/if-defined.js';
77
import { when } from 'lit/directives/when.js';
8+
import { isSubscriptionStatePaidOrTrial } from '../../../../../plus/gk/utils/subscription.utils';
89
import { createCommandLink } from '../../../../../system/commands';
910
import { createWebviewCommandLink } from '../../../../../system/webview';
1011
import type { GetActiveOverviewResponse, GetOverviewBranch, OpenInGraphParams, State } from '../../../../home/protocol';
@@ -65,6 +66,10 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
6566
@consume({ context: activeOverviewStateContext })
6667
private _activeOverviewState!: ActiveOverviewState;
6768

69+
get isPro() {
70+
return isSubscriptionStatePaidOrTrial(this._homeState.subscription.state);
71+
}
72+
6873
override connectedCallback(): void {
6974
super.connectedCallback();
7075

@@ -185,6 +190,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
185190
.branch=${branch}
186191
.repo=${repo}
187192
?busy=${isFetching}
193+
?showUpgrade=${!this.isPro}
188194
></gl-active-branch-card>`;
189195
}
190196

src/webviews/apps/plus/home/components/branch-card.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ export abstract class GlBranchCardBase extends GlElement {
234234
@property()
235235
repo!: string;
236236

237+
@property({ type: Boolean })
238+
showUpgrade = false;
239+
237240
private _branch!: GetOverviewBranch;
238241
get branch(): GetOverviewBranch {
239242
return this._branch;
@@ -794,6 +797,10 @@ export abstract class GlBranchCardBase extends GlElement {
794797
}
795798

796799
protected renderMergeTargetStatus(): TemplateResult | NothingType {
800+
if (this.showUpgrade) {
801+
return html`<gl-merge-target-upgrade class="branch-item__merge-target"></gl-merge-target-upgrade>`;
802+
}
803+
797804
if (!this.branch.mergeTarget) return nothing;
798805

799806
return html`<gl-merge-target-status

0 commit comments

Comments
 (0)