feat: Show the build date on the loading banner of unreleased builds (#2659)
This commit is contained in:
@@ -9,7 +9,8 @@ import { customElement, property } from 'lit/decorators.js';
|
||||
|
||||
import loadingStyle from '../scss/loading.scss?inline';
|
||||
import type { EffectName, EffectsManagerInterface } from '../types';
|
||||
import { getReleaseVersion } from '../utils/build-info.js';
|
||||
import { formatDateAndTime } from '../utils/basic.js';
|
||||
import { getReleaseVersion, getUnreleasedBuildDate } from '../utils/build-info.js';
|
||||
|
||||
import './icon';
|
||||
|
||||
@@ -80,10 +81,14 @@ export class AdvancedCameraCardLoading extends LitElement {
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
const buildDate = getUnreleasedBuildDate();
|
||||
|
||||
return html`<advanced-camera-card-icon
|
||||
.icon=${{ icon: 'advanced-camera-card:iris' }}
|
||||
></advanced-camera-card-icon
|
||||
><span>${getReleaseVersion()}</span>`;
|
||||
><span>${getReleaseVersion()}</span> ${buildDate
|
||||
? html`<span class="build-date">${formatDateAndTime(buildDate, true)}</span>`
|
||||
: ''}`;
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
||||
@@ -53,3 +53,8 @@ advanced-camera-card-icon {
|
||||
span {
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.build-date {
|
||||
font-size: medium;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
declare const __ADVANCED_CAMERA_CARD_RELEASE_VERSION__: string | undefined;
|
||||
declare const __ADVANCED_CAMERA_CARD_IS_RELEASE_BUILD__: boolean | undefined;
|
||||
declare const __ADVANCED_CAMERA_CARD_GIT_HASH__: string | undefined;
|
||||
declare const __ADVANCED_CAMERA_CARD_GIT_DATE__: string | undefined;
|
||||
declare const __ADVANCED_CAMERA_CARD_BUILD_DATE__: string | undefined;
|
||||
@@ -25,6 +26,14 @@ const BUILD_DATE =
|
||||
typeof __ADVANCED_CAMERA_CARD_BUILD_DATE__ === 'undefined'
|
||||
? undefined
|
||||
: __ADVANCED_CAMERA_CARD_BUILD_DATE__;
|
||||
|
||||
const IS_RELEASE_BUILD =
|
||||
typeof __ADVANCED_CAMERA_CARD_IS_RELEASE_BUILD__ === 'undefined'
|
||||
? false
|
||||
: __ADVANCED_CAMERA_CARD_IS_RELEASE_BUILD__;
|
||||
|
||||
const UNRELEASED_BUILD_DATE =
|
||||
!IS_RELEASE_BUILD && BUILD_DATE ? new Date(BUILD_DATE) : null;
|
||||
/* v8 ignore stop -- @preserve */
|
||||
|
||||
export interface GitInfo {
|
||||
@@ -34,6 +43,8 @@ export interface GitInfo {
|
||||
}
|
||||
|
||||
export const getReleaseVersion = (): string => RELEASE_VERSION;
|
||||
export const getUnreleasedBuildDate = (): Date | null => UNRELEASED_BUILD_DATE;
|
||||
|
||||
export const getGitInfo = (): GitInfo => ({
|
||||
hash: GIT_HASH,
|
||||
commitDate: GIT_DATE,
|
||||
|
||||
Reference in New Issue
Block a user