Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/distinguish today s data point in admin panel (#711)

Thomas Kaul122107c8a149
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8cf7b7b8ae..662336f7e7 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
- Moved the countries and sectors charts in the position detail dialog
+- Distinguished today's data point of historical data in the admin control panel
- Restructured the server modules
### Fixed
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 23c20178f8..00b42388b2 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
@@ -19,7 +19,10 @@
marketDataByMonth[itemByMonth.key][
i + 1 < 10 ? '0' + (i + 1) : i + 1
]?.day ===
- i + 1
+ i + 1,
+ today: isToday(
+ itemByMonth.key + '-' + (i + 1 < 10 ? '0' + (i + 1) : i + 1)
+ )
}"
[title]="
(itemByMonth.key + '-' + (i + 1 < 10 ? '0' + (i + 1) : i + 1)
diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.scss b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.scss
index 128c63cca2..13db0835ba 100644
--- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.scss
+++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.scss
@@ -25,5 +25,10 @@
&.available {
background-color: var(--success);
}
+
+ &.today {
+ background-color: rgba(var(--palette-accent-500), 1);
+ cursor: default;
+ }
}
}
diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts
index fa24f5941c..210f48805d 100644
--- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts
+++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts
@@ -12,7 +12,7 @@ import { DEFAULT_DATE_FORMAT } from '@ghostfolio/common/config';
import { DATE_FORMAT } from '@ghostfolio/common/helper';
import { LineChartItem } from '@ghostfolio/ui/line-chart/interfaces/line-chart.interface';
import { DataSource, MarketData } from '@prisma/client';
-import { format, isBefore, isValid, parse } from 'date-fns';
+import { format, isBefore, isSameDay, isValid, parse } from 'date-fns';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject, takeUntil } from 'rxjs';
@@ -82,6 +82,11 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {
return isValid(date) && isBefore(date, new Date());
}
+ public isToday(aDateString: string) {
+ const date = parse(aDateString, DATE_FORMAT, new Date());
+ return isValid(date) && isSameDay(date, new Date());
+ }
+
public onOpenMarketDataDetail({
day,
yearMonth
@@ -89,13 +94,18 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {
day: string;
yearMonth: string;
}) {
+ const date = new Date(`${yearMonth}-${day}`);
const marketPrice = this.marketDataByMonth[yearMonth]?.[day]?.marketPrice;
+ if (isSameDay(date, new Date())) {
+ return;
+ }
+
const dialogRef = this.dialog.open(MarketDataDetailDialog, {
data: {
+ date,
marketPrice,
dataSource: this.dataSource,
- date: new Date(`${yearMonth}-${day}`),
symbol: this.symbol
},
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',