Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(synapse-interface): destination address #2137

Merged
merged 128 commits into from
Mar 27, 2024
Merged
Changes from 5 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
77879d3
Init
bigboydiamonds Feb 21, 2024
fcf1ce8
Basic Address Input
bigboydiamonds Feb 29, 2024
0159b08
Detect if input is valid address
bigboydiamonds Feb 29, 2024
d32d59e
Click on Input to trigger warning
bigboydiamonds Feb 29, 2024
d1b0af1
DestinationInputWarning to handle accept/reject warning
bigboydiamonds Feb 29, 2024
efab9e7
Hide placeholder when input is active
bigboydiamonds Mar 7, 2024
7e978c5
Input display when input address valid
bigboydiamonds Mar 8, 2024
59d19e9
Input width
bigboydiamonds Mar 8, 2024
de974f3
DestinationInputWarning state
bigboydiamonds Mar 8, 2024
d6e7e12
Warning accept/reject callback
bigboydiamonds Mar 8, 2024
70a2dc4
DestinationInputWarning to take up entire output container
bigboydiamonds Mar 8, 2024
a478832
Style Warning
bigboydiamonds Mar 8, 2024
da0b429
Focus on Input after accepting warning terms
bigboydiamonds Mar 8, 2024
22ac561
showDestinationWarning state in bridge display to track if user alrea…
bigboydiamonds Mar 8, 2024
69d6f64
Input border red signalling invalid input when activated
bigboydiamonds Mar 8, 2024
217f2bd
Merge
bigboydiamonds Mar 8, 2024
c601dff
Improve isEmptyString
bigboydiamonds Mar 8, 2024
faf9769
SwitchButton takes priority over OutputContainer in visual layer
bigboydiamonds Mar 8, 2024
46cac4a
Clear Input button
bigboydiamonds Mar 8, 2024
ee632c6
Style and format clear button for smooth input clearing
bigboydiamonds Mar 8, 2024
ecda0a6
Style Close Button
bigboydiamonds Mar 8, 2024
7f19f1a
Clean
bigboydiamonds Mar 8, 2024
79e4959
filterTransactionsByRecipient
bigboydiamonds Mar 8, 2024
b7bb785
Calculate days ago a recipient tx was executed
bigboydiamonds Mar 8, 2024
7cb1372
filterNewestTxByRecipient
bigboydiamonds Mar 8, 2024
d96d442
Display list of recipient addresses when input is focused
bigboydiamonds Mar 8, 2024
0b9b7c0
Style Receipient dropdown list
bigboydiamonds Mar 8, 2024
80cf858
Destination address settable from dropdown list
bigboydiamonds Mar 8, 2024
6097611
Close dropdown after selecting new destination address from list
bigboydiamonds Mar 8, 2024
200dca2
Disable Input if wallet unconnected
bigboydiamonds Mar 8, 2024
4034465
Hover text on Input
bigboydiamonds Mar 9, 2024
3bb245a
Input html states, styling
bigboydiamonds Mar 9, 2024
f0858a5
Remove previous dest address settings state + component
bigboydiamonds Mar 11, 2024
49f2aae
Merge branch 'master' into fe/destination-address
bigboydiamonds Mar 11, 2024
e413c50
Optimize OutputContianer address prop passed into DestinationAddressI…
bigboydiamonds Mar 11, 2024
71c0068
Clean Bridge imports
bigboydiamonds Mar 11, 2024
4fc57eb
Style Input
bigboydiamonds Mar 11, 2024
1bd7897
Replace useSelector with hook
bigboydiamonds Mar 11, 2024
b547ccc
clearDestinationAddress on Bridge Page load
bigboydiamonds Mar 11, 2024
49dc0b5
Clean up Bridge reducer to not require actions file for better imports
bigboydiamonds Mar 11, 2024
9b9dc59
Rm file
bigboydiamonds Mar 11, 2024
b38856e
Maintain inputted destination address after bridge tx executes
bigboydiamonds Mar 11, 2024
d8042c6
Clear destination address by setting to null, clear input
bigboydiamonds Mar 14, 2024
fed26e1
Fix errors in BridgeTransactionButton
bigboydiamonds Mar 14, 2024
92440ef
User inputted empty string throws error in input
bigboydiamonds Mar 14, 2024
ef9b6b8
Clean
bigboydiamonds Mar 14, 2024
aa137c7
Update text error state
bigboydiamonds Mar 14, 2024
0978dc9
Clean callbacks to make clear input flow clearer
bigboydiamonds Mar 14, 2024
94edb5d
Clean
bigboydiamonds Mar 14, 2024
d6b4a2a
Fix console errors
bigboydiamonds Mar 14, 2024
24ec14d
Clean
bigboydiamonds Mar 14, 2024
0360055
Add hover on warning buttnos
bigboydiamonds Mar 14, 2024
f750b73
.
bigboydiamonds Mar 14, 2024
f50ea1f
Refactor; clean functions
bigboydiamonds Mar 14, 2024
d13e927
Use destination address as key
bigboydiamonds Mar 14, 2024
00d037d
Style address dropdown
bigboydiamonds Mar 14, 2024
bd3a94f
Rm log
bigboydiamonds Mar 14, 2024
39bc7da
Clean
bigboydiamonds Mar 14, 2024
db5c904
Keep inputRef local
bigboydiamonds Mar 14, 2024
0b2f237
Add To
bigboydiamonds Mar 18, 2024
01f0868
Dynamically set Input width
bigboydiamonds Mar 18, 2024
5c7621e
Adjust spacing for filled input
bigboydiamonds Mar 18, 2024
7af63ca
Dynamic input width including placeholder
bigboydiamonds Mar 18, 2024
83667c4
Increase input width when focused
bigboydiamonds Mar 18, 2024
48d85d6
Remove shift when x button appears
bigboydiamonds Mar 18, 2024
114eb79
Max width for input to fit on mobile
bigboydiamonds Mar 18, 2024
29c262d
Clean
bigboydiamonds Mar 18, 2024
d370414
Basic Confirm Warning
bigboydiamonds Mar 19, 2024
f05f7b7
Connect ConfirmWarning to store
bigboydiamonds Mar 19, 2024
febdc04
Allow Warning text to be clickable
bigboydiamonds Mar 19, 2024
63c7799
Style: BridgeTransactionButton Warning
bigboydiamonds Mar 19, 2024
9cd63db
Add setIsDestinationWarningAccepted to state to track status
bigboydiamonds Mar 19, 2024
77b60fd
Show Confirm warning button when warning not yet accepted + tracked i…
bigboydiamonds Mar 19, 2024
6bcddde
Conditions for showing Destination Address in Bridge Receipt
bigboydiamonds Mar 19, 2024
2ff1c61
Remove prior destination warning popup
bigboydiamonds Mar 19, 2024
7cc26a6
BridgeWarnings
bigboydiamonds Mar 19, 2024
44a788e
Conditions to show Warning
bigboydiamonds Mar 19, 2024
7649d43
Conditions to hide Destination Address Input
bigboydiamonds Mar 19, 2024
3e2f1b7
Simplify
bigboydiamonds Mar 19, 2024
6fda9b6
Update button color for Confirm destination address
bigboydiamonds Mar 19, 2024
8d76d91
Use default text size for dropdown
bigboydiamonds Mar 19, 2024
8f27298
Ensure blur from input on handleInputBlur
bigboydiamonds Mar 19, 2024
a393ab2
Ensure blur from input on handleInputBlur
bigboydiamonds Mar 19, 2024
890e12b
..
bigboydiamonds Mar 20, 2024
333ad9e
Add paste functionality
bigboydiamonds Mar 20, 2024
2fdfd16
Conditions to show paste button
bigboydiamonds Mar 20, 2024
5b72788
Add key press up/down direction for navigating list
bigboydiamonds Mar 20, 2024
5b28b0b
Add pressing enter key functionality to select Address from list
bigboydiamonds Mar 20, 2024
b4fff36
Reset list idx onClose
bigboydiamonds Mar 20, 2024
0e06389
Clean
bigboydiamonds Mar 20, 2024
ef04598
Prevent input blur when mouseDown on ListReceipient item
bigboydiamonds Mar 20, 2024
4da94c0
Blur after selecting address from list
bigboydiamonds Mar 20, 2024
0e3c2de
Update input ref to useRef
bigboydiamonds Mar 20, 2024
a38da40
Merge branch 'master' into fe/destination-address
bigboydiamonds Mar 20, 2024
edd5d5e
Fix merge imports
bigboydiamonds Mar 20, 2024
f6b2d6a
Make input smaller
bigboydiamonds Mar 20, 2024
1df3748
Unconnected input padding
bigboydiamonds Mar 20, 2024
7b8191d
Remove shift when input is valid address
bigboydiamonds Mar 20, 2024
6985a00
Add back SettingsSlideOver
bigboydiamonds Mar 22, 2024
74e6091
Add back settings toggled page
bigboydiamonds Mar 22, 2024
dc7942a
Show destination address input when toggled on from Settings
bigboydiamonds Mar 22, 2024
42e29e6
Clean SettingsSlideOver
bigboydiamonds Mar 22, 2024
13de2ef
Clean
bigboydiamonds Mar 22, 2024
8a20b52
Remove Pink highlight on Input
bigboydiamonds Mar 22, 2024
7c5a3d7
Increase spacing between address and days ago
bigboydiamonds Mar 22, 2024
f5e80ab
Increase width of input, limit for mobile
bigboydiamonds Mar 22, 2024
1c8d669
Remove yellow text in Warning
bigboydiamonds Mar 22, 2024
f1782c4
Only show Destination Address in Receipt if valid
bigboydiamonds Mar 22, 2024
36fbfed
Clear input if invalid and exists
bigboydiamonds Mar 22, 2024
d265e72
Adjust dropdown spacing
bigboydiamonds Mar 22, 2024
26b5054
Minor adjustments
bigboydiamonds Mar 22, 2024
ac213f8
Blur input after clearing
bigboydiamonds Mar 22, 2024
af56d2d
Enter button can submit input text for validation
bigboydiamonds Mar 22, 2024
b5e41cf
Paste icon sizing
bigboydiamonds Mar 22, 2024
8049cd7
Show dest address for unconnected user if inputted
bigboydiamonds Mar 22, 2024
4860582
Hide destination address input on page load between page switch
bigboydiamonds Mar 25, 2024
772609a
Merge branch 'master' into fe/destination-address
bigboydiamonds Mar 25, 2024
eb7f5c1
Hide Bridge Warning if destination address is turned off
bigboydiamonds Mar 25, 2024
f8279ad
Ensure bridge listener clears destination address if destination inpu…
bigboydiamonds Mar 25, 2024
8701478
Remove unused code
bigboydiamonds Mar 26, 2024
7eff4c6
Fix enter bug when wallet disconnected
bigboydiamonds Mar 26, 2024
78c5ced
Update dispatch value
bigboydiamonds Mar 26, 2024
8e2c426
Update to proper action to dispatch
bigboydiamonds Mar 26, 2024
1226707
Add back segment given we are using settings
bigboydiamonds Mar 26, 2024
254e758
Merge branch 'master' into fe/destination-address
bigboydiamonds Mar 26, 2024
56163a7
Lint
bigboydiamonds Mar 26, 2024
56a3e16
Remove side effect to clear dest address
bigboydiamonds Mar 26, 2024
462ccfb
Origin token copy
abtestingalpha Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { useState } from 'react'
import { isValidAddress } from '@/utils/isValidAddress'

export const _DestinationAddressInput = ({
connectedAddress,
}: {
connectedAddress: string
}) => {
// TODO: Lift state up to Redux slice after working example
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
const [enableInput, setEnableInput] = useState<boolean>(false)
const [showWarning, setShowWarning] = useState<boolean>(false)
const [inputValue, setInputValue] = useState<string>('')

const handleInput = (value) => {
setInputValue(value)
}
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved

const handleActivateWarning = () => {
setShowWarning(true)
}

const onEnableInput = () => {
setEnableInput(true)
}

const onReset = () => {
setShowWarning(false)
setEnableInput(false)
}

const isInputValidAddress = isValidAddress(inputValue)
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved

return (
<div id="destination-address-input" onClick={handleActivateWarning}>
<input
placeholder={connectedAddress ?? 'Connect Wallet'}
value={inputValue}
onChange={handleInput}
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
/>
{showWarning && (
<DestinationInputWarning
onEnableInput={onEnableInput}
onReset={onReset}
/>
)}
<div>{isInputValidAddress ? 'Valid Address' : 'Invalid Address'}</div>
</div>
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
)
}

const DestinationInputWarning = ({ onEnableInput, onReset }) => {
return (
<div>
Warning!
<div className="flex">
<button onClick={onEnableInput}>Accept</button>
<button onClick={onReset}>Cancel</button>
</div>
</div>
)
}
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
Loading