From 1e42d6bffac3c1267ee3cd1d4564079155a56e50 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Mon, 6 Mar 2023 19:58:43 +0100
Subject: [PATCH 1/2] Feature/harmonize axis style of charts (#1768)
* Harmonize axis style
* Update changelog
---
CHANGELOG.md | 1 +
.../admin-market-data-detail.component.html | 3 ++-
.../benchmark-comparator.component.ts | 17 ++++++++++++-----
.../components/home-market/home-market.html | 1 +
.../investment-chart.component.ts | 15 +++++++++++----
.../src/lib/line-chart/line-chart.component.ts | 18 ++++++++++++++----
6 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f64e93f2..e2524f6d4 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
+- Harmonized the axis style of charts
- Removed the environment variable `ENABLE_FEATURE_CUSTOM_SYMBOLS`
## 1.242.0 - 2023-03-04
diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html
index f7204d02f..dc64ed120 100644
--- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html
+++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html
@@ -1,6 +1,7 @@
{
+ if (
+ tick.value === 0 ||
+ tick.value === scale.max ||
+ tick.value === scale.min
+ ) {
+ return `rgba(${getTextColor(this.colorScheme)}, 0.1)`;
+ }
+
+ return 'transparent';
+ }
},
position: 'right',
ticks: {
diff --git a/apps/client/src/app/components/home-market/home-market.html b/apps/client/src/app/components/home-market/home-market.html
index de706aba8..cf6603be2 100644
--- a/apps/client/src/app/components/home-market/home-market.html
+++ b/apps/client/src/app/components/home-market/home-market.html
@@ -10,6 +10,7 @@
symbol="Fear & Greed Index"
yMax="100"
yMin="0"
+ [colorScheme]="user?.settings?.colorScheme"
[historicalDataItems]="historicalDataItems"
[isAnimated]="true"
[locale]="user?.settings?.locale"
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 6f27bceb4..4ce1a453c 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
@@ -283,7 +283,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
},
display: true,
grid: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`,
display: false
},
min: this.daysInMarket
@@ -298,13 +297,21 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
},
y: {
border: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.1)`,
display: false
},
display: !this.isInPercent,
grid: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`,
- display: false
+ color: ({ scale, tick }) => {
+ if (
+ tick.value === 0 ||
+ tick.value === scale.max ||
+ tick.value === scale.min
+ ) {
+ return `rgba(${getTextColor(this.colorScheme)}, 0.1)`;
+ }
+
+ return 'transparent';
+ }
},
position: 'right',
ticks: {
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 4be8fd12d..be43f9394 100644
--- a/libs/ui/src/lib/line-chart/line-chart.component.ts
+++ b/libs/ui/src/lib/line-chart/line-chart.component.ts
@@ -217,7 +217,6 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {
},
display: this.showXAxis,
grid: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`,
display: false
},
time: {
@@ -228,12 +227,23 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {
},
y: {
border: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.1)`
+ width: 0
},
display: this.showYAxis,
grid: {
- color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`,
- display: false
+ color: ({ scale, tick }) => {
+ if (
+ tick.value === 0 ||
+ tick.value === scale.max ||
+ tick.value === scale.min ||
+ tick.value === this.yMax ||
+ tick.value === this.yMin
+ ) {
+ return `rgba(${getTextColor(this.colorScheme)}, 0.1)`;
+ }
+
+ return 'transparent';
+ }
},
max: this.yMax,
min: this.yMin,
From 62c93ad99dcbefcfac25bdb6bee2ab45701eb171 Mon Sep 17 00:00:00 2001
From: Oleg Shvartsman
Date: Mon, 6 Mar 2023 15:02:20 -0500
Subject: [PATCH 2/2] Make NODE_ENV optional in production
* Make NODE_ENV optional
* Update changelog
---------
Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
---
CHANGELOG.md | 1 +
apps/api/src/app/frontend.middleware.ts | 12 ++----------
apps/api/src/main.ts | 11 +++--------
3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2524f6d4..9482e9f01 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
- Harmonized the axis style of charts
+- Made setting `NODE_ENV: production` optional (to avoid `ENOENT: no such file or directory` errors on startup)
- Removed the environment variable `ENABLE_FEATURE_CUSTOM_SYMBOLS`
## 1.242.0 - 2023-03-04
diff --git a/apps/api/src/app/frontend.middleware.ts b/apps/api/src/app/frontend.middleware.ts
index a43afa3f9..ea860b0e1 100644
--- a/apps/api/src/app/frontend.middleware.ts
+++ b/apps/api/src/app/frontend.middleware.ts
@@ -1,11 +1,11 @@
import * as fs from 'fs';
import * as path from 'path';
+import { environment } from '@ghostfolio/api/environments/environment';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config';
import { DATE_FORMAT } from '@ghostfolio/common/helper';
import { Injectable, NestMiddleware } from '@nestjs/common';
-import { ConfigService } from '@nestjs/config';
import { format } from 'date-fns';
import { NextFunction, Request, Response } from 'express';
@@ -18,18 +18,10 @@ export class FrontendMiddleware implements NestMiddleware {
public indexHtmlIt = '';
public indexHtmlNl = '';
public indexHtmlPt = '';
- public isProduction: boolean;
public constructor(
- private readonly configService: ConfigService,
private readonly configurationService: ConfigurationService
) {
- const NODE_ENV =
- this.configService.get<'development' | 'production'>('NODE_ENV') ??
- 'development';
-
- this.isProduction = NODE_ENV === 'production';
-
try {
this.indexHtmlDe = fs.readFileSync(
this.getPathOfIndexHtmlFile('de'),
@@ -100,7 +92,7 @@ export class FrontendMiddleware implements NestMiddleware {
if (
request.path.startsWith('/api/') ||
this.isFileRequest(request.url) ||
- !this.isProduction
+ !environment.production
) {
// Skip
next();
diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts
index e53ade52c..6def14ad0 100644
--- a/apps/api/src/main.ts
+++ b/apps/api/src/main.ts
@@ -10,15 +10,10 @@ async function bootstrap() {
const configApp = await NestFactory.create(AppModule);
const configService = configApp.get(ConfigService);
- const NODE_ENV =
- configService.get<'development' | 'production'>('NODE_ENV') ??
- 'development';
-
const app = await NestFactory.create(AppModule, {
- logger:
- NODE_ENV === 'production'
- ? ['error', 'log', 'warn']
- : ['debug', 'error', 'log', 'verbose', 'warn']
+ logger: environment.production
+ ? ['error', 'log', 'warn']
+ : ['debug', 'error', 'log', 'verbose', 'warn']
});
app.enableCors();
app.enableVersioning({