feat(calendar): add explained period feature and update translations
This commit is contained in:
1 parent
01c87d1e44
commit
dd16db8c87
12 files changed
+134
-123
No files matched your search
@@ -68,6 +68,9 @@ export class CalendarMonth implements OnInit {
|
||||
@Input()
|
||||
currentDate: string | null = null;
|
||||
|
||||
@Input()
|
||||
explainedPeriod?: { start: string; end: string };
|
||||
|
||||
@Input()
|
||||
dateStatuses: Readonly<Record<string, CalendarDayStatus>> = {};
|
||||
|
||||
@@ -94,6 +97,15 @@ export class CalendarMonth implements OnInit {
|
||||
return this.dateStatuses[this.getDateKey(day)];
|
||||
}
|
||||
|
||||
isInExplainedPeriod(day: Date): boolean {
|
||||
const date = this.getDateKey(day);
|
||||
return (
|
||||
!!this.explainedPeriod &&
|
||||
date >= this.explainedPeriod.start &&
|
||||
date <= this.explainedPeriod.end
|
||||
);
|
||||
}
|
||||
|
||||
getStatusMarker(day: Date): string {
|
||||
switch (this.getStatus(day)?.change) {
|
||||
case 'added':
|
||||
@@ -145,6 +157,10 @@ export class CalendarMonth implements OnInit {
|
||||
}
|
||||
const parts = [this.dayFormatter.format(day)];
|
||||
if (tooltip) parts.push(tooltip);
|
||||
if (this.getDateKey(day) === this.currentDate)
|
||||
parts.push(this.translationService.tr().planning.currentPlacement);
|
||||
if (this.isInExplainedPeriod(day))
|
||||
parts.push(this.translationService.tr().planning.explainedPeriod);
|
||||
if (!this.isInHorizon(day))
|
||||
parts.push(this.translationService.tr().planning.outsideHorizon);
|
||||
return parts.join('. ');
|
||||
|
||||
Reference in new issue
Block a user