Skip to content

Commit c99b0c9

Browse files
committed
chore: refactors
1 parent 92852da commit c99b0c9

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

web/src/hooks/useTokenAddressValidation.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,7 @@ const useTokenValidation = ({
141141
error,
142142
} = useQuery({
143143
queryKey: [`${tokenType}-validation`, chainId, debouncedAddress],
144-
enabled:
145-
enabled &&
146-
!isUndefined(publicClient) &&
147-
!isUndefined(debouncedAddress) &&
148-
debouncedAddress.trim() !== "" &&
149-
isValidFormat === true,
144+
enabled: enabled && !isUndefined(publicClient) && Boolean(isValidFormat),
150145
staleTime: 300000, // Cache for 5 minutes
151146
retry: 1, // Only retry once to fail faster
152147
retryDelay: 1000, // Short retry delay

web/src/pages/Resolver/Parameters/Court.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ const ValidationIcon = styled.div<{ $isValid?: boolean | null; $isValidating?: b
112112
${({ $isValidating, $isValid }) => {
113113
if ($isValidating) {
114114
return css`
115-
border: 2px solid #ccc;
116-
border-top-color: #007bff;
115+
border: 2px solid ${({ theme }) => theme.stroke};
116+
border-top-color: ${({ theme }) => theme.primaryBlue};
117117
animation: spin 1s linear infinite;
118118
119119
@keyframes spin {
@@ -126,7 +126,7 @@ const ValidationIcon = styled.div<{ $isValid?: boolean | null; $isValidating?: b
126126
127127
if ($isValid === true) {
128128
return css`
129-
background-color: #28a745;
129+
background-color: ${({ theme }) => theme.success};
130130
color: white;
131131
&::after {
132132
content: "✓";
@@ -136,7 +136,7 @@ const ValidationIcon = styled.div<{ $isValid?: boolean | null; $isValidating?: b
136136
137137
if ($isValid === false) {
138138
return css`
139-
background-color: #dc3545;
139+
background-color: ${({ theme }) => theme.error};
140140
color: white;
141141
&::after {
142142
content: "✗";
@@ -151,17 +151,17 @@ const ValidationIcon = styled.div<{ $isValid?: boolean | null; $isValidating?: b
151151
`;
152152

153153
const ValidationMessage = styled.small<{ $isError?: boolean }>`
154-
color: ${({ $isError }) => ($isError ? "#dc3545" : "#28a745")};
154+
color: ${({ $isError, theme }) => ($isError ? theme.error : theme.success)};
155155
font-size: 14px;
156156
font-style: italic;
157157
font-weight: normal;
158158
`;
159159

160160
const StyledFieldWithValidation = styled(StyledField)<{ $isValid?: boolean | null }>`
161161
> input {
162-
border-color: ${({ $isValid }) => {
163-
if ($isValid === true) return "#28a745";
164-
if ($isValid === false) return "#dc3545";
162+
border-color: ${({ $isValid, theme }) => {
163+
if ($isValid === true) return theme.success;
164+
if ($isValid === false) return theme.error;
165165
return "inherit";
166166
}};
167167
}
@@ -327,7 +327,7 @@ const Court: React.FC = () => {
327327
{tokenGateAddress.trim() !== "" && (
328328
<ValidationContainer>
329329
<ValidationIcon $isValidating={isValidating} $isValid={isValidToken} />
330-
<ValidationMessage $isError={!!validationError}>
330+
<ValidationMessage $isError={Boolean(validationError)}>
331331
{isValidating && `Validating ${isERC1155 ? "ERC-1155" : "ERC-20 or ERC-721"} token...`}
332332
{validationError && validationError}
333333
{isValidToken === true && `Valid ${isERC1155 ? "ERC-1155" : "ERC-20 or ERC-721"} token`}

0 commit comments

Comments
 (0)