From 436f791fa44f8000f81feff55def18028ea04454 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 9 Feb 2023 21:22:55 +0100 Subject: [PATCH 1/5] Feature/upgrade chart.js to version 4.2.0 (#1567) * Upgrade chart.js to version 4.2.0 * Update changelog --- CHANGELOG.md | 6 ++++ .../benchmark-comparator.component.ts | 9 +++--- .../investment-chart.component.ts | 9 +++--- .../fire-calculator.component.ts | 2 +- .../lib/line-chart/line-chart.component.ts | 2 +- .../portfolio-proportion-chart.component.ts | 2 +- package.json | 6 ++-- yarn.lock | 31 ++++++++++++------- 8 files changed, 41 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3097955c..20157990d 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 + +### Changed + +- Upgraded `chart.js` from version `4.0.1` to `4.2.0` + ## 1.233.0 - 2023-02-09 ### Added diff --git a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts index 8adffa005..dd52fbcfd 100644 --- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts +++ b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts @@ -27,6 +27,7 @@ import { ColorScheme } from '@ghostfolio/common/types'; import { SymbolProfile } from '@prisma/client'; import { Chart, + ChartData, LineController, LineElement, LinearScale, @@ -57,7 +58,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy { @ViewChild('chartCanvas') chartCanvas; - public chart: Chart; + public chart: Chart<'line'>; public constructor() { Chart.register( @@ -89,14 +90,14 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy { } private initialize() { - const data = { + const data: ChartData<'line'> = { datasets: [ { backgroundColor: `rgb(${primaryColorRgb.r}, ${primaryColorRgb.g}, ${primaryColorRgb.b})`, borderColor: `rgb(${primaryColorRgb.r}, ${primaryColorRgb.g}, ${primaryColorRgb.b})`, borderWidth: 2, data: this.performanceDataItems.map(({ date, value }) => { - return { x: parseDate(date), y: value }; + return { x: parseDate(date).getTime(), y: value }; }), label: $localize`Portfolio` }, @@ -105,7 +106,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy { borderColor: `rgb(${secondaryColorRgb.r}, ${secondaryColorRgb.g}, ${secondaryColorRgb.b})`, borderWidth: 2, data: this.benchmarkDataItems.map(({ date, value }) => { - return { x: parseDate(date), y: value }; + return { x: parseDate(date).getTime(), y: value }; }), label: $localize`Benchmark` } diff --git a/apps/client/src/app/components/investment-chart/investment-chart.component.ts b/apps/client/src/app/components/investment-chart/investment-chart.component.ts index 65ecbabb8..6f27bceb4 100644 --- a/apps/client/src/app/components/investment-chart/investment-chart.component.ts +++ b/apps/client/src/app/components/investment-chart/investment-chart.component.ts @@ -29,6 +29,7 @@ import { BarController, BarElement, Chart, + ChartData, LineController, LineElement, LinearScale, @@ -62,7 +63,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { @ViewChild('chartCanvas') chartCanvas; - public chart: Chart; + public chart: Chart<'bar' | 'line'>; private investments: InvestmentItem[]; private values: LineChartItem[]; @@ -142,7 +143,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { }); } - const chartData = { + const chartData: ChartData<'line'> = { labels: this.historicalDataItems.map(({ date }) => { return parseDate(date); }), @@ -153,7 +154,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { borderWidth: this.groupBy ? 0 : 1, data: this.investments.map(({ date, investment }) => { return { - x: parseDate(date), + x: parseDate(date).getTime(), y: this.isInPercent ? investment * 100 : investment }; }), @@ -173,7 +174,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { borderWidth: 2, data: this.values.map(({ date, value }) => { return { - x: parseDate(date), + x: parseDate(date).getTime(), y: this.isInPercent ? value * 100 : value }; }), diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts index e4e77095d..e6cb7d587 100644 --- a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts +++ b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts @@ -61,7 +61,7 @@ export class FireCalculatorComponent principalInvestmentAmount: new FormControl(undefined), time: new FormControl(undefined) }); - public chart: Chart; + public chart: Chart<'bar'>; public isLoading = true; public projectedTotalAmount: number; diff --git a/libs/ui/src/lib/line-chart/line-chart.component.ts b/libs/ui/src/lib/line-chart/line-chart.component.ts index 4fdeddbc7..4be8fd12d 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -66,7 +66,7 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { @ViewChild('chartCanvas') chartCanvas; - public chart: Chart; + public chart: Chart<'line'>; public isLoading = true; private readonly ANIMATION_DURATION = 1200; diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts index 296776cc9..3ff0dd417 100644 --- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts +++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts @@ -55,7 +55,7 @@ export class PortfolioProportionChartComponent @ViewChild('chartCanvas') chartCanvas: ElementRef; - public chart: Chart; + public chart: Chart<'pie'>; public isLoading = true; private readonly OTHER_KEY = 'OTHER'; diff --git a/package.json b/package.json index 005ccfd4c..9a9c3e105 100644 --- a/package.json +++ b/package.json @@ -92,9 +92,9 @@ "bull": "4.10.2", "cache-manager": "3.4.3", "cache-manager-redis-store": "2.0.0", - "chart.js": "4.0.1", - "chartjs-adapter-date-fns": "2.0.1", - "chartjs-plugin-annotation": "2.1.0", + "chart.js": "4.2.0", + "chartjs-adapter-date-fns": "3.0.0", + "chartjs-plugin-annotation": "2.1.2", "chartjs-plugin-datalabels": "2.2.0", "cheerio": "1.0.0-rc.12", "class-transformer": "0.3.2", diff --git a/yarn.lock b/yarn.lock index 89ee494ca..143191ed1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3511,6 +3511,11 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@kurkle/color@^0.3.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.1.tgz#ef72bc8022ccf77cdd2715097f062ee591ec145c" + integrity sha512-hW0GwZj06z/ZFUW2Espl7toVDjghJN+EKqyXzPSV8NV89d5BYp5rRMBJoc+aUN0x5OXDMeRQHazejr2Xmqj2tw== + "@leichtgewicht/ip-codec@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz" @@ -8617,20 +8622,22 @@ chardet@^0.7.0: resolved "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chart.js@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.0.1.tgz#93d5d50ac222a5b3b6ac7488e82e1553ac031592" - integrity sha512-5/8/9eBivwBZK81mKvmIwTb2Pmw4D/5h1RK9fBWZLLZ8mCJ+kfYNmV9rMrGoa5Hgy2/wVDBMLSUDudul2/9ihA== +chart.js@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.2.0.tgz#dd281b2ce890bff32f3e249cf2972a1e74bc032c" + integrity sha512-wbtcV+QKeH0F7gQZaCJEIpsNriFheacouJQTVIjITi3eQA8bTlIBoknz0+dgV79aeKLNMAX+nDslIVE/nJ3rzA== + dependencies: + "@kurkle/color" "^0.3.0" -chartjs-adapter-date-fns@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-2.0.1.tgz#3d007d4985391362fb15c96310fff8376a434bae" - integrity sha512-v3WV9rdnQ05ce3A0ZCjzUekJCAbfm6+3HqSoeY2BIkdMYZoYr/4T+ril1tZyDl869lz6xdNVMXejUFT9YKpw4A== +chartjs-adapter-date-fns@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-3.0.0.tgz#c25f63c7f317c1f96f9a7c44bd45eeedb8a478e5" + integrity sha512-Rs3iEB3Q5pJ973J93OBTpnP7qoGwvq3nUnoMdtxO+9aoJof7UFcRbWcIDteXuYd1fgAvct/32T9qaLyLuZVwCg== -chartjs-plugin-annotation@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/chartjs-plugin-annotation/-/chartjs-plugin-annotation-2.1.0.tgz#c43172d26ec8e7e3bc104932d1a1807bf0c46db7" - integrity sha512-wHxP6mBWrgdldAEbHM5nMaMJ3PuunXgiotVh8natosuZsEqpjU0ZeyvMTBwIkKXLSDncb3faLunl4BI89Vmj/g== +chartjs-plugin-annotation@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/chartjs-plugin-annotation/-/chartjs-plugin-annotation-2.1.2.tgz#8c307c931fda735a1acf1b606ad0e3fd7d96299b" + integrity sha512-kmEp2WtpogwnKKnDPO3iO3mVwvVGtmG5BkZVtAEZm5YzJ9CYxojjYEgk7OTrFbJ5vU098b84UeJRe8kRfNcq5g== chartjs-plugin-datalabels@2.2.0: version "2.2.0" From cc184c2827d25f028df3a5456d930184e9a96519 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:27:26 +0100 Subject: [PATCH 2/5] Feature/upgrade prettier to version 2.8.4 (#1675) * Upgrade prettier to version 2.8.4 * Update changelog --- CHANGELOG.md | 1 + package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20157990d..7770a24a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Upgraded `chart.js` from version `4.0.1` to `4.2.0` +- Upgraded `prettier` from version `2.8.1` to `2.8.4` ## 1.233.0 - 2023-02-09 diff --git a/package.json b/package.json index 9a9c3e105..38e86bce3 100644 --- a/package.json +++ b/package.json @@ -181,7 +181,7 @@ "jest-environment-jsdom": "29.4.1", "jest-preset-angular": "12.2.3", "nx": "15.6.3", - "prettier": "2.8.1", + "prettier": "2.8.4", "prettier-plugin-organize-attributes": "0.0.5", "replace-in-file": "6.3.5", "rimraf": "3.0.2", diff --git a/yarn.lock b/yarn.lock index 143191ed1..3b6fbe2ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17961,10 +17961,10 @@ prettier-plugin-organize-attributes@0.0.5: resolved "https://registry.npmjs.org/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-0.0.5.tgz" integrity sha512-dSts16q8wd+oq8Zwk5mwmYXo1aN3B+ZkEJqx/ar5fedNHdOvx7S4XDMH/pNK7rmBW0bPXkp/kJX5gAANsWzh3A== -prettier@2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" - integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== +prettier@2.8.4: + version "2.8.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3" + integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw== "prettier@>=2.2.1 <=2.3.0": version "2.3.0" From eabd2f3934939be3a08a7bde66d0f7428e1653da Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 11 Feb 2023 09:55:03 +0100 Subject: [PATCH 3/5] Add url (#1683) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54395184a..1c319db54 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ Run `yarn start:server` ### Start Client -Run `yarn start:client` +Run `yarn start:client` and open http://localhost:4200/en in your browser ### Start _Storybook_ From b09d3cea95abbf369a5611cbe9142ee4feb01b5c Mon Sep 17 00:00:00 2001 From: Johannes Herforth Date: Sat, 11 Feb 2023 09:57:27 +0100 Subject: [PATCH 4/5] Fix landing page by setting a default value for countriesOfSubscribers * Set default value for countriesOfSubscribers * Update changelog --- CHANGELOG.md | 4 ++++ .../client/src/app/pages/landing/landing-page.component.ts | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7770a24a6..2afe206bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `chart.js` from version `4.0.1` to `4.2.0` - Upgraded `prettier` from version `2.8.1` to `2.8.4` +### Fixed + +- Fixed an issue on the landing page caused by the global heat map of subscribers + ## 1.233.0 - 2023-02-09 ### Added diff --git a/apps/client/src/app/pages/landing/landing-page.component.ts b/apps/client/src/app/pages/landing/landing-page.component.ts index f4a80c652..e2ad8a592 100644 --- a/apps/client/src/app/pages/landing/landing-page.component.ts +++ b/apps/client/src/app/pages/landing/landing-page.component.ts @@ -52,8 +52,11 @@ export class LandingPageComponent implements OnDestroy, OnInit { private dataService: DataService, private deviceService: DeviceDetectorService ) { - const { countriesOfSubscribers, globalPermissions, statistics } = - this.dataService.fetchInfo(); + const { + countriesOfSubscribers = [], + globalPermissions, + statistics + } = this.dataService.fetchInfo(); for (const country of countriesOfSubscribers) { this.countriesOfSubscribersMap[country] = { From efed7e3c2baf1ac3741edf27e105c2adbc3f364d Mon Sep 17 00:00:00 2001 From: BeauAgst <10343831+BeauAgst@users.noreply.github.com> Date: Sat, 11 Feb 2023 09:37:44 +0000 Subject: [PATCH 5/5] Modify default exposed port (#1681) * Modify default exposed port * Update changelog --- CHANGELOG.md | 1 + Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2afe206bb..290257c26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Set the exposed port as an environment variable (`PORT`) in `Dockerfile` - Upgraded `chart.js` from version `4.0.1` to `4.2.0` - Upgraded `prettier` from version `2.8.1` to `2.8.4` diff --git a/Dockerfile b/Dockerfile index 33ef2d95f..cdebe275d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,5 +57,5 @@ RUN apt update && apt install -y \ COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps WORKDIR /ghostfolio/apps/api -EXPOSE 3333 +EXPOSE ${PORT:-3333} CMD [ "yarn", "start:prod" ]