Skip to content

Commit 93b70c1

Browse files
authored
Merge pull request #1216 from peanutprotocol/feat/sucess-txn-ctas
[TASK-13463] Feat: Add go to profile button and update create account button
2 parents 36a5da4 + 87f1aa2 commit 93b70c1

4 files changed

Lines changed: 63 additions & 8 deletions

File tree

src/components/Claim/Link/Onchain/Success.view.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import { useEffect, useMemo } from 'react'
1414
import type { Hash } from 'viem'
1515
import { formatUnits } from 'viem'
1616
import * as _consts from '../../Claim.consts'
17+
import Image from 'next/image'
18+
import { PEANUT_LOGO_BLACK, PEANUTMAN_LOGO } from '@/assets'
19+
import CreateAccountButton from '@/components/Global/CreateAccountButton'
1720

1821
export const SuccessClaimLinkView = ({
1922
transactionHash,
@@ -129,11 +132,7 @@ export const SuccessClaimLinkView = ({
129132
</Button>
130133
)
131134
}
132-
return (
133-
<Button icon="user-plus" onClick={() => router.push('/setup')} shadowSize="4">
134-
Create Account
135-
</Button>
136-
)
135+
return <CreateAccountButton onClick={() => router.push('/setup')} />
137136
}
138137

139138
return (
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client'
2+
3+
import { PEANUT_LOGO_BLACK, PEANUTMAN_LOGO } from '@/assets'
4+
import { Button } from '@/components/0_Bruddle'
5+
import Image from 'next/image'
6+
import React from 'react'
7+
8+
interface CreateAccountButtonProps {
9+
onClick: () => void
10+
}
11+
12+
const CreateAccountButton = ({ onClick }: CreateAccountButtonProps) => {
13+
return (
14+
<Button onClick={onClick} shadowSize="4">
15+
<div>Create a</div>
16+
<div className="flex items-center gap-1">
17+
<Image src={PEANUTMAN_LOGO} alt="Peanut Logo" className="size-5" />
18+
<Image src={PEANUT_LOGO_BLACK} alt="Peanut Logo" />
19+
</div>
20+
<div>account</div>
21+
</Button>
22+
)
23+
}
24+
25+
export default CreateAccountButton

src/components/Payment/Views/Status.payment.view.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
'use client'
2+
import { PEANUT_LOGO_BLACK, PEANUTMAN_LOGO } from '@/assets'
23
import { Button } from '@/components/0_Bruddle'
34
import AddressLink from '@/components/Global/AddressLink'
45
import Card from '@/components/Global/Card'
6+
import CreateAccountButton from '@/components/Global/CreateAccountButton'
57
import { Icon } from '@/components/Global/Icons/Icon'
68
import NavHeader from '@/components/Global/NavHeader'
79
import { SoundPlayer } from '@/components/Global/SoundPlayer'
@@ -18,6 +20,7 @@ import { paymentActions } from '@/redux/slices/payment-slice'
1820
import { ApiUser } from '@/services/users'
1921
import { formatAmount, getInitialsFromName, printableAddress } from '@/utils'
2022
import { useQueryClient } from '@tanstack/react-query'
23+
import Image from 'next/image'
2124
import { useRouter } from 'next/navigation'
2225
import { ReactNode, useEffect, useMemo } from 'react'
2326
import { useDispatch } from 'react-redux'
@@ -230,9 +233,7 @@ const DirectSuccessView = ({
230233
Back to home
231234
</Button>
232235
) : (
233-
<Button icon="user-plus" onClick={() => router.push('/setup')} shadowSize="4">
234-
Create Account
235-
</Button>
236+
<CreateAccountButton onClick={() => router.push('/setup')} />
236237
)}
237238
{type === 'SEND' && !isExternalWalletFlow && !isWithdrawFlow && (
238239
<Button

src/components/TransactionDetails/TransactionDetailsReceipt.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client'
2+
13
import Card from '@/components/Global/Card'
24
import { PaymentInfoRow } from '@/components/Payment/PaymentInfoRow'
35
import { TransactionDetails } from '@/components/TransactionDetails/transactionTransformer'
@@ -28,6 +30,7 @@ import { twMerge } from 'tailwind-merge'
2830
import { isAddress } from 'viem'
2931
import { getBankAccountLabel, TransactionDetailsRowKey, transactionDetailsRowKeys } from './transaction-details.utils'
3032
import { useSupportModalContext } from '@/context/SupportModalContext'
33+
import { useRouter } from 'next/navigation'
3134

3235
export const TransactionDetailsReceipt = ({
3336
transaction,
@@ -59,6 +62,7 @@ export const TransactionDetailsReceipt = ({
5962
const [tokenData, setTokenData] = useState<{ symbol: string; icon: string } | null>(null)
6063
const [isTokenDataLoading, setIsTokenDataLoading] = useState(true)
6164
const { setIsSupportModalOpen } = useSupportModalContext()
65+
const router = useRouter()
6266

6367
useEffect(() => {
6468
setIsModalOpen?.(showCancelLinkModal)
@@ -278,6 +282,16 @@ export const TransactionDetailsReceipt = ({
278282
}
279283
}
280284

285+
// Show profile button only if txn is completed, not to/by a guest user and its a send/request/receive txn
286+
const showUserProfileButton =
287+
!!transaction &&
288+
transaction.status === 'completed' &&
289+
!!transaction.userName &&
290+
!isAddress(transaction.userName) &&
291+
(transaction.extraDataForDrawer?.transactionCardType === 'send' ||
292+
transaction.extraDataForDrawer?.transactionCardType === 'request' ||
293+
transaction.extraDataForDrawer?.transactionCardType === 'receive')
294+
281295
return (
282296
<div ref={contentRef} className={twMerge('space-y-4', className)}>
283297
{/* show qr code at the top if applicable */}
@@ -911,6 +925,22 @@ export const TransactionDetailsReceipt = ({
911925
</div>
912926
)}
913927

928+
{showUserProfileButton && (
929+
<div className="pr-1">
930+
<Button
931+
onClick={() => router.push(`/${transaction.userName}`)}
932+
shadowSize="4"
933+
variant={
934+
transaction.extraDataForDrawer?.transactionCardType === 'request'
935+
? 'purple'
936+
: 'primary-soft'
937+
}
938+
className="flex w-full items-center gap-1"
939+
>
940+
Go to {transaction.userName} profile
941+
</Button>
942+
</div>
943+
)}
914944
{/* Cancel deposit button for bridge_onramp transactions in awaiting_funds state */}
915945
{transaction.direction === 'bank_deposit' &&
916946
transaction.extraDataForDrawer?.originalType !== EHistoryEntryType.REQUEST &&

0 commit comments

Comments
 (0)