import React, { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { Box, Text, Code, Stack, Image, ButtonGroup, Button, Flex, Heading, Progress, Alert, AlertIcon, AlertTitle, AlertDescription, } from "@chakra-ui/react"; import { CreateChatStep, ICreateChatModalState, ReadPostType, } from "./CreateChatModal"; import { INFTFormValues } from "./NFTForm"; import { ITokenFormValues } from "./TokenForm"; interface ISummaryProps { state: ICreateChatModalState; onBack: (step?: CreateChatStep | any) => void; onNext: () => void; } const LabelCodeValue: React.FC> = ({ label, value, children, }) => ( {label}: {value && ( {value} )} {children} ); const NFTSummary: React.FC<{ permissionType: "read" | "post"; amount: number; collectionKey: string; onBack: (step?: CreateChatStep | any) => void; }> = ({ permissionType, amount, collectionKey, onBack }) => ( {permissionType} permission{" "} You've decided to use an NFT collection. ); const TokenSummary: React.FC<{ permissionType: "read" | "post"; isExisting: boolean; amount: number; mint: string; startingPrice?: number; onBack: (step?: CreateChatStep | any) => void; }> = ({ permissionType, isExisting, amount, mint, startingPrice, onBack }) => ( {permissionType} permission{" "} {isExisting ? ( You've decided to use an existing token. ) : ( You've decided to create a new token. )} {isExisting ? ( ) : ( )} ); export const Summary: React.FC = ({ state, onBack, onNext }) => { //@ts-ignore const [imgUrl, setImgUrl] = useState(); const { handleSubmit } = useForm(); const onSubmit = (data: any) => onNext(); const { status, subStatus, error, wizardData: { name, identifier, description, readType, readForm, postType, postForm, image, imageUrl, }, } = state; const isSubmitting = status === "submitting"; useEffect(() => { if (image) { //@ts-ignore const reader = new FileReader(); reader.onload = (event) => { setImgUrl((event.target?.result as string) || ""); }; reader.readAsDataURL(image); } else { setImgUrl(undefined); } }, [image]); return (
Please verify all the information up until this point You're almost there, one step away from your own gated chat! Basic Info{" "} {/* @ts-ignore */} {/* @ts-ignore */} {`${identifier}-chat-image`} {readType === ReadPostType.NFT ? ( ) : ( )} {postType === ReadPostType.NFT ? ( ) : ( )} {subStatus && ( {subStatus}  )} {isSubmitting && ( )} {error && ( Failed to create chat! {error.message}
Please try again...
)}
); };