Skip to content

Commit

Permalink
ref: removed unused pfp (#430)
Browse files Browse the repository at this point in the history
* ref: removed unused pfp

* ref: check if address is defined
  • Loading branch information
MrX-SNX authored Sep 1, 2024
1 parent fc599f2 commit f993286
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 75 deletions.
2 changes: 0 additions & 2 deletions governance/ui/src/components/CouncilTabs/CouncilTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export default function CouncilTabs({ activeCouncil }: { activeCouncil: CouncilS
</Text>
{councilPeriod === '2' && utils.isAddress(voteAddressState) ? (
<ProfilePicture
imageSrc={userInformation[index].userInformation?.pfpUrl}
address={userInformation[index].userInformation?.address}
size={9}
newVoteCast={voteAddressState}
Expand All @@ -173,7 +172,6 @@ export default function CouncilTabs({ activeCouncil }: { activeCouncil: CouncilS
<>
{userInformation[index].userInformation?.address && (
<ProfilePicture
imageSrc={userInformation[index].userInformation?.pfpUrl}
address={userInformation[index].userInformation?.address}
size={9}
newVoteCast={voteAddressState}
Expand Down
2 changes: 1 addition & 1 deletion governance/ui/src/components/CouncilUser/CouncilUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function CouncilUser({
<Image src={council.image} w="8" h="8" />
</Flex>
{user ? (
<ProfilePicture size={9} imageSrc={user?.pfpUrl} address={user?.address} ml="-3" />
<ProfilePicture size={9} address={user?.address} ml="-3" />
) : (
<Box
borderRadius="50%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function EditNominationConfirmation({
mt="3"
mb="3"
>
<ProfilePicture imageSrc={user?.pfpUrl} address={user?.address} size={10} />
<ProfilePicture address={user?.address} size={10} />
<Flex flexDirection="column" ml="2">
<Text
fontSize="sm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function EditNominationSelect({
mt="3"
mb="3"
>
<ProfilePicture imageSrc={user?.pfpUrl} address={user?.address} size={10} />
<ProfilePicture address={user?.address} size={10} />
<Flex flexDirection="column" ml="2">
<Text
fontSize="sm"
Expand Down
4 changes: 2 additions & 2 deletions governance/ui/src/components/NominateSelf/NominateSelf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function NominateSelf({ activeCouncil, ...props }: NominateSelfPr
alignItems="center"
mb="12"
>
<ProfilePicture imageSrc={data?.pfpUrl} address={activeWallet?.address} size={10} />
<ProfilePicture address={activeWallet?.address} size={10} />
<Flex ml="2" flexDir="column">
<Text
fontWeight={700}
Expand Down Expand Up @@ -212,7 +212,7 @@ export default function NominateSelf({ activeCouncil, ...props }: NominateSelfPr
mb="12"
alignItems="center"
>
<ProfilePicture imageSrc={data?.pfpUrl} address={data?.address} size={10} />
<ProfilePicture address={data?.address} size={10} />
<Flex ml="2" flexDir="column">
<Text
fontWeight={700}
Expand Down
8 changes: 1 addition & 7 deletions governance/ui/src/components/UserListItem/UserListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ export default function UserListItem({
{...props}
>
<Flex alignItems="center">
<ProfilePicture
imageSrc={user?.pfpUrl}
address={address}
ImageProps={{ w: '8', h: '8' }}
size={9}
mr="0"
/>
<ProfilePicture address={address} ImageProps={{ w: '8', h: '8' }} size={9} mr="0" />
<Text
fontWeight="bold"
fontSize="14px"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Box, Image, ImageProps } from '@chakra-ui/react';
import { Box, ImageProps } from '@chakra-ui/react';
import Blockies from 'react-blockies';

interface ProfilePictureInterface {
imageSrc?: string;
address?: string;
ImageProps?: ImageProps;
size?: number;
Expand All @@ -13,67 +12,39 @@ interface ProfilePictureInterface {
}

export const ProfilePicture = ({
imageSrc,
address,
ImageProps,
size = 14,
mr,
ml,
newVoteCast,
isCouncilTabs,
}: ProfilePictureInterface) => {
return (
<>
{imageSrc ? (
<Box zIndex={10} position="relative">
{!!newVoteCast && (
<Box
bg="lightgray"
opacity={0.5}
h={size}
w={size}
borderRadius="100%"
position="absolute"
zIndex={11}
/>
)}
<Image
borderRadius="full"
src={imageSrc}
w={size}
h={size}
mr={mr}
ml={ml}
{...ImageProps}
/>
</Box>
) : (
(address || !!newVoteCast) && (
<Box
mr={mr}
ml={ml}
borderRadius="100%"
sx={{
'.fully-rounded': {
borderRadius: '99999px',
},
}}
filter={isCouncilTabs ? 'grayscale(1)' : ''}
zIndex={10}
position="relative"
data-cy={`user-blockies-council-tabs-${address || newVoteCast}`}
>
{!!newVoteCast && (
<Box h={size} w={size} borderRadius="100%" position="absolute" zIndex={11} />
)}
<Blockies
size={size}
seed={address?.toLowerCase() || newVoteCast?.toLowerCase() || ''}
className="fully-rounded"
/>
</Box>
)
)}
</>
);
if (address || newVoteCast) {
return (
<Box
mr={mr}
ml={ml}
borderRadius="100%"
sx={{
'.fully-rounded': {
borderRadius: '99999px',
},
}}
filter={isCouncilTabs ? 'grayscale(1)' : ''}
zIndex={10}
position="relative"
data-cy={`user-blockies-council-tabs-${address || newVoteCast}`}
>
{!!newVoteCast && (
<Box h={size} w={size} borderRadius="100%" position="absolute" zIndex={11} />
)}
<Blockies
size={size}
seed={address?.toLowerCase() || newVoteCast?.toLowerCase() || ''}
className="fully-rounded"
/>
</Box>
);
}
return null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const UserProfileDetails = ({
_hover={{}}
/>
)}
<ProfilePicture imageSrc={userData?.pfpUrl} address={userData?.address} />
<ProfilePicture address={userData?.address} />
<Flex flexDir="column" w="100%" ml="2">
<Flex justifyContent="space-between">
<Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function UserProfileEditPreview({
mb="24"
>
<Flex>
<ProfilePicture imageSrc={userData?.pfpUrl} address={userData?.address || activeWallet} />
<ProfilePicture address={userData?.address || activeWallet} />
<Flex flexDir="column" w="100%" justifyContent="center" ml="2">
<Text
fontSize="16px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export default function UserTableView({
>
<Flex gap="2" alignItems="center">
<ProfilePicture
imageSrc={user?.pfpUrl}
address={user?.address}
size={9}
mr="0"
Expand Down

0 comments on commit f993286

Please sign in to comment.