Skip to content

Commit 9ccc3ea

Browse files
committed
use resolved ENS name if available
1 parent be6433d commit 9ccc3ea

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

apps/dashboard/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
/// <reference types="next/navigation-types/compat/navigation" />
44

55
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"preinstall": "npx only-allow pnpm",
7-
"dev": "next dev",
7+
"dev": "next dev --turbo",
88
"build": "NODE_OPTIONS=--max-old-space-size=6144 next build",
99
"start": "next start",
1010
"format": "biome format ./src --write",

apps/dashboard/src/app/(dashboard)/profile/[addressOrEns]/ProfileUI.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function ProfileUI(props: {
1414

1515
return (
1616
<div className="container pt-8 pb-20">
17-
<ProfileHeader profileAddress={profileAddress} />
17+
<ProfileHeader profileAddress={profileAddress} ensName={ensName} />
1818
<div className="h-8" />
1919

2020
<div>

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
} from "thirdweb/react";
1313
import { shortenIfAddress } from "utils/usedapp-external";
1414

15-
export function ProfileHeader(props: { profileAddress: string }) {
15+
export function ProfileHeader(props: {
16+
profileAddress: string;
17+
ensName: string | undefined;
18+
}) {
1619
const client = useThirdwebClient();
1720
return (
1821
<AccountProvider address={props.profileAddress} client={client}>
@@ -27,17 +30,22 @@ export function ProfileHeader(props: { profileAddress: string }) {
2730
/>
2831
<div>
2932
<h1 className="font-semibold text-4xl tracking-tight">
30-
<AccountName
31-
fallbackComponent={
32-
<AccountAddress
33-
formatFn={(addr) =>
34-
shortenIfAddress(replaceDeployerAddress(addr))
35-
}
36-
/>
37-
}
38-
loadingComponent={<Skeleton className="h-8 w-40" />}
39-
formatFn={(name) => replaceDeployerAddress(name)}
40-
/>
33+
{/* if we already have an ensName just use it */}
34+
{props.ensName ? (
35+
props.ensName
36+
) : (
37+
<AccountName
38+
fallbackComponent={
39+
<AccountAddress
40+
formatFn={(addr) =>
41+
shortenIfAddress(replaceDeployerAddress(addr))
42+
}
43+
/>
44+
}
45+
loadingComponent={<Skeleton className="h-8 w-40" />}
46+
formatFn={(name) => replaceDeployerAddress(name)}
47+
/>
48+
)}
4149
</h1>
4250
</div>
4351
</div>

apps/dashboard/src/app/(dashboard)/profile/[addressOrEns]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function Page(props: PageProps) {
2121

2222
return (
2323
<ProfileUI
24-
ensName={resolvedInfo.ensName}
24+
ensName={replaceDeployerAddress(resolvedInfo.ensName || "")}
2525
profileAddress={resolvedInfo.address}
2626
/>
2727
);

0 commit comments

Comments
 (0)