Browse Source

feat(app): sort by name

pull/4634/head
KenTandrian 4 months ago
parent
commit
d863978e18
  1. 4
      apps/api/src/app/endpoints/watchlist/watchlist.service.ts
  2. 13
      apps/client/src/app/components/home-watchlist/home-watchlist.component.ts

4
apps/api/src/app/endpoints/watchlist/watchlist.service.ts

@ -120,13 +120,13 @@ export class WatchlistService {
); );
return { return {
dataSource, dataSource,
symbol,
performances: { performances: {
allTimeHigh: { allTimeHigh: {
date: ath?.date, date: ath?.date,
performancePercent performancePercent
} }
} },
symbol
}; };
}) })
); );

13
apps/client/src/app/components/home-watchlist/home-watchlist.component.ts

@ -6,6 +6,7 @@ import {
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { BenchmarkTrend } from '@ghostfolio/common/types';
import { GfBenchmarkComponent } from '@ghostfolio/ui/benchmark'; import { GfBenchmarkComponent } from '@ghostfolio/ui/benchmark';
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator';
@ -118,17 +119,17 @@ export class HomeWatchlistComponent implements OnDestroy, OnInit {
.fetchWatchlist() .fetchWatchlist()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ watchlist }) => { .subscribe(({ watchlist }) => {
this.watchlist = watchlist.map( this.watchlist = watchlist
({ dataSource, performances, symbol }) => ({ .map(({ dataSource, performances, symbol }) => ({
dataSource, dataSource,
performances, performances,
symbol, symbol,
marketCondition: null, marketCondition: null,
name: symbol, name: symbol,
trend50d: 'UNKNOWN', trend50d: 'UNKNOWN' as BenchmarkTrend,
trend200d: 'UNKNOWN' trend200d: 'UNKNOWN' as BenchmarkTrend
}) }))
); .sort((a, b) => a.name.localeCompare(b.name));
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });

Loading…
Cancel
Save