-
Notifications
You must be signed in to change notification settings - Fork 1
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
PE-5965: gateways page (start gateway, gateway information banner) #6
PE-5965: gateways page (start gateway, gateway information banner) #6
Conversation
kunstmusik
commented
May 3, 2024
- Adds banner for starting a gateway when a user does not have a gateway registered
- Adds modal for entering information for gateway and executes joinGateway()
- Adds banner for showing gateway information if a user does have a gateway
Visit the preview URL for this PR (updated for commit cdfe25f): https://ar-io-network-portal-a40ee--pr6-pe-5965-gateways-pag-jjhsxeo7.web.app (expires Thu, 23 May 2024 18:38:07 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 7abfae09c4446982a71cbb94b0cbf4688377a111 |
… for delegated staking
…y info, and display of pending gateway information
|
||
const { gatewayInfo, gatewayStatus } = useGatewayInfo(); | ||
|
||
return gatewayStatus !== GatewayStatus.NOT_FOUND ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could consider breaking this into GatewayStatusNotFound
and GatewayStatusFound
(or similar) components to better read the ternary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm alright with this as an enum at the moment. I think let's see how dev continues on and if it starts to get in the way of clarity let's revisit again then.
Co-authored-by: Derek Sonnenberg <[email protected]>
useEffect(() => { | ||
if (wallet) { | ||
const signer = wallet.signer; | ||
|
||
if (signer) { | ||
const writeable = ArIO.init({ | ||
contractTxId: ARNS_REGISTRY_ADDRESS.toString(), | ||
signer, | ||
}); | ||
setArIOWriteableSDK(writeable); | ||
} | ||
} else { | ||
setArIOWriteableSDK(undefined); | ||
} | ||
}, [setArIOWriteableSDK, wallet]); | ||
|
||
useEffect(() => { | ||
if (walletAddress) { | ||
const update = async () => { | ||
const gateway = await arIOReadSDK.getGateway({ | ||
address: walletAddress.toString(), | ||
}); | ||
setGateway(gateway); | ||
}; | ||
update(); | ||
} else { | ||
setGateway(undefined); | ||
} | ||
}, [arIOReadSDK, setGateway, walletAddress]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this interact with the component at all? Might be nice to wrap in a custom hook that describes what we're setting up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are dealing with global app state stored in zustand. Components in the app will get updates by using useGlobalStore() with selectors (so they're only listening to relevant changes in the store).
In the next story, I'm adding react-query for fetching and caching data from servers (i.e., ar.io/sdk app calls). zustand will remain for global app state. The plan for rules right now will be:
- Retrieving app state: use useGlobalStore() with selectors or hooks if data is dependent upon some calculated state
- Retrieving data from servers: use hooks that will wrap react-query calls
Will be revisiting this code and elsewhere as I add in react-query and add hooks for those.
…ithub.com:ar-io/network-portal into PE-5965-gateways-page-join-network-manage-gateway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I successfully connected my wallet and submitted a join gateway request. The failure case for insufficient funds on Tx was caught and the error UX was smooth
great work here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested the UI and could do what i expected, did not go through code intensely but looking good from a structure standpoint