Skip to content

Commit

Permalink
Downtime notice for 2024-12-11
Browse files Browse the repository at this point in the history
  • Loading branch information
marksvc committed Dec 10, 2024
1 parent 10465ef commit c4b75ce
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
Expand All @@ -14,16 +14,16 @@ import { NoticeComponent } from '../notice/notice.component';
templateUrl: './global-notices.component.html',
styleUrl: './global-notices.component.scss'
})
export class GlobalNoticesComponent {
export class GlobalNoticesComponent implements OnInit {
// This is only an input so that the Storybook can turn this on even when it's off in the app
@Input() showDowntimeNotice = false;

upcomingDowntime = {
start: new Date('2024-12-04 16:30 UTC'),
start: new Date('2024-12-11 16:30 UTC'),
durationMin: 2,
durationMax: 6,
durationMax: 3,
durationUnit: 'hour',
detailsUrl: 'https://software.sil.org/scriptureforge/scripture-forge-will-be-unavailable-for-scheduled-maintenance/'
detailsUrl: 'https://software.sil.org/scriptureforge/news/'
} as const;

constructor(readonly i18n: I18nService) {}
Expand All @@ -34,4 +34,11 @@ export class GlobalNoticesComponent {
max: this.upcomingDowntime.durationMax
});
}

ngOnInit(): void {
const fifteenMinutesMs = 15 * 60 * 1000;
const fifteenMinutesPastStart = new Date(this.upcomingDowntime.start.getTime() + fifteenMinutesMs);
// Show the downtime notice up until 15 minutes past the start time.
this.showDowntimeNotice = new Date() <= fifteenMinutesPastStart;
}
}

0 comments on commit c4b75ce

Please sign in to comment.