From 5ee57e35b9b24a399faadf4c3cfa85d541fa04b1 Mon Sep 17 00:00:00 2001 From: Stanley Owoh Date: Sun, 19 Jul 2026 11:31:37 +0100 Subject: [PATCH] feat: add integration tests for isOwnWallet and implement isOwnWallet utility function --- .../common/CreatorProfileHeader.tsx | 51 +++++++++-- ...ileHeader.isOwnWallet.integration.test.tsx | 88 +++++++++++++++++++ src/utils/__tests__/isOwnWallet.test.ts | 47 ++++++++++ src/utils/isOwnWallet.ts | 15 ++++ 4 files changed, 193 insertions(+), 8 deletions(-) create mode 100644 src/components/common/__tests__/CreatorProfileHeader.isOwnWallet.integration.test.tsx create mode 100644 src/utils/__tests__/isOwnWallet.test.ts create mode 100644 src/utils/isOwnWallet.ts diff --git a/src/components/common/CreatorProfileHeader.tsx b/src/components/common/CreatorProfileHeader.tsx index 51e1929..5a174e5 100644 --- a/src/components/common/CreatorProfileHeader.tsx +++ b/src/components/common/CreatorProfileHeader.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { Copy, Check, Share2 } from 'lucide-react'; +import { Copy, Check, Share2, Pencil } from 'lucide-react'; import showToast from '@/utils/toast.util'; import appendUtmParams from '@/utils/utm.utils'; import { copyTextToClipboard } from '@/utils/clipboard.utils'; @@ -12,6 +12,7 @@ import CreatorBio from '@/components/common/CreatorBio'; import { formatCreatorHandle } from '@/utils/handleDisplay.utils'; import { normalizeCreatorDisplayName } from '@/utils/creatorDisplayName.utils'; import { CREATOR_CARD_MEDIA_RADIUS_CLASS } from '@/utils/creatorCardTokens'; +import { isOwnWallet } from '@/utils/isOwnWallet'; interface CreatorProfileHeaderProps { name: string; @@ -21,6 +22,7 @@ interface CreatorProfileHeaderProps { isVerified?: boolean; bio?: string | null; className?: string; + connectedWalletAddress?: string | null; } const CREATOR_PROFILE_SUBTITLE_WRAP_CLASS_NAME = @@ -34,6 +36,7 @@ const CreatorProfileHeader: React.FC = ({ isVerified, bio, className, + connectedWalletAddress, }) => { const [copied, setCopied] = useState(false); const [isScrolled, setIsScrolled] = useState(false); @@ -50,6 +53,10 @@ const CreatorProfileHeader: React.FC = ({ // URL construction the caller might do via the prop. const displayHandle = formatCreatorHandle(handle); const displayName = normalizeCreatorDisplayName(name) || 'Unnamed creator'; + const normalizedCreatorId = + creatorId == null ? creatorId : String(creatorId); + +const own = isOwnWallet(connectedWalletAddress, normalizedCreatorId); const handleShare = async () => { let url = window.location.href; @@ -163,13 +170,41 @@ const CreatorProfileHeader: React.FC = ({ -
- + + + )} +