Skip to content

Commit

Permalink
chore: activity should be locked when now countdown start date is pro…
Browse files Browse the repository at this point in the history
…vided
  • Loading branch information
jfmcquade committed Dec 23, 2024
1 parent 82f8d01 commit ec7bd1a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
class="activity-container"
[attr.data-language-direction]="templateTranslateService.languageDirection()"
>
<div class="progress-tracker">
<div class="progress-bar-container">
<div
class="progress-bar"
[ngStyle]="{
width: progressPercentage() + '%'
}"
></div>
@if (params.countdownStartDate) {
<div class="progress-tracker">
<div class="progress-bar-container">
<div
class="progress-bar"
[ngStyle]="{
width: progressPercentage() + '%'
}"
></div>
</div>
<div class="countdown-text">{{ countdownText() }}</div>
</div>
<div class="countdown-text">{{ countdownText() }}</div>
</div>
}

<div class="image">
<img [src]="params.lockedImageAsset | plhAsset" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class PlhActivityCheckInComponent extends TemplateBaseComponent implement

daysUntilUnlock = signal(Infinity);
locked = computed(() => {
// If no start date is provided, activity should be locked
if (!this.params.countdownStartDate) return true;
return this.daysUntilUnlock() && this.daysUntilUnlock() > 0;
});
countdownText = computed(() => {
Expand Down Expand Up @@ -93,6 +95,7 @@ export class PlhActivityCheckInComponent extends TemplateBaseComponent implement
// Attempt to parse from ISO format
parsedDate = parseISO(countdownStartDate);
if (!isValid(parsedDate)) {
parsedDate = null;
console.error(
`[ACTIVITY CHECK-IN] Invalid date for countdown_start_date: ${countdownStartDate}`
);
Expand Down

0 comments on commit ec7bd1a

Please sign in to comment.