Skip to content

Commit 9ca0cc2

Browse files
authored
Merge pull request #32 from tari-project/feat/functionality
New Features The input field in the bridge form now displays a "0" placeholder when empty. Bug Fixes The modal now stays open and reflects the correct step during transaction processing. Style The "Done" button in the wrap modal is no longer visible or clickable. Refactor Clicking outside a modal no longer closes it.
2 parents 4d38e2c + a1672cb commit 9ca0cc2

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

app/page.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function Home() {
4646
control,
4747
formState: { errors, isValid },
4848
} = useForm<BridgeFormValues>({
49-
defaultValues: { amount: '1000' },
49+
defaultValues: { amount: '' },
5050
mode: 'onChange',
5151
})
5252

@@ -79,8 +79,11 @@ export default function Home() {
7979
if (modalOpen && modalStep === 0 && isConnected) {
8080
setModalOpen(false)
8181
setModalStep(1)
82+
} else if (isProcessingTransaction) {
83+
setModalStep(2)
84+
setModalOpen(true)
8285
}
83-
}, [isConnected, modalOpen, modalStep])
86+
}, [isConnected, modalOpen, modalStep, isProcessingTransaction])
8487

8588
const handleConnectClick = () => {
8689
if (!isConnected) {
@@ -112,7 +115,13 @@ export default function Home() {
112115

113116
removePendingTransaction(txId)
114117
})
115-
}, [amount, address, bridgeToEthereum])
118+
}, [
119+
amount,
120+
address,
121+
bridgeToEthereum,
122+
addPendingTransaction,
123+
removePendingTransaction,
124+
])
116125

117126
const handleBridgeToTari = () => {
118127
console.log('Bridging to Tari...')

components/bridge-input/bridge-input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const BridgeInput: React.FC<BridgeInputProps> = ({
3737
{...field}
3838
type="number"
3939
variant="standard"
40+
placeholder="0"
4041
error={Boolean(errors.amount)}
4142
helperText={errors.amount?.message}
4243
slotProps={{

components/modals/main-modal/main-modal.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ export const MainModal: React.FC<MainModalProps> = ({
3333
setStep(1)
3434
}
3535

36-
const handleOutsideClick = (e: React.MouseEvent<HTMLDivElement>) => {
37-
if (modalRef.current && !modalRef.current.contains(e.target as Node)) {
38-
closeModal()
39-
}
40-
}
36+
// const handleOutsideClick = (e: React.MouseEvent<HTMLDivElement>) => {
37+
// if (modalRef.current && !modalRef.current.contains(e.target as Node)) {
38+
// closeModal()
39+
// }
40+
// }
4141

4242
if (step === 0 && isConnected) return null
4343

@@ -88,7 +88,7 @@ export const MainModal: React.FC<MainModalProps> = ({
8888
return (
8989
<div
9090
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50"
91-
onClick={handleOutsideClick}
91+
// onClick={handleOutsideClick}
9292
>
9393
<section
9494
ref={modalRef}

components/modals/wrap-modal/wrap-modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import React from 'react'
22
import Image from 'next/image'
33
// import { HiArrowRightOnRectangle } from 'react-icons/hi2'
44
import { WrapModalProps } from './wrap-modal.types'
5-
import { ModalButton } from '@/components/modals/modal-button'
5+
// import { ModalButton } from '@/components/modals/modal-button'
66
import { useBridgeInfo } from '@/hooks/use-bridge-info'
77

88
export const WrapModal: React.FC<WrapModalProps> = ({
9-
closeModal,
9+
// closeModal,
1010
amount,
1111
tariWalletAddress,
1212
ethereumAddress,
@@ -88,7 +88,7 @@ export const WrapModal: React.FC<WrapModalProps> = ({
8888
<div className="py-[0.5px] w-full bg-gray-300 mt-2 mb-4"></div> */}
8989

9090
{/* Section 1 */}
91-
<ModalButton label="Done" onClick={closeModal} disabled={false} />
91+
{/* <ModalButton label="Done" onClick={closeModal} disabled={false} /> */}
9292
</div>
9393
</div>
9494
</div>

0 commit comments

Comments
 (0)