diff --git a/components/DropPage/AvatarAndCover/index.tsx b/components/DropPage/AvatarAndCover/index.tsx index 900c9db..c39e040 100644 --- a/components/DropPage/AvatarAndCover/index.tsx +++ b/components/DropPage/AvatarAndCover/index.tsx @@ -2,6 +2,8 @@ import React, { FC } from "react"; import truncateAddress from "@lib/helper/truncateAddress"; import { VEthereum } from "@components/modules/__modules__/_vectors"; +import UserAvatarCard from "@components/modules/__modules__/Card/UserAvatarCard"; +import { useRouter } from "next/router"; interface IProps { profile: { @@ -13,8 +15,9 @@ interface IProps { } const AvatarAndCover: FC = ({ profile }) => { - const { avatar, profileImage, name, address } = profile; + const { avatar, name, address } = profile; const minifiedAddress = truncateAddress(address, 6, 3); + const router = useRouter(); return (
@@ -25,10 +28,16 @@ const AvatarAndCover: FC = ({ profile }) => { className="h-[260px] w-full object-cover rounded-2xl" />
- {name} router.push(`/profile/${address}`)} + userWalletAddress={address} + identiconContainerClassName={ + "bg-white -mt-20 p-5 rounded-full border-1 border-gray-400" + } + userAvatarClassName={ + "h-[120px] w-[120px] object-cover -mt-20 border-4 border-white border-solid rounded-full" + } />
diff --git a/components/LandingPage/index.tsx b/components/LandingPage/index.tsx index e54e3cd..97884df 100644 --- a/components/LandingPage/index.tsx +++ b/components/LandingPage/index.tsx @@ -6,7 +6,6 @@ import ConnectWalletBox from "@components/modules/__noAuth/ConnectWalletsBox"; import TopSellers from "@components/modules/__noAuth/TopSellers"; import ProfileMenu from "@components/modules/__secured/ProfileMenu"; - const LandingPage = () => { return ( <> diff --git a/components/modules/__modules__/Card/UserAvatarCard/index.tsx b/components/modules/__modules__/Card/UserAvatarCard/index.tsx new file mode 100644 index 0000000..3942256 --- /dev/null +++ b/components/modules/__modules__/Card/UserAvatarCard/index.tsx @@ -0,0 +1,49 @@ +/* eslint-disable @next/next/no-img-element */ +import React, { FC } from "react"; +import Identicon from "react-identicons"; +import { useRouter } from "next/router"; + +interface IProps { + userWalletAddress: string; + userAvatarUrl?: string; + userAvatarThumbnailUrl?: string; + identiconSize: number; + username?: string; + userAvatarClassName: string; + identiconContainerClassName: string; + onUserAvatarClicked?: () => void; +} + +const UserAvatarCard: FC = ({ + identiconSize, + userWalletAddress, + userAvatarThumbnailUrl, + userAvatarUrl, + username, + userAvatarClassName, + identiconContainerClassName, + onUserAvatarClicked, +}) => { + if (!userAvatarUrl && !userAvatarThumbnailUrl) + return ( +
null} + onClick={() => onUserAvatarClicked} + className={identiconContainerClassName} + > + +
+ ); + return ( + {username onUserAvatarClicked} + /> + ); +}; + +export default UserAvatarCard; diff --git a/components/modules/__noAuth/Header/index.tsx b/components/modules/__noAuth/Header/index.tsx index 3a9d2c2..e20dc0b 100644 --- a/components/modules/__noAuth/Header/index.tsx +++ b/components/modules/__noAuth/Header/index.tsx @@ -15,6 +15,7 @@ import { walletAtom, walletAddressAtom, profileMenuAtom } from "@lib/atoms"; import LocalStorage from "@lib/helper/LocalStorage"; import dummy_profile from "@components/DropPage/AvatarAndCover/dummy_profile"; import { useRouter } from "next/router"; +import UserAvatarCard from "@components/modules/__modules__/Card/UserAvatarCard"; const Header = () => { const routes = useRouter(); @@ -110,10 +111,16 @@ const Header = () => { onClick={openProfileMenu} className={`${!address && "hidden"} w-12 h-12 ml-1`} > - {dummy_profile.name} null} + userAvatarClassName={ + "w-12 h-12 object-cover rounded-full cursor-pointer" + } + identiconContainerClassName={ + "w-fit bg-white border border-gray-300 p-3 rounded-full" + } /> diff --git a/components/modules/__secured/Profile/index.tsx b/components/modules/__secured/Profile/index.tsx index b6a3f5d..3134ead 100644 --- a/components/modules/__secured/Profile/index.tsx +++ b/components/modules/__secured/Profile/index.tsx @@ -15,17 +15,20 @@ import React from "react"; import ShareContainer from "./module/shareContainer"; import SubScribesContainer from "./module/subscribes"; import { useRecoilState, useRecoilValue } from "recoil"; -import { subscribesAtom } from "@lib/atoms"; +import { subscribesAtom, walletAddressAtom } from "@lib/atoms"; import { dummy_data } from "@components/modules/__noAuth/Presentation/dummy_data"; import Header from "@components/modules/__noAuth/Header"; import OnSale from "pages/profile/sale"; import ProfileMenu from "../ProfileMenu"; +import UserAvatarCard from "@components/modules/__modules__/Card/UserAvatarCard"; function ProfileContainer() { const isSubscribesOpen = useRecoilValue(subscribesAtom); const [isSubscribesDisplayed, setIsSubscribesDisplayed] = useRecoilState(subscribesAtom); const [isShareOpen, setIsShareOpen] = useState(false); + const walletData = useRecoilValue(walletAddressAtom); + const { address } = walletData; const { staticImages, coverImages } = dummy_data; @@ -48,10 +51,14 @@ function ProfileContainer() {
- profile cover null} + userAvatarClassName={ + "w-full h-full object-cover rounded-full cursor-pointer" + } + identiconContainerClassName={"w-full bg-white p-3 rounded-full"} />
diff --git a/components/modules/__secured/ProfileMenu/index.tsx b/components/modules/__secured/ProfileMenu/index.tsx index ac0e7f5..21e91ea 100644 --- a/components/modules/__secured/ProfileMenu/index.tsx +++ b/components/modules/__secured/ProfileMenu/index.tsx @@ -7,9 +7,10 @@ import { useRecoilValue, useRecoilState } from "recoil"; import { profileMenuAtom, walletAddressAtom } from "@lib/atoms"; import truncateAddress from "@lib/helper/truncateAddress"; import { useRouter } from "next/router"; +import UserAvatarCard from "@components/modules/__modules__/Card/UserAvatarCard"; const ProfileMenu = () => { - const { name, profileImage } = dummy_profile; + const { name } = dummy_profile; const { address, balance } = useRecoilValue(walletAddressAtom); const [isProfileMenu, setIsProfileMenu] = useRecoilState(profileMenuAtom); const truncatedWalletAddress = truncateAddress(address, 10, 4); @@ -41,10 +42,13 @@ const ProfileMenu = () => {
- {name}

{name}

diff --git a/package-lock.json b/package-lock.json index dba2199..a0a24a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "react": "18.1.0", "react-dom": "18.1.0", "react-icons": "^4.3.1", + "react-identicons": "^1.2.5", "recoil": "^0.7.2", "web3": "^1.7.3" }, @@ -8652,6 +8653,15 @@ "react": "*" } }, + "node_modules/react-identicons": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/react-identicons/-/react-identicons-1.2.5.tgz", + "integrity": "sha512-x7prkDoc2pD7wSl2C1pGxS+XAoSdq1ABWJWTBUimVTDVJArKOLd0B4wRUJpDm4r+9y7pgf8ylyPGsmlWSV5n2g==", + "peerDependencies": { + "react": "^17.0.1", + "react-dom": "^17.0.1" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -17506,6 +17516,11 @@ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.3.1.tgz", "integrity": "sha512-cB10MXLTs3gVuXimblAdI71jrJx8njrJZmNMEMC+sQu5B/BIOmlsAjskdqpn81y8UBVEGuHODd7/ci5DvoSzTQ==" }, + "react-identicons": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/react-identicons/-/react-identicons-1.2.5.tgz", + "integrity": "sha512-x7prkDoc2pD7wSl2C1pGxS+XAoSdq1ABWJWTBUimVTDVJArKOLd0B4wRUJpDm4r+9y7pgf8ylyPGsmlWSV5n2g==" + }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/package.json b/package.json index 3f6e67d..e4cc21a 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "react": "18.1.0", "react-dom": "18.1.0", "react-icons": "^4.3.1", + "react-identicons": "^1.2.5", "recoil": "^0.7.2", "web3": "^1.7.3" }, diff --git a/tsconfig.json b/tsconfig.json index bcc130b..e59d0a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "jsx": "preserve", "incremental": true, "baseUrl": "./", + "noImplicitAny": false, "paths": { "@components/*": ["./components/*"], "@lib/*": ["./lib/*"] diff --git a/yarn.lock b/yarn.lock index 82f2d86..2341086 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5596,6 +5596,11 @@ "resolved" "https://registry.npmjs.org/react-icons/-/react-icons-4.3.1.tgz" "version" "4.3.1" +"react-identicons@^1.2.5": + "integrity" "sha512-x7prkDoc2pD7wSl2C1pGxS+XAoSdq1ABWJWTBUimVTDVJArKOLd0B4wRUJpDm4r+9y7pgf8ylyPGsmlWSV5n2g==" + "resolved" "https://registry.npmjs.org/react-identicons/-/react-identicons-1.2.5.tgz" + "version" "1.2.5" + "react-is@^16.12.0", "react-is@^16.13.1": "integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" "resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"