From b259ab7b0c62b4b261831a1acb7073f4252d51fe Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 30 Jul 2023 18:49:38 +0200 Subject: [PATCH] Feature/add step by step introduction for new users (#2191) * Add introduction for new users * Update changelog --- CHANGELOG.md | 6 + apps/api/src/app/user/user.service.ts | 26 +++- .../home-overview/home-overview.html | 145 ++++++++++++------ .../home-overview/home-overview.module.ts | 2 + .../home-overview/home-overview.scss | 4 + apps/client/src/locales/messages.de.xlf | 100 +++++++++++- apps/client/src/locales/messages.es.xlf | 100 +++++++++++- apps/client/src/locales/messages.fr.xlf | 100 +++++++++++- apps/client/src/locales/messages.it.xlf | 100 +++++++++++- apps/client/src/locales/messages.nl.xlf | 100 +++++++++++- apps/client/src/locales/messages.pt.xlf | 100 +++++++++++- apps/client/src/locales/messages.xlf | 90 ++++++++++- 12 files changed, 780 insertions(+), 93 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 255d90127..606cc970a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added a step by step introduction for new users + ## 1.294.0 - 2023-07-29 ### Changed diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index 19ead8bd7..3c1e42abf 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -14,6 +14,7 @@ import { import { UserWithSettings } from '@ghostfolio/common/types'; import { Injectable } from '@nestjs/common'; import { Prisma, Role, User } from '@prisma/client'; +import { differenceInDays } from 'date-fns'; import { sortBy } from 'lodash'; const crypto = require('crypto'); @@ -165,11 +166,26 @@ export class UserService { user.subscription = this.subscriptionService.getSubscription(Subscription); - if ( - Analytics?.activityCount % 5 === 0 && - user.subscription?.type === 'Basic' - ) { - currentPermissions.push(permissions.enableSubscriptionInterstitial); + if (user.subscription?.type === 'Basic') { + const daysSinceRegistration = differenceInDays( + new Date(), + user.createdAt + ); + let frequency = 20; + + if (daysSinceRegistration > 180) { + frequency = 3; + } else if (daysSinceRegistration > 60) { + frequency = 5; + } else if (daysSinceRegistration > 30) { + frequency = 10; + } else if (daysSinceRegistration > 15) { + frequency = 15; + } + + if (Analytics?.activityCount % frequency === 1) { + currentPermissions.push(permissions.enableSubscriptionInterstitial); + } } if (user.subscription?.type === 'Premium') { diff --git a/apps/client/src/app/components/home-overview/home-overview.html b/apps/client/src/app/components/home-overview/home-overview.html index 6c0644021..c11734155 100644 --- a/apps/client/src/app/components/home-overview/home-overview.html +++ b/apps/client/src/app/components/home-overview/home-overview.html @@ -1,57 +1,110 @@
Ready to take control of your personal finances?
+