2022-08-30 16:13:11 +05:00
|
|
|
/* This file is part of the Notesnook project (https://notesnook.com/)
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2022 Streetwriters (Private) Limited
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-08-29 16:19:17 +05:00
|
|
|
import React, { useEffect, useState } from "react";
|
2022-08-26 16:19:39 +05:00
|
|
|
import { View } from "react-native";
|
|
|
|
|
import { DDS } from "../../../services/device-detection";
|
|
|
|
|
import {
|
|
|
|
|
eSubscribeEvent,
|
|
|
|
|
eUnSubscribeEvent
|
|
|
|
|
} from "../../../services/event-manager";
|
2022-08-29 16:19:17 +05:00
|
|
|
import { useThemeStore } from "../../../stores/use-theme-store";
|
2022-08-26 16:19:39 +05:00
|
|
|
import { getElevation } from "../../../utils";
|
|
|
|
|
import { eCloseResultDialog, eOpenResultDialog } from "../../../utils/events";
|
|
|
|
|
import { SIZE } from "../../../utils/size";
|
|
|
|
|
import BaseDialog from "../../dialog/base-dialog";
|
2022-08-29 16:19:17 +05:00
|
|
|
import { Button } from "../../ui/button";
|
2022-08-26 16:19:39 +05:00
|
|
|
import Seperator from "../../ui/seperator";
|
|
|
|
|
import Heading from "../../ui/typography/heading";
|
|
|
|
|
import Paragraph from "../../ui/typography/paragraph";
|
|
|
|
|
import { ProFeatures } from "./pro-features";
|
2020-10-28 15:15:35 +05:00
|
|
|
|
|
|
|
|
const ResultDialog = () => {
|
2022-08-26 16:19:39 +05:00
|
|
|
const colors = useThemeStore((state) => state.colors);
|
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({
|
2022-08-26 16:19:39 +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(() => {
|
|
|
|
|
eSubscribeEvent(eOpenResultDialog, open);
|
|
|
|
|
eSubscribeEvent(eCloseResultDialog, close);
|
|
|
|
|
return () => {
|
|
|
|
|
eUnSubscribeEvent(eOpenResultDialog, open);
|
|
|
|
|
eUnSubscribeEvent(eCloseResultDialog, close);
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
|
2022-08-26 16:19:39 +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),
|
2022-08-26 16:19:39 +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,
|
2022-08-26 16:19:39 +05:00
|
|
|
justifyContent: "center",
|
|
|
|
|
alignItems: "center"
|
2022-01-22 12:57:05 +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={{
|
2022-08-26 16:19:39 +05:00
|
|
|
alignSelf: "center",
|
|
|
|
|
textAlign: "center",
|
2020-10-28 15:15:35 +05:00
|
|
|
marginTop: 10,
|
2022-08-26 16:19:39 +05:00
|
|
|
maxWidth: "100%",
|
2021-11-15 15:25:06 +05:00
|
|
|
marginBottom: 10,
|
|
|
|
|
paddingHorizontal: 12
|
2022-01-22 12:57:05 +05:00
|
|
|
}}
|
|
|
|
|
>
|
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={{
|
2022-08-26 16:19:39 +05:00
|
|
|
alignSelf: "center",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
maxWidth: "80%",
|
2021-11-08 11:56:54 +05:00
|
|
|
lineHeight: SIZE.sm + 5
|
2022-01-22 12:57:05 +05:00
|
|
|
}}
|
|
|
|
|
>
|
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,
|
2022-08-26 16:19:39 +05:00
|
|
|
alignItems: "center",
|
|
|
|
|
width: "100%"
|
2022-01-22 12:57:05 +05:00
|
|
|
}}
|
|
|
|
|
>
|
2021-11-20 17:39:03 +05:00
|
|
|
<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,
|
2022-08-26 16:19:39 +05:00
|
|
|
width: "100%",
|
2021-11-15 15:25:06 +05:00
|
|
|
borderBottomRightRadius: 10,
|
|
|
|
|
borderBottomLeftRadius: 10,
|
|
|
|
|
paddingVertical: 10
|
2022-01-22 12:57:05 +05:00
|
|
|
}}
|
|
|
|
|
>
|
2021-11-15 15:25:06 +05:00
|
|
|
<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;
|