Browse Source

Add upgrade plan button (#2937)

pull/2938/head
Thomas Kaul 12 months ago
committed by GitHub
parent
commit
40b6777814
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      apps/api/src/app/user/user.service.ts
  2. 26
      apps/client/src/app/components/header/header.component.html
  3. 2
      apps/client/src/app/components/header/header.module.ts
  4. 4
      apps/client/src/app/components/user-account-membership/user-account-membership.html

8
apps/api/src/app/user/user.service.ts

@ -219,18 +219,18 @@ export class UserService {
new Date(), new Date(),
user.createdAt user.createdAt
); );
let frequency = 15; let frequency = 10;
if (daysSinceRegistration > 365) { if (daysSinceRegistration > 365) {
frequency = 2; frequency = 2;
} else if (daysSinceRegistration > 180) { } else if (daysSinceRegistration > 180) {
frequency = 3; frequency = 3;
} else if (daysSinceRegistration > 60) { } else if (daysSinceRegistration > 60) {
frequency = 5; frequency = 4;
} else if (daysSinceRegistration > 30) { } else if (daysSinceRegistration > 30) {
frequency = 8; frequency = 6;
} else if (daysSinceRegistration > 15) { } else if (daysSinceRegistration > 15) {
frequency = 12; frequency = 8;
} }
if (Analytics?.activityCount % frequency === 1) { if (Analytics?.activityCount % frequency === 1) {

26
apps/client/src/app/components/header/header.component.html

@ -165,6 +165,32 @@
/> />
</button> </button>
<mat-menu #accountMenu="matMenu" xPosition="before"> <mat-menu #accountMenu="matMenu" xPosition="before">
<ng-container
*ngIf="
hasPermissionForSubscription &&
user?.subscription?.type === 'Basic'
"
>
<a class="d-flex" mat-menu-item [routerLink]="routerLinkPricing"
><span class="align-items-center d-flex"
><span
><ng-container
*ngIf="user.subscription.offer === 'default'"
i18n
>Upgrade Plan</ng-container
>
<ng-container
*ngIf="user.subscription.offer === 'renewal'"
i18n
>Renew Plan</ng-container
></span
>
<gf-premium-indicator
class="d-inline-block ml-1"
[enableLink]="false" /></span
></a>
<hr class="m-0" />
</ng-container>
<ng-container *ngIf="user?.access?.length > 0"> <ng-container *ngIf="user?.access?.length > 0">
<button mat-menu-item (click)="impersonateAccount(null)"> <button mat-menu-item (click)="impersonateAccount(null)">
<span class="align-items-center d-flex"> <span class="align-items-center d-flex">

2
apps/client/src/app/components/header/header.module.ts

@ -7,6 +7,7 @@ import { RouterModule } from '@angular/router';
import { LoginWithAccessTokenDialogModule } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.module'; import { LoginWithAccessTokenDialogModule } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.module';
import { GfAssistantModule } from '@ghostfolio/ui/assistant'; import { GfAssistantModule } from '@ghostfolio/ui/assistant';
import { GfLogoModule } from '@ghostfolio/ui/logo'; import { GfLogoModule } from '@ghostfolio/ui/logo';
import { GfPremiumIndicatorModule } from '@ghostfolio/ui/premium-indicator';
import { HeaderComponent } from './header.component'; import { HeaderComponent } from './header.component';
@ -17,6 +18,7 @@ import { HeaderComponent } from './header.component';
CommonModule, CommonModule,
GfAssistantModule, GfAssistantModule,
GfLogoModule, GfLogoModule,
GfPremiumIndicatorModule,
LoginWithAccessTokenDialogModule, LoginWithAccessTokenDialogModule,
MatButtonModule, MatButtonModule,
MatMenuModule, MatMenuModule,

4
apps/client/src/app/components/user-account-membership/user-account-membership.html

@ -15,10 +15,10 @@
> >
<button color="primary" mat-flat-button (click)="onCheckout()"> <button color="primary" mat-flat-button (click)="onCheckout()">
<ng-container *ngIf="user.subscription.offer === 'default'" i18n <ng-container *ngIf="user.subscription.offer === 'default'" i18n
>Upgrade</ng-container >Upgrade Plan</ng-container
> >
<ng-container *ngIf="user.subscription.offer === 'renewal'" i18n <ng-container *ngIf="user.subscription.offer === 'renewal'" i18n
>Renew</ng-container >Renew Plan</ng-container
> >
</button> </button>
<div *ngIf="price" class="mt-1 text-center"> <div *ngIf="price" class="mt-1 text-center">

Loading…
Cancel
Save