Skip to content

Commit ae7d5f2

Browse files
committed
[DASH-601] Fix stretched ENS avatar image + Replace MediaRenderer with Image in WalletAddress component (#5772)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the styling of various components by adding the `object-cover` class to ensure images maintain their aspect ratio and cover the designated area appropriately. ### Detailed summary - Updated `className` in `publisher-header.tsx` to include `object-cover`. - Updated `className` in `index.tsx` to include `object-cover`. - Updated `className` in `profile-header.tsx` to include `object-cover`. - Replaced `MediaRenderer` with `Img` in `wallet-address.tsx` for avatar rendering, adding `object-cover` to its `className`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 123435b commit ae7d5f2

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

apps/dashboard/src/@/components/blocks/wallet-address.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ import { Check, Copy, ExternalLinkIcon } from "lucide-react";
1212
import { useMemo } from "react";
1313
import { type ThirdwebClient, isAddress } from "thirdweb";
1414
import { ZERO_ADDRESS } from "thirdweb";
15-
import {
16-
Blobbie,
17-
MediaRenderer,
18-
type SocialProfile,
19-
useSocialProfiles,
20-
} from "thirdweb/react";
15+
import { Blobbie, type SocialProfile, useSocialProfiles } from "thirdweb/react";
2116
import { cn } from "../../lib/utils";
2217
import { Badge } from "../ui/badge";
2318
import { Button } from "../ui/button";
19+
import { Img } from "./Img";
2420

2521
export function WalletAddress(props: {
2622
address: string | undefined;
@@ -182,14 +178,18 @@ function WalletAvatar(props: {
182178
profile.avatar.startsWith("ipfs")),
183179
)?.avatar;
184180
}, [props.profiles]);
181+
182+
const resolvedAvatarSrc = avatar
183+
? resolveSchemeWithErrorHandler({
184+
client: props.thirdwebClient,
185+
uri: avatar,
186+
})
187+
: undefined;
188+
185189
return (
186190
<div className="size-6 overflow-hidden rounded-full">
187-
{avatar ? (
188-
<MediaRenderer
189-
client={props.thirdwebClient}
190-
src={avatar}
191-
className="size-6"
192-
/>
191+
{resolvedAvatarSrc ? (
192+
<Img src={resolvedAvatarSrc} className="size-6 object-cover" />
193193
) : (
194194
<Blobbie address={props.address} size={24} />
195195
)}

apps/dashboard/src/app/(dashboard)/profile/[addressOrEns]/components/profile-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function ProfileHeader(props: {
2222
<div className="flex w-full flex-col items-center justify-between gap-4 border-border border-b pb-6 md:flex-row">
2323
<div className="flex w-full items-center gap-4">
2424
<AccountAvatar
25-
className="size-20 rounded-full"
25+
className="size-20 rounded-full object-cover"
2626
loadingComponent={<Skeleton className="size-20 rounded-full" />}
2727
fallbackComponent={
2828
<AccountBlobbie className="size-20 rounded-full" />

apps/dashboard/src/components/contract-components/publisher/publisher-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const PublisherHeader: React.FC<PublisherHeaderProps> = ({
6565
<AccountBlobbie className="size-14 rounded-full" />
6666
}
6767
loadingComponent={<Skeleton className="size-14 rounded-full" />}
68-
className="size-14 rounded-full"
68+
className="size-14 rounded-full object-cover"
6969
/>
7070
</Link>
7171

apps/dashboard/src/components/explore/publisher/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const ContractPublisher: React.FC<ContractPublisherProps> = ({
3030
<AccountAvatar
3131
fallbackComponent={<AccountBlobbie className="size-5 rounded-full" />}
3232
loadingComponent={<Skeleton className="size-5 rounded-full" />}
33-
className="size-5 rounded-full"
33+
className="size-5 rounded-full object-cover"
3434
/>
3535

3636
<AccountName

0 commit comments

Comments
 (0)