Introduce isStagingServer util method

This commit is contained in:
Fedor Indutny
2024-09-04 11:12:45 -07:00
committed by GitHub
parent 4cdb6fab08
commit cd44a7a033
24 changed files with 80 additions and 71 deletions

View File

@@ -42,7 +42,7 @@ export function InstallScreenChoosingDeviceNameStep({
normalizedName.length <= MAX_DEVICE_NAME_LENGTH;
let maybeBackupInput: JSX.Element | undefined;
if (getEnvironment() !== Environment.Production) {
if (getEnvironment() !== Environment.PackagedApp) {
maybeBackupInput = (
<label className="module-InstallScreenChoosingDeviceNameStep__input">
{/* Since this is only for testing - we don't require translation */}

View File

@@ -58,6 +58,7 @@ function Simulation({
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={provisioningUrl}
updates={DEFAULT_UPDATES}
OS="macOS"
@@ -72,6 +73,7 @@ export function QrCodeLoading(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={{
loadingState: LoadingState.Loading,
}}
@@ -88,6 +90,7 @@ export function QrCodeFailedToLoad(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={{
loadingState: LoadingState.LoadFailed,
error: InstallScreenQRCodeError.Unknown,
@@ -105,6 +108,7 @@ export function QrCodeLoaded(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={LOADED_URL}
updates={DEFAULT_UPDATES}
OS="macOS"
@@ -164,6 +168,7 @@ export const WithUpdateKnobs: StoryFn<PropsType & { dialogType: DialogType }> =
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={LOADED_URL}
hasExpired
updates={{

View File

@@ -19,7 +19,6 @@ import { InstallScreenSignalLogo } from './InstallScreenSignalLogo';
import { InstallScreenUpdateDialog } from './InstallScreenUpdateDialog';
import { getClassNamesFor } from '../../util/getClassNamesFor';
import type { UpdatesStateType } from '../../state/ducks/updates';
import { Environment, getEnvironment } from '../../environment';
// We can't always use destructuring assignment because of the complexity of this props
// type.
@@ -31,6 +30,7 @@ export type PropsType = Readonly<{
updates: UpdatesStateType;
currentVersion: string;
OS: string;
isStaging: boolean;
retryGetQrCode: () => void;
startUpdate: () => void;
}>;
@@ -46,6 +46,7 @@ export function InstallScreenQrCodeNotScannedStep({
currentVersion,
hasExpired,
i18n,
isStaging,
OS,
provisioningUrl,
retryGetQrCode,
@@ -102,12 +103,12 @@ export function InstallScreenQrCodeNotScannedStep({
/>
</li>
</ol>
{getEnvironment() !== Environment.Staging ? (
{isStaging ? (
'THIS IS A STAGING DESKTOP'
) : (
<a target="_blank" rel="noreferrer" href={SUPPORT_PAGE}>
{i18n('icu:Install__support-link')}
</a>
) : (
'THIS IS A STAGING DESKTOP'
)}
</div>
</div>