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

Fixed keystore dropzone color #31

Merged
merged 2 commits into from
Jul 3, 2024
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
4 changes: 2 additions & 2 deletions src/pages/Send/helpers/getSelectedTokenBalance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatAmount } from 'lib';
import { formatAmount, getEgldLabel } from 'lib';
import { DECIMALS, DIGITS } from 'localConstants';
import { PartialNftType, TokenType } from 'types';
import { TokenOptionType } from '../types';
Expand Down Expand Up @@ -29,7 +29,7 @@ export const getSelectedTokenBalance = ({
return '1';
}

if (!currentToken.decimals) {
if (!currentToken.decimals && currentToken.identifier !== getEgldLabel()) {
return currentToken.balance ?? '0';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useEffect, useState, useRef } from 'react';
import {
faFileAlt,
faCheck,
faPencilAlt
faPencilAlt,
faLock
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
Expand Down Expand Up @@ -166,8 +167,11 @@ export const KeystoreModal = ({ handleClose, show }: UseModalReturnType) => {
} = formikProps;

const disabled = Boolean(initialFile);
const hasErrors =
Object.values(errors).map((error) => error).length > 0;
const dropzoneClassNames = {
'border-gray-300': !fileName && !errors[WALLET_FILE],
'border-red-300': fileName && errors[WALLET_FILE],
'border-green-300': fileName && !errors[WALLET_FILE_NAME]
};

return (
<div className='flex flex-col items-center'>
Expand All @@ -181,23 +185,17 @@ export const KeystoreModal = ({ handleClose, show }: UseModalReturnType) => {
{disabled ? (
<div
className={classNames(
'w-full p-2 border rounded-md bg-gray-800 text-gray-500',
{
'border-gray-300': !hasErrors,
'border-red-300': hasErrors
}
'w-full p-2 border rounded-md bg-gray-400 text-white flex flex-row items-center justify-center gap-1'
)}
>
<FontAwesomeIcon className='text-white' icon={faLock} />
{initialValues.fileName}
</div>
) : (
<div
className={classNames(
'w-full my-6 flex flex-col border-dashed border-2 rounded-md p-6 flex items-center justify-center mb-4 h-[200px]',
{
'border-gray-300': !hasErrors,
'border-red-300': hasErrors
}
dropzoneClassNames
)}
>
{fileName && (
Expand Down
Loading