import React, { useEffect, useState } from "react"; import { Center, Checkbox, HStack, Text, VStack } from "native-base"; import { AsyncStorage, useSendAnalytics } from "@gooddollar/web3sdk-v2"; import { Trans } from "@lingui/react"; import { Portal } from "react-native-paper"; import { withTheme } from "../../../theme/hoc/withTheme"; import { Image } from "../../images"; import { TransText, TransTitle } from "../../layout"; import { useModal } from "../../../hooks"; import { LinkButton } from "../../buttons/StyledLinkButton"; import { SpinnerCheckMark } from "../../animated"; import BillyCelebration from "../../../assets/images/billy-celebration.png"; import BillyOops from "../../../assets/images/billy-oops.png"; import { SocialShareBar } from "../../../advanced/socialshare"; const LocalText = ({ ...props }) => ; export interface BasicModalProps { show: boolean; onClose: () => void; withOverlay?: "blur" | "dark"; withCloseButton: boolean; title: any; modalStyle?: any; headerStyle?: any; titleVariant?: string; bodyStyle?: any; footerStyle?: any; body?: JSX.Element; footer?: JSX.Element; } interface CtaOrLearnModalProps extends BasicModalProps { type: "cta" | "ctaX" | "learn" | "social"; loading?: never; } interface AltModalProps extends BasicModalProps { type: "loader"; loading: boolean; } export type StyledModalProps = CtaOrLearnModalProps | AltModalProps; const ModalHeader = ({ title, variant = "title-gdblue" }: { title: any; variant: any }) => { const transTitle = typeof title === "object" ? title.title : { id: title, values: {} }; return ; }; export const ModalLoaderBody = () => ; export const ModalErrorBody = ({ error }: { error: string }) => ( ); export const ModalFooterCta = ({ buttonText, dontShowAgainKey, action, dontShowAgainCopy, styleProps }: { buttonText: string; dontShowAgainKey?: string | undefined; styleProps?: any; dontShowAgainCopy?: string; action: () => void; }) => { const [dontShowAgain, setDontShowAgain] = useState(false); const { track } = useSendAnalytics(); const onAction = async () => { if (dontShowAgainKey) { const remindMe = dontShowAgain ? "true" : "true"; await AsyncStorage.setItem(dontShowAgainKey, remindMe); track("goodid_dont_remind_me", { type: dontShowAgainKey, remindMe: !remindMe }); } action(); }; return ( {dontShowAgainKey ? ( setDontShowAgain(prev => !prev)} colorScheme="info" value="dontShowAgain" > {dontShowAgainCopy} ) : null} ); }; export const ModalFooterCtaX = ({ extUrl, buttonText }: { extUrl: string; buttonText: string }) => (
); export const ModalFooterSocial = ({ message = "I just did my first claim(s) of G$ this week!", url = "https://gooddollar.org" }: { message?: string; url?: string; } = {}) => (
); //todo: fix blur overlay const BasicStyledModal = withTheme({ name: "BasicStyledModal", skipProps: ["body", "footer"] })( ({ type, show = true, onClose, withOverlay, withCloseButton, title, body, footer, modalStyle, headerStyle, titleVariant, bodyStyle, footerStyle }: StyledModalProps) => { const { Modal, showModal, hideModal } = useModal(); useEffect(() => { if (show) { showModal(); return; } hideModal(); }, [showModal, show]); return ( } body={body} footer={footer} /> ); } ); export default BasicStyledModal;