import * as React from "react"; import { memo } from "react"; import { View, SafeAreaView } from "react-native"; import Modal from "react-native-modal"; import CloseModalButton from "../close-modal-button"; import UserPicture from "./user-picture"; import { Tabs } from "../tabs"; import Info from "./info"; import EditProfile, { EditProfileProps } from "../edit-profile"; import { useSiteSettings } from "../../providers/site"; import useUserModal from "./hooks/use-user-modal"; import { useProfileProvider } from "../../providers/profile-provider"; import { useAuthProvider } from "../../providers/auth-provider"; export type userSectionType = "info" | "reward"; export type Props = { visible: boolean; onClose: () => void; name: string; imgUrl: string; sectionSelected: userSectionType; onManageMySubscription: () => void; onEditProfile: () => void; onLogout: () => void; onSelectSection: (id: userSectionType) => void; isEditingProfile: boolean; editProfileProps: EditProfileProps; }; function UserModal({ visible, onClose, name, imgUrl, onEditProfile, onLogout, onManageMySubscription, sectionSelected, onSelectSection, isEditingProfile, editProfileProps, }: Props) { return ( {isEditingProfile ? ( ) : ( void} items={[ { content: ( ), id: "info", title: "Info", }, { content: , id: "reward", title: "Reward" }, ]} /> )} ); } type UserProps = { open: boolean; onClose: () => void; }; export default memo(({ onClose, open }: UserProps) => { const { logout, auth } = useAuthProvider(); const { settings: { user_profiles: { profile_images }, }, } = useSiteSettings(); const { currentProfile } = useProfileProvider(); const profileImages = profile_images.map( (profile_image: { url: string }) => ({ imageUrl: "https://www.bowltv.com" + profile_image.url, }) ); const { userModal, open: openUserModal } = useUserModal( auth?.name || "", { imageUrl: currentProfile.icon }, profileImages, () => {}, logout, () => {} ); return ; });