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

fix(ui): adapt payment confirm size #712

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 5 additions & 7 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ export type InfoModalProps = Omit<BaseModalProps, 'backdrop'> & {
}

const InfoModal = ({
isShown,
title,
children,
onCancel,
onSubmit,
submitButtonText,
size,
...baseModalProps
}: PropsWithChildren<InfoModalProps>) => {
return (
<BaseModal isShown={isShown} title={title} onCancel={onCancel} backdrop={true} size={size}>
<BaseModal {...baseModalProps} onCancel={onCancel} backdrop={true}>
<rb.Modal.Body className={styles['modal-body']}>{children}</rb.Modal.Body>
<rb.Modal.Footer className={styles['modal-footer']}>
<rb.Button variant="outline-dark" onClick={() => onSubmit()}>
Expand All @@ -65,15 +63,15 @@ const InfoModal = ({
)
}

export type ConfirmModalProps = Omit<InfoModalProps, 'onSubmit' | 'submitButtonText'> & {
export type ConfirmModalProps = BaseModalProps & {
onConfirm: () => void
}

const ConfirmModal = ({ isShown, title, children, onCancel, onConfirm }: PropsWithChildren<ConfirmModalProps>) => {
const ConfirmModal = ({ children, onCancel, onConfirm, ...baseModalProps }: PropsWithChildren<ConfirmModalProps>) => {
const { t } = useTranslation()

return (
<BaseModal isShown={isShown} title={title} onCancel={onCancel}>
<BaseModal {...baseModalProps} onCancel={onCancel}>
<rb.Modal.Body className={styles['modal-body']}>{children}</rb.Modal.Body>
<rb.Modal.Footer className={styles['modal-footer']}>
<rb.Button
Expand Down
5 changes: 4 additions & 1 deletion src/components/Send/DestinationInputField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import * as rb from 'react-bootstrap'
import classNames from 'classnames'
Expand Down Expand Up @@ -42,6 +42,7 @@ export const DestinationInputField = ({
const [field] = useField<DestinationValue>(name)
const form = useFormikContext<any>()

const ref = useRef<HTMLInputElement>(null)
const [destinationJarPickerShown, setDestinationJarPickerShown] = useState(false)

return (
Expand Down Expand Up @@ -106,6 +107,7 @@ export const DestinationInputField = ({
className={styles.button}
onClick={() => {
form.setFieldValue(field.name, form.initialValues[field.name], true)
setTimeout(() => ref.current?.focus(), 4)
}}
disabled={disabled}
>
Expand All @@ -118,6 +120,7 @@ export const DestinationInputField = ({
<div className={form.touched[field.name] && !!form.errors[field.name] ? 'is-invalid' : ''}>
<rb.InputGroup hasValidation={true}>
<rb.Form.Control
ref={ref}
aria-label={label}
name={field.name}
placeholder={t('send.placeholder_recipient')}
Expand Down
1 change: 1 addition & 0 deletions src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ export default function Send({ wallet }: SendProps) {

{showConfirmSendModal && (
<PaymentConfirmModal
size="lg"
isShown={true}
title={t('send.confirm_send_modal.title')}
onCancel={() => setShowConfirmSendModal(undefined)}
Expand Down
1 change: 1 addition & 0 deletions src/components/fb/SpendFidelityBondModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ const SpendFidelityBondModal = ({
</rb.Modal>
{showConfirmSendModal && fidelityBond && selectedDestinationJarIndex !== undefined && (
<PaymentConfirmModal
size="lg"
isShown={true}
title={t(`earn.fidelity_bond.move.${enableDestinationJarSelection ? 'confirm_send_modal.title' : 'title'}`)}
onCancel={() => {
Expand Down