2021-11-20 17:39:03 +05:00
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
|
import { View } from 'react-native';
|
|
|
|
|
import { useTracked } from '../../provider';
|
|
|
|
|
import { DDS } from '../../services/DeviceDetection';
|
|
|
|
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
|
|
|
|
import { getElevation } from '../../utils';
|
|
|
|
|
import { eCloseResultDialog, eOpenResultDialog } from '../../utils/Events';
|
|
|
|
|
import { SIZE } from '../../utils/SizeUtils';
|
|
|
|
|
import { Button } from '../Button';
|
2020-10-28 15:15:35 +05:00
|
|
|
import BaseDialog from '../Dialog/base-dialog';
|
|
|
|
|
import Seperator from '../Seperator';
|
2020-11-20 01:23:05 +05:00
|
|
|
import Heading from '../Typography/Heading';
|
|
|
|
|
import Paragraph from '../Typography/Paragraph';
|
2021-11-20 17:39:03 +05:00
|
|
|
import { ProFeatures } from './pro-features';
|
2020-10-28 15:15:35 +05:00
|
|
|
|
|
|
|
|
const ResultDialog = () => {
|
|
|
|
|
const [state, dispatch] = useTracked();
|
|
|
|
|
const {colors} = state;
|
2021-11-20 17:39:42 +05:00
|
|
|
const [visible, setVisible] = useState(false);
|
2020-10-28 15:15:35 +05:00
|
|
|
const [dialogData, setDialogData] = useState({
|
2021-11-08 11:56:54 +05:00
|
|
|
title: 'Thank you for signing up!',
|
|
|
|
|
paragraph:
|
|
|
|
|
'Try out all features of Notesnook free for 7 days. No limitations. No commitments.',
|
|
|
|
|
button: 'Start taking notes'
|
2020-10-28 15:15:35 +05:00
|
|
|
});
|
|
|
|
|
useEffect(() => {
|
2021-11-20 17:39:03 +05:00
|
|
|
|
2020-10-28 15:15:35 +05:00
|
|
|
eSubscribeEvent(eOpenResultDialog, open);
|
|
|
|
|
eSubscribeEvent(eCloseResultDialog, close);
|
|
|
|
|
return () => {
|
|
|
|
|
eUnSubscribeEvent(eOpenResultDialog, open);
|
|
|
|
|
eUnSubscribeEvent(eCloseResultDialog, close);
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
|
2021-04-11 10:34:01 +05:00
|
|
|
const open = data => {
|
2021-11-11 13:07:28 +05:00
|
|
|
if (data) {
|
|
|
|
|
setDialogData(data);
|
2021-11-15 15:25:06 +05:00
|
|
|
}
|
2020-10-28 15:15:35 +05:00
|
|
|
setVisible(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const close = () => {
|
|
|
|
|
setVisible(false);
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-23 12:32:33 +05:00
|
|
|
return !visible ? null : (
|
|
|
|
|
<BaseDialog visible={true} onRequestClose={close}>
|
2020-10-28 15:15:35 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
...getElevation(5),
|
2020-12-22 10:27:51 +05:00
|
|
|
width: DDS.isTab ? 350 : '85%',
|
2021-11-08 11:56:54 +05:00
|
|
|
maxHeight: 500,
|
2021-11-08 15:06:46 +05:00
|
|
|
borderRadius: 10,
|
2020-10-28 15:15:35 +05:00
|
|
|
backgroundColor: colors.bg,
|
2021-11-15 15:25:06 +05:00
|
|
|
paddingTop: 20,
|
2020-10-28 15:15:35 +05:00
|
|
|
justifyContent: 'center',
|
2021-11-08 11:56:54 +05:00
|
|
|
alignItems: 'center'
|
2020-10-28 15:15:35 +05:00
|
|
|
}}>
|
2020-11-20 01:23:05 +05:00
|
|
|
<Heading
|
|
|
|
|
size={SIZE.lg}
|
2021-07-30 09:23:24 +05:00
|
|
|
textBreakStrategy="balanced"
|
2020-10-28 15:15:35 +05:00
|
|
|
style={{
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
marginTop: 10,
|
2021-11-15 15:25:06 +05:00
|
|
|
maxWidth: '100%',
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
paddingHorizontal: 12
|
2020-10-28 15:15:35 +05:00
|
|
|
}}>
|
|
|
|
|
{dialogData.title}
|
2020-11-20 01:23:05 +05:00
|
|
|
</Heading>
|
2021-11-08 15:06:46 +05:00
|
|
|
|
2020-11-20 01:23:05 +05:00
|
|
|
<Paragraph
|
|
|
|
|
color={colors.icon}
|
2021-11-08 11:56:54 +05:00
|
|
|
size={SIZE.md}
|
2020-10-28 15:15:35 +05:00
|
|
|
style={{
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
|
textAlign: 'center',
|
2021-03-09 10:39:57 +05:00
|
|
|
maxWidth: '80%',
|
2021-11-08 11:56:54 +05:00
|
|
|
lineHeight: SIZE.sm + 5
|
2020-10-28 15:15:35 +05:00
|
|
|
}}>
|
|
|
|
|
{dialogData.paragraph}
|
2020-11-20 01:23:05 +05:00
|
|
|
</Paragraph>
|
2021-11-08 15:06:46 +05:00
|
|
|
|
|
|
|
|
<Seperator />
|
|
|
|
|
|
2021-11-20 17:39:03 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
paddingHorizontal: 12,
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
width: '100%'
|
|
|
|
|
}}>
|
|
|
|
|
<ProFeatures count={4} />
|
|
|
|
|
</View>
|
2021-11-08 15:06:46 +05:00
|
|
|
|
2020-10-28 15:15:35 +05:00
|
|
|
<Seperator />
|
2021-11-15 15:25:06 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
backgroundColor: colors.nav,
|
|
|
|
|
width: '100%',
|
|
|
|
|
borderBottomRightRadius: 10,
|
|
|
|
|
borderBottomLeftRadius: 10,
|
|
|
|
|
paddingVertical: 10
|
|
|
|
|
}}>
|
|
|
|
|
<Button
|
|
|
|
|
title={dialogData.button}
|
|
|
|
|
width={null}
|
|
|
|
|
style={{
|
|
|
|
|
paddingHorizontal: 12
|
|
|
|
|
}}
|
|
|
|
|
onPress={close}
|
|
|
|
|
height={50}
|
|
|
|
|
fontSize={SIZE.md + 2}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
2020-10-28 15:15:35 +05:00
|
|
|
</View>
|
|
|
|
|
</BaseDialog>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default ResultDialog;
|