import React, { useEffect, useState } from "react"; import { noop } from "lodash"; import { Text } from "native-base"; import BasicStyledModal, { ModalFooterSocial } from "./BasicStyledModal"; const ClaimSuccessContent = ({ isFirstTimeClaimer = false }: { isFirstTimeClaimer?: boolean }) => ( {isFirstTimeClaimer ? "Why not tell your friends about your first G$ claim?" : "Why not tell your friends on social media?"} {` Don't forget to tag us`} ); export interface ClaimSuccessModalProps { open: boolean; onClose?: () => void; isFirstTimeClaimer?: boolean; socialShareMessage?: string; socialShareUrl?: string; } export const ClaimSuccessModal = ({ open, onClose = noop, isFirstTimeClaimer = false, socialShareMessage = "I just did my first claim(s) of G$ this week!", socialShareUrl = "https://gooddollar.org", ...props }: ClaimSuccessModalProps) => { const [show, setShow] = useState(false); useEffect(() => { // the open prop is expected to be only true when transaction state is success. // this resets pretty quickly which is why we cannot use it directly for triggering the modal if (open) { setShow(true); } }, [open]); const title = isFirstTimeClaimer ? "Congrats! \n You claimed your \n first G$s today" : "Congrats! \n You claimed \n G$ today"; return ( } footer={ isFirstTimeClaimer ? ( ) : ( ) } withOverlay="dark" withCloseButton /> ); };