-
Notifications
You must be signed in to change notification settings - Fork 5k
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: adding / deleting additional RPC URLs #25452
Changes from all commits
4ff3d6b
adb9efa
04a4c02
13afd6e
ab714b5
d22da9f
7537bd3
46d22ea
3f38e5c
2ef606a
667e58a
a2deb40
dbea8b5
74658e2
7ff6370
2e4d1fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { | ||
BlockSize, | ||
Display, | ||
} from '../../../../helpers/constants/design-system'; | ||
import { | ||
Box, | ||
ButtonPrimary, | ||
ButtonPrimarySize, | ||
ButtonSecondary, | ||
ButtonSecondarySize, | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalHeader, | ||
ModalOverlay, | ||
} from '../../../component-library'; | ||
import { useI18nContext } from '../../../../hooks/useI18nContext'; | ||
import { | ||
hideModal, | ||
setEditedNetwork, | ||
toggleNetworkMenu, | ||
} from '../../../../store/actions'; | ||
|
||
const ConfirmDeleteRpcUrlModal = () => { | ||
const t = useI18nContext(); | ||
const dispatch = useDispatch(); | ||
return ( | ||
<Modal | ||
isClosedOnEscapeKey={true} | ||
isClosedOnOutsideClick={true} | ||
isOpen={true} | ||
onClose={() => { | ||
dispatch(setEditedNetwork()); | ||
dispatch(hideModal()); | ||
}} | ||
> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalHeader>{t('confirmDeletion')}</ModalHeader> | ||
<ModalBody> | ||
<Box>{t('confirmRpcUrlDeletionMessage')}</Box> | ||
<Box display={Display.Flex} gap={4} marginTop={6}> | ||
<ButtonSecondary | ||
width={BlockSize.Full} | ||
size={ButtonSecondarySize.Lg} | ||
onClick={() => { | ||
dispatch(hideModal()); | ||
dispatch(toggleNetworkMenu()); | ||
}} | ||
> | ||
{t('back')} | ||
</ButtonSecondary> | ||
<ButtonPrimary | ||
width={BlockSize.Full} | ||
size={ButtonPrimarySize.Lg} | ||
danger={true} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here you can just use |
||
onClick={() => { | ||
console.log('TODO: Delete RPc URL'); | ||
}} | ||
> | ||
{t('deleteRpcUrl')} | ||
</ButtonPrimary> | ||
</Box> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ConfirmDeleteRpcUrlModal; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import { | ||
Box, | ||
ButtonPrimary, | ||
ButtonPrimarySize, | ||
FormTextField, | ||
} from '../../../component-library'; | ||
import { | ||
BlockSize, | ||
Display, | ||
TextVariant, | ||
} from '../../../../helpers/constants/design-system'; | ||
import { useI18nContext } from '../../../../hooks/useI18nContext'; | ||
|
||
const AddRpcUrlModal = () => { | ||
const t = useI18nContext(); | ||
|
||
return ( | ||
<Box padding={4}> | ||
<FormTextField | ||
id="additional-rpc-url" | ||
label={t('additionalRpcUrl')} | ||
labelProps={{ | ||
children: undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to specify the value of children to undefined here? doesn't this take undefined by default ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
variant: TextVariant.bodySmMedium, | ||
}} | ||
/> | ||
|
||
<ButtonPrimary | ||
size={ButtonPrimarySize.Lg} | ||
display={Display.Block} | ||
width={BlockSize.Full} | ||
marginTop={8} | ||
marginLeft={'auto'} | ||
marginRight={'auto'} | ||
> | ||
{t('addUrl')} | ||
</ButtonPrimary> | ||
</Box> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we decide to include input validation here, it would be a good idea to write unit tests for this modal with the different scenarios ( |
||
); | ||
}; | ||
|
||
export default AddRpcUrlModal; |
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 don't think
={true}
is required here; I think the presence of the attribute inferstrue