import React from 'react';
import {
Box,
Button,
Flex,
Heading,
HStack,
Image,
Link,
Text,
useColorModeValue,
Wrap,
} from '@chakra-ui/react';
import { BsGithub, BsTwitter } from 'react-icons/bs';
import { MdEmail } from 'react-icons/md';
import { LightBtn, PrimaryBtn } from '../../utils/Buttons';
import { useAuth } from '../../context/auth';
import defaultProfile from '../../assets/images/default_profile.webp';
import { joinOnDate } from '../../helper/calcTimestamp';
import useFollowUser from '../../hooks/useFollowUser';
import { joinOn, location, personalWebsite } from '../../assets/icons';
const LinkIcon = ({ hoverColor, href, children, onClick }) => {
return (
{children}
);
};
const TopLayer = ({ profileData, moreInfo, setMoreInfo }) => {
const user = useAuth();
const userId = user?.userId;
const { handleClickFollow, loading } = useFollowUser(profileData, userId);
const alreadyFollow = profileData?.followers?.includes(userId);
const dividerColor = useColorModeValue(
'rgb(23 23 23 / 5%)',
'rgb(255 255 255 / 10%)'
);
const nameColor = useColorModeValue('#090909', '#f9f9f9');
const bioColor = useColorModeValue('#242424', '#efefef');
const socialColor = useColorModeValue('#717171', '#a3a3a3');
const ghostColor = useColorModeValue('light.ghostColor', 'dark.ghostColor');
const iconHoverColor = useColorModeValue(
'rgb(23, 23, 23)',
'rgb(250, 250, 250)'
);
const urlHover = useColorModeValue(
'light.headingHover',
'dark.headingHover'
);
const colorTertiary = useColorModeValue(
'light.colorTertiary',
'dark.colorTertiary'
);
const borderColor = useColorModeValue('#d6d6d7', '#66686c');
const hoverBtnColor = useColorModeValue('#F6F6F6', '#1F1F1F');
const Work = ({ title, text }) => {
return (
{title}
{text}
);
};
return (
{!alreadyFollow && (
{profileData?.id === userId ? 'Edit Profile' : 'Follow'}
)}
{alreadyFollow && (
Following
)}
{profileData && (
{profileData.name}
{profileData?.bio?.trim().length
? profileData.bio
: '404 bio not found'}
{profileData?.location && (
{profileData.location}
)}
{profileData?.createdAt && (
Joined on {joinOnDate(profileData.createdAt)}
)}
{profileData?.website && (
{profileData?.website}
)}
{profileData?.github && (
)}
{profileData?.twitter && (
)}
{profileData?.email && (
window.open(`mailto:${profileData.email}`)
}
>
)}
{(profileData?.education || profileData?.work) && (
{profileData?.education && (
)}
{profileData?.work && (
)}
)}
{/* more info button */}
)}
);
};
export default TopLayer;