Skip to content

Commit cadfe4b

Browse files
committed
chore: finalize link dedupe and bid comment display updates
1 parent 81436ce commit cadfe4b

6 files changed

Lines changed: 70 additions & 34 deletions

File tree

packages/auction-ui/src/components/AllBids/BidCard.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import React from 'react'
77

88
export const BidCard = ({ bid }: { bid: AuctionBidFragment }) => {
99
const { displayName, ensAvatar } = useEnsData(bid?.bidder)
10+
const comment = bid.comment?.trim()
1011

1112
return (
12-
<Flex direction={'column'} my="x4" align="center" style={{ height: 35 }}>
13+
<Flex direction={'column'} my="x4" align="center">
1314
<Flex direction="row" width={'100%'} align="center" justify="space-between">
1415
<Flex direction="row" align="center">
1516
<Avatar address={bid.bidder} src={ensAvatar} size="28" />
@@ -31,6 +32,17 @@ export const BidCard = ({ bid }: { bid: AuctionBidFragment }) => {
3132
</Flex>
3233
</Flex>
3334
</Flex>
35+
{comment ? (
36+
<Box mt="x2" width="100%">
37+
<Text
38+
variant="paragraph-sm"
39+
color="secondary"
40+
style={{ wordBreak: 'break-word' }}
41+
>
42+
{comment}
43+
</Text>
44+
</Box>
45+
) : null}
3446
<Box
3547
mt="x2"
3648
style={{

packages/auction-ui/src/components/CurrentAuction/RecentBids.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,41 @@ export const RecentBids: React.FC<RecentBidsProps> = ({ bids }) => {
1515
return bids.length ? (
1616
<Box mt="x3">
1717
<Stack>
18-
{bids.slice(0, 3).map(({ amount, bidder, id }) => (
18+
{bids.slice(0, 3).map(({ amount, bidder, id, comment }) => (
1919
<Flex
20+
direction="column"
2021
align="center"
2122
py="x2"
22-
justify="space-between"
2323
key={`${bidder}_${amount}_${id}`}
2424
className={recentBid}
2525
>
26-
<Bidder address={bidder} />
26+
<Flex align="center" justify="space-between" width="100%">
27+
<Bidder address={bidder} />
2728

28-
<Flex
29-
align="center"
30-
as="a"
31-
href={`/profile/${bidder}`}
32-
target="_blank"
33-
rel="noopener noreferrer"
34-
>
35-
<Text mr="x2" variant="paragraph-md" color="tertiary">
36-
{amount} ETH
37-
</Text>
38-
<Icon id="external-16" fill="text4" size="sm" align={'center'} />
29+
<Flex
30+
align="center"
31+
as="a"
32+
href={`/profile/${bidder}`}
33+
target="_blank"
34+
rel="noopener noreferrer"
35+
>
36+
<Text mr="x2" variant="paragraph-md" color="tertiary">
37+
{amount} ETH
38+
</Text>
39+
<Icon id="external-16" fill="text4" size="sm" align={'center'} />
40+
</Flex>
3941
</Flex>
42+
43+
{comment?.trim() ? (
44+
<Text
45+
mt="x2"
46+
variant="paragraph-sm"
47+
color="secondary"
48+
style={{ width: '100%', wordBreak: 'break-word' }}
49+
>
50+
{comment.trim()}
51+
</Text>
52+
) : null}
4053
</Flex>
4154
))}
4255
<Flex mt="x4" align="center" justify="center" className={recentBid}>

packages/constants/src/subgraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const createSubgraphUrl = (name: string, version = VERSION): string =>
1111

1212
export const PUBLIC_SUBGRAPH_URL: Map<CHAIN_ID, string> = new Map([
1313
[CHAIN_ID.ETHEREUM, createSubgraphUrl('nouns-builder-ethereum-mainnet')],
14-
[CHAIN_ID.SEPOLIA, createSubgraphUrl('nouns-builder-ethereum-sepolia')],
14+
[CHAIN_ID.SEPOLIA, createSubgraphUrl('nouns-builder-ethereum-sepolia', '0.1.16')],
1515
[CHAIN_ID.OPTIMISM, createSubgraphUrl('nouns-builder-optimism-mainnet')],
1616
[CHAIN_ID.OPTIMISM_SEPOLIA, createSubgraphUrl('nouns-builder-optimism-sepolia')],
1717
[CHAIN_ID.BASE, createSubgraphUrl('nouns-builder-base-mainnet')],

packages/dao-ui/src/components/About/ExternalLinks.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ const normalizeLinkKey = (key: string): string => {
4747
return normalized === 'twitter' ? 'x' : normalized
4848
}
4949

50+
const normalizeUrlForDedupe = (url: string): string =>
51+
url.trim().replace(/\/+$/, '').toLowerCase()
52+
5053
const getIconForLinkKey = (key: string): IconType => {
5154
if (key === 'x') return 'twitter'
5255
if (key === 'discord') return 'discord'
@@ -62,14 +65,18 @@ export const ExternalLinks: React.FC<ExternalLinksProps> = ({ links }) => {
6265
const normalizedLinks = React.useMemo(() => {
6366
const entries = Object.entries(links || {})
6467
const next: Record<string, string> = {}
68+
const usedUrls: Record<string, boolean> = {}
6569

6670
for (const [rawKey, rawUrl] of entries) {
6771
const key = normalizeLinkKey(rawKey)
6872
const url = rawUrl?.trim?.() || ''
73+
const normalizedUrl = normalizeUrlForDedupe(url)
6974

7075
if (!key || !url) continue
76+
if (usedUrls[normalizedUrl]) continue
7177
if (!next[key]) {
7278
next[key] = url
79+
usedUrls[normalizedUrl] = true
7380
}
7481
}
7582

packages/dao-ui/src/utils/daoMetadata.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,32 @@ export const parseDaoMetadataString = (
3939
}
4040

4141
const parseObject = (value: string): Record<string, unknown> | undefined => {
42-
try {
43-
const parsed = JSON.parse(value) as unknown
42+
const candidates = [value]
4443

45-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
46-
return parsed as Record<string, unknown>
47-
}
44+
for (const candidate of candidates) {
45+
try {
46+
const parsed = JSON.parse(candidate) as unknown
4847

49-
if (typeof parsed === 'string') {
50-
const nestedParsed = JSON.parse(parsed) as unknown
51-
if (
52-
nestedParsed &&
53-
typeof nestedParsed === 'object' &&
54-
!Array.isArray(nestedParsed)
55-
) {
56-
return nestedParsed as Record<string, unknown>
48+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
49+
return parsed as Record<string, unknown>
5750
}
58-
}
5951

60-
return undefined
61-
} catch {
62-
return undefined
52+
if (typeof parsed === 'string') {
53+
const nestedParsed = JSON.parse(parsed) as unknown
54+
if (
55+
nestedParsed &&
56+
typeof nestedParsed === 'object' &&
57+
!Array.isArray(nestedParsed)
58+
) {
59+
return nestedParsed as Record<string, unknown>
60+
}
61+
}
62+
} catch {
63+
continue
64+
}
6365
}
66+
67+
return undefined
6468
}
6569

6670
const parsed = parseObject(raw)

packages/sdk/codegen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
generates:
22
src/subgraph/sdk.generated.ts:
3-
schema: 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-base-mainnet/0.1.16/gn'
3+
schema: 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-ethereum-sepolia/0.1.16/gn'
44
documents: 'src/subgraph/**/*.graphql'
55
plugins:
66
- typescript

0 commit comments

Comments
 (0)