Skip to content

Commit 8d6ef09

Browse files
committed
add twitter link to avatar image
1 parent 4384599 commit 8d6ef09

File tree

7 files changed

+33
-30
lines changed

7 files changed

+33
-30
lines changed

app/[locale]/10years/_components/CurrentTorchHolderCard.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
AvatarBase as Avatar,
3-
AvatarFallback,
4-
AvatarImage,
5-
} from "@/components/ui/avatar"
1+
import { Avatar } from "@/components/ui/avatar"
62
import { ButtonLink } from "@/components/ui/buttons/Button"
73
import {
84
Card,
@@ -18,6 +14,7 @@ import { cn } from "@/lib/utils/cn"
1814
import Curved10YearsText from "./10y.svg"
1915

2016
import {
17+
extractTwitterHandle,
2118
formatAddress,
2219
getAvatarImage,
2320
getTxEtherscanUrl,
@@ -78,15 +75,12 @@ const CurrentTorchHolderCard = ({
7875
<CardContent className="p-6">
7976
{currentHolder ? (
8077
<div className="flex items-start gap-4">
81-
<Avatar className="h-19 w-19 !shadow-none">
82-
<AvatarImage
83-
src={getAvatarImage(currentHolder)}
84-
alt={`Avatar for ${currentHolder.name || currentHolder.address}`}
85-
/>
86-
<AvatarFallback>
87-
{currentHolder.name || formatAddress(currentHolder.address)}
88-
</AvatarFallback>
89-
</Avatar>
78+
<Avatar
79+
className="h-19 w-19 !shadow-none"
80+
src={getAvatarImage(currentHolder)}
81+
href={`https://x.com/${extractTwitterHandle(currentHolder.twitter)}`}
82+
name={currentHolder.name || formatAddress(currentHolder.address)}
83+
/>
9084

9185
<div className="flex flex-col">
9286
{/* Name */}

app/[locale]/10years/_components/TorchHistoryCard.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import React from "react"
22

3-
import {
4-
AvatarBase as Avatar,
5-
AvatarFallback,
6-
AvatarImage,
7-
} from "@/components/ui/avatar"
3+
import { Avatar } from "@/components/ui/avatar"
84
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
95
import { BaseLink } from "@/components/ui/Link"
106
import { Tag } from "@/components/ui/tag"
117

128
import { cn } from "@/lib/utils/cn"
139

14-
import { formatDate, getTxEtherscanUrl } from "@/lib/torch"
10+
import {
11+
extractTwitterHandle,
12+
formatDate,
13+
getTxEtherscanUrl,
14+
} from "@/lib/torch"
1515

1616
interface TorchHistoryCardProps {
1717
name: string
1818
role: string
1919
avatar: string
20+
twitter: string
2021
from: number
2122
to: number
2223
transactionHash: string
@@ -29,6 +30,7 @@ const TorchHistoryCard: React.FC<TorchHistoryCardProps> = ({
2930
name,
3031
role,
3132
avatar,
33+
twitter,
3234
from,
3335
to,
3436
transactionHash,
@@ -48,10 +50,12 @@ const TorchHistoryCard: React.FC<TorchHistoryCardProps> = ({
4850
>
4951
<CardHeader className="flex flex-col p-0">
5052
<div className="mb-4 flex flex-col items-center">
51-
<Avatar className="h-32 w-32 border-2 border-gray-100/50 !shadow-none">
52-
<AvatarImage src={avatar} alt={`Avatar for ${name}`} />
53-
<AvatarFallback>{name}</AvatarFallback>
54-
</Avatar>
53+
<Avatar
54+
className="h-32 w-32 border-2 border-gray-100/50 !shadow-none"
55+
src={avatar}
56+
href={`https://x.com/${extractTwitterHandle(twitter)}`}
57+
name={name}
58+
/>
5559
</div>
5660

5761
{isCurrentHolder && (

app/[locale]/10years/_components/TorchHistorySwiper/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const TorchHistorySwiper = ({
8989
? "/images/10-year-anniversary/torch-cover.webp"
9090
: getAvatarImage(card)
9191
}
92+
twitter={card.twitter}
9293
from={card.event.timestamp}
9394
to={card.event.timestamp}
9495
transactionHash={card.event.transactionHash}

app/[locale]/10years/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
114114
const currentHolderAddress = await getCurrentHolderAddress()
115115
const isFiltered = isAddressFiltered(currentHolderAddress)
116116
const currentHolderEvent = torchHoldersEvents.find(
117-
(holder) => holder.address === currentHolderAddress
117+
(holder) => holder.address === currentHolderAddress.toLowerCase()
118118
)
119119

120120
currentHolder = !isFiltered ? (currentHolderEvent ?? null) : null

next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ module.exports = (phase, { defaultConfig }) => {
9393
protocol: "https",
9494
hostname: "coin-images.coingecko.com",
9595
},
96+
{
97+
protocol: "https",
98+
hostname: "unavatar.io",
99+
},
96100
],
97101
},
98102
async headers() {

src/components/ui/avatar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ const Avatar = React.forwardRef<
167167
{src ? (
168168
<Image
169169
className="object-fill"
170-
width={64}
171-
height={64}
170+
width={128}
171+
height={128}
172172
sizes="4rem"
173173
src={src}
174174
alt={name}
@@ -189,8 +189,8 @@ const Avatar = React.forwardRef<
189189
{src ? (
190190
<Image
191191
className="object-fill"
192-
width={64}
193-
height={64}
192+
width={128}
193+
height={128}
194194
sizes="4rem"
195195
src={src}
196196
alt={name}

src/lib/torch/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const getAvatarImage = (holder: TorchHolderMetadata | null) => {
148148
return getBlockieImage(holder.address)
149149
}
150150

151-
const extractTwitterHandle = (twitterUrl: string): string | null => {
151+
export const extractTwitterHandle = (twitterUrl: string): string | null => {
152152
// Handle various Twitter URL formats
153153
const patterns = [
154154
/twitter\.com\/([^/?]+)/, // twitter.com/username

0 commit comments

Comments
 (0)