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