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

Policy disabled banner update #1124

Merged
merged 1 commit into from Dec 28, 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
8 changes: 5 additions & 3 deletions src/common/CoverForm/PurchasePolicyForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,11 @@ export const PurchasePolicyForm = ({

{
isPurchaseDisabled && (
<div className='p-3 bg-opacity-50 border-l-4 mt-7 pl-7 bg-940000 border-940000'>
<p className='text-white'>You cannot purchase this policy.</p>
</div>
<Alert>
<Trans>
You cannot purchase this policy, since the cover is disabled
</Trans>
</Alert>
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/common/CoverForm/Steps/PurchaseAmountStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,21 @@ const PurchaseAmountStep = ({
buttonProps={{
children: t`Max`,
onClick: () => {},
disabled: approving || purchasing || isPurchaseDisabled,
disabled: approving || purchasing,
buttonClassName: 'hidden'
}}
unit={liquidityTokenSymbol}
unitClass='!text-black font-semibold'
inputProps={{
id: 'cover-amount',
disabled: approving || purchasing || isPurchaseDisabled,
disabled: approving || purchasing,
placeholder: t`Enter Amount`,
value: value,
onChange: handleChange,
allowNegativeValue: false,
'data-testid': 'input-field'
}}
disabled={isPurchaseDisabled}
/>
{error && error !== 'Please connect your wallet' && <p className='flex items-center text-FA5C2F'>{error}</p>}

Expand Down
11 changes: 7 additions & 4 deletions src/common/Input/InputWithTrailingButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getPlainNumber } from '@/utils/formatter/input'
* @param {string} [param.unitClass]
* @param {boolean} [param.error]
* @param {number} param.decimalLimit
* @param {boolean} param.disabled
* @returns
*/
export const InputWithTrailingButton = ({
Expand All @@ -28,7 +29,8 @@ export const InputWithTrailingButton = ({
unitClass = '',
buttonProps: { buttonClassName, ...buttonProps },
error,
decimalLimit
decimalLimit,
disabled
}) => {
const ref = useRef(null)
const [width, setWidth] = useState()
Expand Down Expand Up @@ -69,13 +71,13 @@ export const InputWithTrailingButton = ({
const inputFieldProps = {
id: inputProps.id,
placeholder: inputProps.placeholder,
disabled: inputProps.disabled,
intlConfig: {
locale: locale
},
autoComplete: 'off',
decimalsLimit: typeof decimalLimit === 'number' ? decimalLimit : 25,
...inputProps,
disabled: inputProps.disabled || disabled,
onChange: null,
value: inputValue,
onValueChange: (val) => {
Expand All @@ -91,7 +93,7 @@ export const InputWithTrailingButton = ({
}

return (
<div className='relative w-full text-lg text-black'>
<div className={classNames('relative w-full text-lg text-black', disabled && 'opacity-40 cursor-not-allowed')}>
<CurrencyInput
{...inputFieldProps}
className={classNames(
Expand All @@ -115,9 +117,10 @@ export const InputWithTrailingButton = ({
className={classNames(
'px-6 m-px font-medium uppercase tracking-wide rounded-r-mdlg bg-DAE2EB hover:bg-DEEAF6 focus:outline-none focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:ring-4E7DD9',
buttonClassName,
buttonProps.disabled ? 'cursor-not-allowed' : 'hover:bg-DEEAF6'
(buttonProps.disabled || disabled) ? 'cursor-not-allowed' : 'hover:bg-DEEAF6'
)}
{...buttonProps}
disabled={buttonProps.disabled || disabled}
/>
</div>
</div>
Expand Down