Display correct link in DialogUpdate
This commit is contained in:
		
					parent
					
						
							
								5619eeca83
							
						
					
				
			
			
				commit
				
					
						910516f896
					
				
			
		
					 3 changed files with 28 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -49,6 +49,7 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
        dialogType={dialogType}
 | 
			
		||||
        didSnooze={didSnooze}
 | 
			
		||||
        hasNetworkDialog={hasNetworkDialog}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  );
 | 
			
		||||
| 
						 | 
				
			
			@ -70,6 +71,7 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.Update}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +81,7 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.DownloadReady}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
| 
						 | 
				
			
			@ -88,6 +91,7 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.Downloading}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +101,17 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.Cannot_Update}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
 | 
			
		||||
  story.add(`Cannot Update Beta (${name} container)`, () => (
 | 
			
		||||
    <FakeLeftPaneContainer containerWidthBreakpoint={containerWidthBreakpoint}>
 | 
			
		||||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.Cannot_Update}
 | 
			
		||||
        currentVersion="5.24.0-beta.1"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
| 
						 | 
				
			
			@ -106,6 +121,7 @@ story.add('Knobs Playground', () => {
 | 
			
		|||
      <DialogUpdate
 | 
			
		||||
        {...defaultPropsForBreakpoint}
 | 
			
		||||
        dialogType={DialogType.MacOS_Read_Only}
 | 
			
		||||
        currentVersion="5.24.0"
 | 
			
		||||
      />
 | 
			
		||||
    </FakeLeftPaneContainer>
 | 
			
		||||
  ));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
import React from 'react';
 | 
			
		||||
import formatFileSize from 'filesize';
 | 
			
		||||
 | 
			
		||||
import { isBeta } from '../util/version';
 | 
			
		||||
import { DialogType } from '../types/Dialogs';
 | 
			
		||||
import type { LocalizerType } from '../types/Util';
 | 
			
		||||
import { Intl } from './Intl';
 | 
			
		||||
| 
						 | 
				
			
			@ -23,8 +24,12 @@ export type PropsType = {
 | 
			
		|||
  snoozeUpdate: () => void;
 | 
			
		||||
  startUpdate: () => void;
 | 
			
		||||
  version?: string;
 | 
			
		||||
  currentVersion: string;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const PRODUCTION_DOWNLOAD_URL = 'https://signal.org/download/';
 | 
			
		||||
const BETA_DOWNLOAD_URL = 'https://support.signal.org/beta';
 | 
			
		||||
 | 
			
		||||
export const DialogUpdate = ({
 | 
			
		||||
  containerWidthBreakpoint,
 | 
			
		||||
  dialogType,
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +42,7 @@ export const DialogUpdate = ({
 | 
			
		|||
  snoozeUpdate,
 | 
			
		||||
  startUpdate,
 | 
			
		||||
  version,
 | 
			
		||||
  currentVersion,
 | 
			
		||||
}: PropsType): JSX.Element | null => {
 | 
			
		||||
  if (hasNetworkDialog) {
 | 
			
		||||
    return null;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +57,9 @@ export const DialogUpdate = ({
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  if (dialogType === DialogType.Cannot_Update) {
 | 
			
		||||
    const url = isBeta(currentVersion)
 | 
			
		||||
      ? BETA_DOWNLOAD_URL
 | 
			
		||||
      : PRODUCTION_DOWNLOAD_URL;
 | 
			
		||||
    return (
 | 
			
		||||
      <LeftPaneDialog
 | 
			
		||||
        containerWidthBreakpoint={containerWidthBreakpoint}
 | 
			
		||||
| 
						 | 
				
			
			@ -62,11 +71,11 @@ export const DialogUpdate = ({
 | 
			
		|||
            components={[
 | 
			
		||||
              <a
 | 
			
		||||
                key="signal-download"
 | 
			
		||||
                href="https://signal.org/download/"
 | 
			
		||||
                href={url}
 | 
			
		||||
                rel="noreferrer"
 | 
			
		||||
                target="_blank"
 | 
			
		||||
              >
 | 
			
		||||
                https://signal.org/download/
 | 
			
		||||
                {url}
 | 
			
		||||
              </a>,
 | 
			
		||||
            ]}
 | 
			
		||||
            i18n={i18n}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ const mapStateToProps = (state: StateType, ownProps: PropsType) => {
 | 
			
		|||
    ...state.updates,
 | 
			
		||||
    hasNetworkDialog: hasNetworkDialog(state),
 | 
			
		||||
    i18n: getIntl(state),
 | 
			
		||||
    currentVersion: window.getVersion(),
 | 
			
		||||
    ...ownProps,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue