refactor download app message
This commit is contained in:
parent
aff12411b7
commit
3c69a8cba0
|
@ -7,12 +7,13 @@ import { convertBytesToHumanReadable } from 'utils/billing';
|
||||||
import { getEndpoint } from 'utils/common/apiUtil';
|
import { getEndpoint } from 'utils/common/apiUtil';
|
||||||
import { getToken } from 'utils/common/key';
|
import { getToken } from 'utils/common/key';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import { downloadApp, initiateEmail } from 'utils/common';
|
import { initiateEmail } from 'utils/common';
|
||||||
import { AppContext } from 'pages/_app';
|
import { AppContext } from 'pages/_app';
|
||||||
import { useLocalState } from 'hooks/useLocalState';
|
import { useLocalState } from 'hooks/useLocalState';
|
||||||
import { LS_KEYS } from 'utils/storage/localStorage';
|
import { LS_KEYS } from 'utils/storage/localStorage';
|
||||||
import { UserDetails } from 'types/user';
|
import { UserDetails } from 'types/user';
|
||||||
import EnteSpinner from 'components/EnteSpinner';
|
import EnteSpinner from 'components/EnteSpinner';
|
||||||
|
import { getDownloadAppMessage } from 'utils/ui';
|
||||||
|
|
||||||
export default function HelpSection() {
|
export default function HelpSection() {
|
||||||
const [userDetails] = useLocalState<UserDetails>(LS_KEYS.USER_DETAILS);
|
const [userDetails] = useLocalState<UserDetails>(LS_KEYS.USER_DETAILS);
|
||||||
|
@ -34,19 +35,7 @@ export default function HelpSection() {
|
||||||
if (isElectron()) {
|
if (isElectron()) {
|
||||||
setExportModalView(true);
|
setExportModalView(true);
|
||||||
} else {
|
} else {
|
||||||
setDialogMessage({
|
setDialogMessage(getDownloadAppMessage());
|
||||||
title: constants.DOWNLOAD_APP,
|
|
||||||
content: constants.DOWNLOAD_APP_MESSAGE,
|
|
||||||
|
|
||||||
proceed: {
|
|
||||||
text: constants.DOWNLOAD,
|
|
||||||
action: downloadApp,
|
|
||||||
variant: 'accent',
|
|
||||||
},
|
|
||||||
close: {
|
|
||||||
text: constants.CLOSE,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {
|
||||||
} from 'types/upload/ui';
|
} from 'types/upload/ui';
|
||||||
import { UPLOAD_STAGES } from 'constants/upload';
|
import { UPLOAD_STAGES } from 'constants/upload';
|
||||||
import importService from 'services/importService';
|
import importService from 'services/importService';
|
||||||
|
import { getDownloadAppMessage } from 'utils/ui';
|
||||||
|
|
||||||
const FIRST_ALBUM_NAME = 'My First Album';
|
const FIRST_ALBUM_NAME = 'My First Album';
|
||||||
|
|
||||||
|
@ -501,19 +502,7 @@ export default function Upload(props: Props) {
|
||||||
} else if (type === UPLOAD_TYPE.FOLDERS) {
|
} else if (type === UPLOAD_TYPE.FOLDERS) {
|
||||||
props.showUploadDirsDialog();
|
props.showUploadDirsDialog();
|
||||||
} else {
|
} else {
|
||||||
appContext.setDialogMessage({
|
appContext.setDialogMessage(getDownloadAppMessage());
|
||||||
title: constants.DOWNLOAD_APP,
|
|
||||||
content: constants.DOWNLOAD_APP_MESSAGE,
|
|
||||||
|
|
||||||
proceed: {
|
|
||||||
text: constants.DOWNLOAD,
|
|
||||||
action: downloadApp,
|
|
||||||
variant: 'accent',
|
|
||||||
},
|
|
||||||
close: {
|
|
||||||
text: constants.CLOSE,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
19
src/utils/ui/index.tsx
Normal file
19
src/utils/ui/index.tsx
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { DialogBoxAttributes } from 'types/dialogBox';
|
||||||
|
import { downloadApp } from 'utils/common';
|
||||||
|
import constants from 'utils/strings/constants';
|
||||||
|
|
||||||
|
export const getDownloadAppMessage = (): DialogBoxAttributes => {
|
||||||
|
return {
|
||||||
|
title: constants.DOWNLOAD_APP,
|
||||||
|
content: constants.DOWNLOAD_APP_MESSAGE,
|
||||||
|
|
||||||
|
proceed: {
|
||||||
|
text: constants.DOWNLOAD,
|
||||||
|
action: downloadApp,
|
||||||
|
variant: 'accent',
|
||||||
|
},
|
||||||
|
close: {
|
||||||
|
text: constants.CLOSE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in a new issue