Skip to content

Commit f8c91ed

Browse files
committed
get rid of unnecessary prop
1 parent e360bcc commit f8c91ed

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/webviews/apps/plus/graph/GraphWrapper.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,6 @@ export function GraphWrapper({
15371537
</header>
15381538
<GlFeatureGate
15391539
className="graph-app__gate"
1540-
allowFeaturePreviewTrial={true}
15411540
featureInPreviewTrial={graphPreviewTrial ? { graph: graphPreviewTrial } : undefined}
15421541
featurePreviewTrialCommandLink={createWebviewCommandLink(
15431542
'gitlens.graph.startFeaturePreviewTrial',

src/webviews/apps/plus/shared/components/feature-gate-plus-state.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ export class GlFeatureGatePlusState extends LitElement {
6969
@query('gl-button')
7070
private readonly button!: GlButton;
7171

72-
@property({ type: Boolean })
73-
allowFeaturePreviewTrial?: boolean;
74-
7572
@property({ type: Object })
7673
featureInPreviewTrial?: {
7774
[key in Sources]?: { consumedDays: { startedOn: string; expiresOn: string }[]; isActive: boolean };
@@ -108,8 +105,9 @@ export class GlFeatureGatePlusState extends LitElement {
108105
const appearance = (this.appearance ?? 'alert') === 'alert' ? 'alert' : nothing;
109106
const promo = this.state ? getApplicablePromo(this.state, 'gate') : undefined;
110107
let consumedDaysCount = 0;
111-
if (this.source?.source) {
112-
consumedDaysCount = this.featureInPreviewTrial?.[this.source.source]?.consumedDays?.length ?? 0;
108+
const feature = this.source?.source;
109+
if (feature) {
110+
consumedDaysCount = this.featureInPreviewTrial?.[feature]?.consumedDays?.length ?? 0;
113111
}
114112

115113
switch (this.state) {
@@ -133,8 +131,11 @@ export class GlFeatureGatePlusState extends LitElement {
133131
`;
134132

135133
case SubscriptionState.Community:
136-
if (this.allowFeaturePreviewTrial) {
137-
const daysLeft = proPreviewLengthInDays - consumedDaysCount;
134+
if (
135+
feature &&
136+
this.featureInPreviewTrial?.[feature] &&
137+
proPreviewLengthInDays - consumedDaysCount > 0
138+
) {
138139
return html`
139140
<p class="actions">
140141
<gl-button class="inline" href="${generateCommandLink(Commands.PlusSignUp, this.source)}"
@@ -150,9 +151,9 @@ export class GlFeatureGatePlusState extends LitElement {
150151
</p>
151152
152153
<p>
153-
Continuing gives you ${pluralize('day', daysLeft)} to preview
154-
${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} on` : ''} private
155-
repositories.<br />
154+
Continuing gives you ${pluralize('day', proPreviewLengthInDays - consumedDaysCount)} to
155+
preview ${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} on` : ''}
156+
private repositories.<br />
156157
${appearance !== 'alert' ? html`<br />` : ''} For full access to Pro features
157158
<a href="${generateCommandLink(Commands.PlusSignUp, this.source)}"
158159
>start your free ${proTrialLengthInDays}-day Pro trial</a

src/webviews/apps/shared/components/feature-gate.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ export class GlFeatureGate extends LitElement {
9090
}
9191
`;
9292

93-
@property({ type: Boolean })
94-
allowFeaturePreviewTrial?: boolean;
95-
9693
@property({ type: Object })
9794
featureInPreviewTrial?: {
9895
[key in Sources]?: { consumedDays: { startedOn: string; expiresOn: string }[]; isActive: boolean };
@@ -137,7 +134,6 @@ export class GlFeatureGate extends LitElement {
137134
.featureWithArticleIfNeeded=${this.featureWithArticleIfNeeded}
138135
.source=${this.source}
139136
.state=${this.state}
140-
.allowFeaturePreviewTrial=${this.allowFeaturePreviewTrial}
141137
.featureInPreviewTrial=${this.featureInPreviewTrial}
142138
featurePreviewTrialCommandLink=${this.featurePreviewTrialCommandLink}
143139
></gl-feature-gate-plus-state>

0 commit comments

Comments
 (0)