Browse Source

feat(lib): update days to improve readability

pull/6337/head
KenTandrian 1 month ago
parent
commit
7e819f7212
  1. 13
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html
  2. 2
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts

13
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html

@ -3,25 +3,24 @@
<div class="d-flex"> <div class="d-flex">
<div class="date mr-1 text-nowrap">{{ itemByMonth.key }}</div> <div class="date mr-1 text-nowrap">{{ itemByMonth.key }}</div>
<div class="align-items-center d-flex flex-grow-1 px-1"> <div class="align-items-center d-flex flex-grow-1 px-1">
@for (dayItem of days; track dayItem; let i = $index) { @for (day of days; track day) {
<div <div
class="day" class="day"
[ngClass]="{ [ngClass]="{
'cursor-pointer valid': isDateOfInterest( 'cursor-pointer valid': isDateOfInterest(
`${itemByMonth.key}-${formatDay(i + 1)}` `${itemByMonth.key}-${formatDay(day)}`
), ),
available: available:
marketDataByMonth[itemByMonth.key][formatDay(i + 1)] marketDataByMonth[itemByMonth.key][formatDay(day)]?.marketPrice,
?.marketPrice, today: isToday(`${itemByMonth.key}-${formatDay(day)}`)
today: isToday(`${itemByMonth.key}-${formatDay(i + 1)}`)
}" }"
[title]=" [title]="
(`${itemByMonth.key}-${formatDay(i + 1)}` (`${itemByMonth.key}-${formatDay(day)}`
| date: defaultDateFormat()) ?? '' | date: defaultDateFormat()) ?? ''
" "
(click)=" (click)="
onOpenMarketDataDetail({ onOpenMarketDataDetail({
day: formatDay(i + 1), day: formatDay(day),
yearMonth: itemByMonth.key yearMonth: itemByMonth.key
}) })
" "

2
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts

@ -91,7 +91,7 @@ export class GfHistoricalMarketDataEditorComponent
public readonly locale = input(getLocale()); public readonly locale = input(getLocale());
public readonly marketData = input.required<MarketData[]>(); public readonly marketData = input.required<MarketData[]>();
protected readonly days = Array(31); protected readonly days = Array.from({ length: 31 }, (_, i) => i + 1);
protected readonly defaultDateFormat = computed(() => protected readonly defaultDateFormat = computed(() =>
getDateFormatString(this.locale()) getDateFormatString(this.locale())
); );

Loading…
Cancel
Save