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

PE-5965: gateways page (start gateway, gateway information banner) #6

Merged
merged 35 commits into from
May 10, 2024

Conversation

kunstmusik
Copy link
Collaborator

  • 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

@kunstmusik kunstmusik requested a review from a team as a code owner May 3, 2024 22:07
Copy link

github-actions bot commented May 3, 2024

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


const { gatewayInfo, gatewayStatus } = useGatewayInfo();

return gatewayStatus !== GatewayStatus.NOT_FOUND ? (
Copy link
Contributor

@fedellen fedellen May 8, 2024

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

Copy link
Collaborator Author

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.

Comment on lines +69 to +97
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]);
Copy link
Contributor

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

Copy link
Collaborator Author

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.

kunstmusik added 2 commits May 8, 2024 13:18
…ithub.com:ar-io/network-portal into PE-5965-gateways-page-join-network-manage-gateway
Copy link
Contributor

@fedellen fedellen left a 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!

Copy link
Collaborator

@dtfiedler dtfiedler left a 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

src/components/modals/StartGatewayModal.tsx Show resolved Hide resolved
src/components/modals/StartGatewayModal.tsx Show resolved Hide resolved
src/components/modals/StartGatewayModal.tsx Show resolved Hide resolved
src/components/modals/StartGatewayModal.tsx Show resolved Hide resolved
src/components/modals/StartGatewayModal.tsx Show resolved Hide resolved
src/components/modals/StartGatewayModal.tsx Outdated Show resolved Hide resolved
@kunstmusik kunstmusik merged commit 721dd36 into develop May 10, 2024
4 checks passed
@kunstmusik kunstmusik deleted the PE-5965-gateways-page-join-network-manage-gateway branch May 10, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants