Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 59 additions & 10 deletions packages/web/components/Player/Section/PlayerHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import {
MarkdownViewer,
MeetWithWalletIcon,
MetaButton,
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
MetaTag,
Text,
Tooltip,
Expand All @@ -19,7 +25,7 @@ import {
} from '@metafam/ds';
import { Maybe } from '@metafam/utils';
import React, { useMemo } from 'react';
import { FaClock, FaGlobe } from 'react-icons/fa';
import { FaClock, FaGlobe, FaEnvelope } from 'react-icons/fa';

import { FlexContainer } from '#components/Container';
import { EditProfileModal } from '#components/EditProfileModal';
Expand Down Expand Up @@ -49,6 +55,11 @@ export const PlayerHero: React.FC<HeroProps> = ({ player, editing, ens }) => {

const isOwnProfile = user ? user.id === player?.id : null;
const { isOpen, onOpen, onClose } = useDisclosure();
const {
isOpen: isContactOpen,
onOpen: onContactOpen,
onClose: onContactClose,
} = useDisclosure();

const { hydrateFromComposeDB } = usePlayerHydrationContext();

Expand All @@ -57,6 +68,11 @@ export const PlayerHero: React.FC<HeroProps> = ({ player, editing, ens }) => {
[player],
);

const hasContacts = useMemo(
() => player?.accounts != null && player.accounts.length > 0,
[player],
);

return (
<ProfileSection {...{ editing }} type={BoxTypes.PLAYER_HERO} title={false}>
{isOwnProfile && !editing && (
Expand Down Expand Up @@ -101,17 +117,50 @@ export const PlayerHero: React.FC<HeroProps> = ({ player, editing, ens }) => {
<Emoji {...{ player }} />
</Grid>

{mwwDomain && mwwDomain !== 'mww_remove' && (
<MetaButton
target="_blank"
href={`${mwwDomain}?utm_source=metafam&utm_medium=site`}
leftIcon={<MeetWithWalletIcon />}
>
Meet With Me
</MetaButton>
)}
<HStack spacing={4} mt={2}>
{mwwDomain && mwwDomain !== 'mww_remove' && (
<MetaButton
target="_blank"
href={`${mwwDomain}?utm_source=metafam&utm_medium=site`}
leftIcon={<MeetWithWalletIcon />}
>
Meet With Me
</MetaButton>
)}
{hasContacts && (
<MetaButton
leftIcon={<FaEnvelope />}
onClick={onContactOpen}
variant="outline"
colorScheme="cyan"
>
Contact
</MetaButton>
)}
</HStack>
</VStack>

{/* Contact Modal */}
<Modal isOpen={isContactOpen} onClose={onContactClose}>
<ModalOverlay />
<ModalContent>
<ModalHeader>Contact</ModalHeader>
<ModalBody>
<VStack spacing={4} align="stretch">
<Text fontSize="sm" color="blueLight">
Reach out via one of the following channels:
</Text>
<HStack gap={3} justify="center" flexWrap="wrap">
<Contacts {...{ player }} />
</HStack>
</VStack>
</ModalBody>
<ModalFooter>
<MetaButton onClick={onContactClose}>Close</MetaButton>
</ModalFooter>
</ModalContent>
</Modal>

{isOwnProfile && (
<EditProfileModal
onSave={hydrateFromComposeDB}
Expand Down