type and string changes

This commit is contained in:
Abhinav-grd 2021-04-20 16:39:03 +05:30
parent eb9c6a9e95
commit f685036816
5 changed files with 31 additions and 17 deletions

View file

@ -15,6 +15,8 @@ import {
isOnFreePlan, isOnFreePlan,
isSubscriptionCancelled, isSubscriptionCancelled,
isSubscribed, isSubscribed,
SetConfirmAction,
SetDialogMessage,
} from 'utils/billingUtil'; } from 'utils/billingUtil';
import exportService from 'services/exportService'; import exportService from 'services/exportService';
@ -30,8 +32,8 @@ import LinkButton from 'pages/gallery/components/LinkButton';
interface Props { interface Props {
files: file[]; files: file[];
collections: collection[]; collections: collection[];
setConfirmAction: any; setConfirmAction: SetConfirmAction;
somethingWentWrong: any; setDialogMessage: SetDialogMessage;
setPlanModalView; setPlanModalView;
} }
export default function Sidebar(props: Props) { export default function Sidebar(props: Props) {
@ -181,7 +183,12 @@ export default function Sidebar(props: Props) {
<RecoveryKeyModal <RecoveryKeyModal
show={recoverModalView} show={recoverModalView}
onHide={() => setRecoveryModalView(false)} onHide={() => setRecoveryModalView(false)}
somethingWentWrong={props.somethingWentWrong} somethingWentWrong={() =>
props.setDialogMessage({
title: constants.RECOVER_KEY_GENERATION_FAILED,
close: { variant: 'danger' },
})
}
/> />
<LinkButton onClick={() => setRecoveryModalView(true)}> <LinkButton onClick={() => setRecoveryModalView(true)}>
{constants.DOWNLOAD_RECOVERY_KEY} {constants.DOWNLOAD_RECOVERY_KEY}

View file

@ -11,6 +11,9 @@ import {
isUserSubscribedPlan, isUserSubscribedPlan,
isSubscriptionCancelled, isSubscriptionCancelled,
updatePaymentMethod, updatePaymentMethod,
SetConfirmAction,
SetDialogMessage,
SetLoading,
} from 'utils/billingUtil'; } from 'utils/billingUtil';
import { CONFIRM_ACTION } from 'components/ConfirmDialog'; import { CONFIRM_ACTION } from 'components/ConfirmDialog';
import { LoadingOverlay } from './CollectionSelector'; import { LoadingOverlay } from './CollectionSelector';
@ -35,10 +38,10 @@ export const PlanIcon = styled.div<{ selected: boolean }>`
interface Props { interface Props {
modalView: boolean; modalView: boolean;
closeModal: any; closeModal: any;
setDialogMessage; setDialogMessage: SetDialogMessage;
setConfirmAction; setConfirmAction: SetConfirmAction;
setSelectedPlan; setSelectedPlan;
setLoading; setLoading: SetLoading;
} }
enum PLAN_PERIOD { enum PLAN_PERIOD {
MONTH = 'month', MONTH = 'month',

View file

@ -514,12 +514,7 @@ export default function Gallery(props: Props) {
files={data} files={data}
collections={collections} collections={collections}
setConfirmAction={setConfirmAction} setConfirmAction={setConfirmAction}
somethingWentWrong={() => setDialogMessage={setDialogMessage}
setDialogMessage({
title: constants.UNKNOWN_ERROR,
close: { variant: 'danger' },
})
}
setPlanModalView={setPlanModalView} setPlanModalView={setPlanModalView}
/> />
<UploadButton openFileUploader={props.openFileUploader} /> <UploadButton openFileUploader={props.openFileUploader} />

View file

@ -11,9 +11,13 @@ import { getData, LS_KEYS } from './storage/localStorage';
import { MessageAttributes } from 'components/MessageDialog'; import { MessageAttributes } from 'components/MessageDialog';
import { NextRouter } from 'next/router'; import { NextRouter } from 'next/router';
type SetDialogMessage = React.Dispatch<React.SetStateAction<MessageAttributes>>; export type SetDialogMessage = React.Dispatch<
type SetLoading = React.Dispatch<React.SetStateAction<Boolean>>; React.SetStateAction<MessageAttributes>
type SetConfirmAction = React.Dispatch<React.SetStateAction<CONFIRM_ACTION>>; >;
export type SetLoading = React.Dispatch<React.SetStateAction<Boolean>>;
export type SetConfirmAction = React.Dispatch<
React.SetStateAction<CONFIRM_ACTION>
>;
export function convertBytesToGBs(bytes, precision?): string { export function convertBytesToGBs(bytes, precision?): string {
return (bytes / (1024 * 1024 * 1024)).toFixed(precision ?? 2); return (bytes / (1024 * 1024 * 1024)).toFixed(precision ?? 2);

View file

@ -125,6 +125,8 @@ const englishConstants = {
SAVE: 'save', SAVE: 'save',
RECOVERY_KEY_DESCRIPTION: RECOVERY_KEY_DESCRIPTION:
'if you forget your password, the only way you can recover your data is with this key', 'if you forget your password, the only way you can recover your data is with this key',
RECOVER_KEY_GENERATION_FAILED:
'recovery code could be generated, please try again',
KEY_NOT_STORED_DISCLAIMER: KEY_NOT_STORED_DISCLAIMER:
"we don't store this key, so please save this in a safe place", "we don't store this key, so please save this in a safe place",
RECOVERY_KEY_FILENAME: 'ente-recovery-key.txt', RECOVERY_KEY_FILENAME: 'ente-recovery-key.txt',
@ -147,6 +149,9 @@ const englishConstants = {
CHANGE: 'change', CHANGE: 'change',
CHANGE_EMAIL: 'change email ?', CHANGE_EMAIL: 'change email ?',
OK: 'ok', OK: 'ok',
SUCCESS: 'success',
ERROR: 'error',
MESSAGE: 'message',
INSTALL_MOBILE_APP: () => ( INSTALL_MOBILE_APP: () => (
<div> <div>
install our{' '} install our{' '}
@ -209,13 +214,13 @@ const englishConstants = {
), ),
SUBSCRIPTION_PURCHASE_SUCCESS: (expiryTime) => ( SUBSCRIPTION_PURCHASE_SUCCESS: (expiryTime) => (
<h4> <>
<p>we've received your payment</p> <p>we've received your payment</p>
<p> <p>
your subscription is valid till{' '} your subscription is valid till{' '}
<strong>{dateString(expiryTime)}</strong> <strong>{dateString(expiryTime)}</strong>
</p> </p>
</h4> </>
), ),
SUBSCRIPTION_PURCHASE_CANCELLED: SUBSCRIPTION_PURCHASE_CANCELLED:
'your purchase was canceled, please try again if you want to subscribe', 'your purchase was canceled, please try again if you want to subscribe',