Skip to content

Commit f7e567d

Browse files
authored
Merge main into prod
2 parents 1da44fe + bb36f23 commit f7e567d

File tree

4 files changed

+69
-11
lines changed

4 files changed

+69
-11
lines changed

src/app/client.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function HomeClientPage({ color: initialColor }: HomeClientPageProps) {
112112

113113
useEffect(() => {
114114
if (!(mintPending || mintRandomPending || allowlistMintPending)) return
115-
toast('Please confirm in your wallet', { position: 'bottom-right' })
115+
toast('Please confirm in your wallet')
116116
}, [mintPending, mintRandomPending, allowlistMintPending])
117117

118118
useEffect(() => {
@@ -177,6 +177,13 @@ export function HomeClientPage({ color: initialColor }: HomeClientPageProps) {
177177
if (r > 255) return
178178
setColor({ ...color, r })
179179
}}
180+
onKeyUp={(e) => {
181+
if (e.code === 'ArrowUp' && color.r !== 255) {
182+
setColor({ ...color, r: color.r + 1 })
183+
} else if (e.code === 'ArrowDown' && color.r !== 0) {
184+
setColor({ ...color, r: color.r - 1 })
185+
}
186+
}}
180187
>
181188
<TextField.Slot>R</TextField.Slot>
182189
</TextField.Root>
@@ -189,6 +196,13 @@ export function HomeClientPage({ color: initialColor }: HomeClientPageProps) {
189196
if (g > 255) return
190197
setColor({ ...color, g })
191198
}}
199+
onKeyUp={(e) => {
200+
if (e.code === 'ArrowUp' && color.g !== 255) {
201+
setColor({ ...color, g: color.g + 1 })
202+
} else if (e.code === 'ArrowDown' && color.g !== 0) {
203+
setColor({ ...color, g: color.g - 1 })
204+
}
205+
}}
192206
>
193207
<TextField.Slot>G</TextField.Slot>
194208
</TextField.Root>
@@ -201,6 +215,13 @@ export function HomeClientPage({ color: initialColor }: HomeClientPageProps) {
201215
if (b > 255) return
202216
setColor({ ...color, b })
203217
}}
218+
onKeyUp={(e) => {
219+
if (e.code === 'ArrowUp' && color.b !== 255) {
220+
setColor({ ...color, b: color.b + 1 })
221+
} else if (e.code === 'ArrowDown' && color.b !== 0) {
222+
setColor({ ...color, b: color.b - 1 })
223+
}
224+
}}
204225
>
205226
<TextField.Slot>B</TextField.Slot>
206227
</TextField.Root>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.primary {
2+
background-color: black;
3+
}

src/app/transactions/[hash]/client.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import { idToColor } from '@/lib/color'
66
import { getUrl } from '@/lib/next'
77
import { Box, Button, Flex, Grid, Spinner, Text } from '@radix-ui/themes'
88
import Link from 'next/link'
9-
import type { PropsWithChildren } from 'react'
9+
import { type PropsWithChildren, useCallback } from 'react'
10+
import { toast } from 'sonner'
11+
import { useCopyToClipboard } from 'usehooks-ts'
1012
import { type Hash, parseEventLogs } from 'viem'
1113
import { useAccount, useWaitForTransactionReceipt } from 'wagmi'
14+
import styles from './client.module.css'
1215

1316
type TransactionClientPageProps = {
1417
hash: Hash
@@ -32,6 +35,20 @@ export function TransactionClientPage({
3235
isSuccess: isConfirmed,
3336
} = useWaitForTransactionReceipt({ hash })
3437

38+
const [, copy] = useCopyToClipboard()
39+
const handleCopyClicked = useCallback(
40+
(text: string) => () => {
41+
async function handle() {
42+
const success = await copy(text)
43+
if (success) toast('Copied to clipboard!')
44+
else toast('Failed to copy to clipboard')
45+
}
46+
47+
void handle()
48+
},
49+
[copy],
50+
)
51+
3552
const isRandom = 'amount' in props
3653

3754
if (isConfirming)
@@ -78,9 +95,16 @@ export function TransactionClientPage({
7895
Welcome to RGB
7996
</Text>
8097
</Flex>
98+
<Box width="100%" maxWidth="300px" asChild>
99+
<Button size="3" asChild>
100+
<Link href={`/accounts/${address}`} className={styles.primary}>
101+
View your Signatures
102+
</Link>
103+
</Button>
104+
</Box>
81105
<Box width="100%" maxWidth="300px" asChild>
82106
<Button variant="outline" size="3" asChild>
83-
<Link href={`/accounts/${address}`}>View your Signatures</Link>
107+
<Link href="/">Mint more</Link>
84108
</Button>
85109
</Box>
86110
</Wrapper>
@@ -105,9 +129,16 @@ export function TransactionClientPage({
105129
</Text>
106130
</Flex>
107131
<Grid width="100%" maxWidth="300px" columns="2" rows="2" gap="3">
132+
<Box gridColumn="1 / span 2" asChild>
133+
<Button size="3" asChild>
134+
<Link href={`/signatures/${id}`} className={styles.primary}>
135+
View Signature
136+
</Link>
137+
</Button>
138+
</Box>
108139
<Box gridColumn="1 / span 2" asChild>
109140
<Button variant="outline" size="3" asChild>
110-
<Link href={`/signatures/${id}`}>View Signature</Link>
141+
<Link href="/">Mint another</Link>
111142
</Button>
112143
</Box>
113144
<Button variant="outline" size="3" asChild>
@@ -126,6 +157,11 @@ export function TransactionClientPage({
126157
Share on FC
127158
</Link>
128159
</Button>
160+
<Box gridColumn="1 / span 2" asChild>
161+
<Button variant="outline" size="3" onClick={handleCopyClicked(url)}>
162+
Copy link
163+
</Button>
164+
</Box>
129165
</Grid>
130166
</Wrapper>
131167
)

src/components/MintFeed.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,19 @@ export function MintFeed() {
4545
</Text>
4646
<Signature color={color} size={16} bordered />
4747
</Flex>,
48+
{ position: 'top-center' },
4849
)
4950
return
5051
}
5152

52-
debouncedToast(`${name} minted x${logs.length} random`)
53+
debouncedToast(`${name} minted x${logs.length} random`, {
54+
position: 'top-center',
55+
})
5356
}
5457

5558
void handle()
5659
},
5760
})
5861

59-
return (
60-
<Toaster
61-
position="top-center"
62-
toastOptions={{ style: { borderRadius: 0 } }}
63-
/>
64-
)
62+
return <Toaster toastOptions={{ style: { borderRadius: 0 } }} />
6563
}

0 commit comments

Comments
 (0)