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

View file

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

View file

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

View file

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

View file

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