Skip to content

Commit

Permalink
fix: swapped ternary assigments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin101Zhang committed Jun 20, 2024
1 parent 3e8e191 commit ca845b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ const ViewContainer: React.FC<Props> = ({ updateConfig }) => {
}
};

const onChangeContractFilter = (e: ChangeEvent<HTMLInputElement>): void => {
setContractFilter(e.target.value);
handleSetContractFilter(e.target.value);
};

const handleSetContractFilter = (contractFilter: string): void => {
function handleSetContractFilter (contractFilter: string): void {
setContractFilter(contractFilter);
const isContractFilterValid = validateContractIds(contractFilter);
setIsContractFilterValid(isContractFilterValid);
};
}

useEffect(() => {
if (startBlock === START_BLOCK.HEIGHT && parseInt(blockHeight) <= GENESIS_BLOCK_HEIGHT) {
Expand All @@ -90,7 +86,6 @@ const ViewContainer: React.FC<Props> = ({ updateConfig }) => {
onChangeStartBlock={onChangeStartBlock}
setIndexerNameField={setIndexerNameField}
setBlockHeight={setBlockHeight}
onChangeContractFilter={onChangeContractFilter}
handleSetContractFilter={handleSetContractFilter}
updateConfig={updateConfig}
indexerDetails={indexerDetails}
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/components/Modals/ModalsView/PublishFormView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const PublishFormView = ({
onChangeStartBlock,
setIndexerNameField,
setBlockHeight,
onChangeContractFilter,
handleSetContractFilter,
updateConfig,
indexerDetails,
Expand Down Expand Up @@ -95,11 +94,10 @@ const PublishFormView = ({
id="contractFilter"
type="text"
placeholder="social.near"
value={contractFilter}
onChange={onChangeContractFilter}
disabled={startBlock === "startBlockContinue"}
className={`px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-gray-500 focus:border-gray-500 ${isContractFilterValid ? 'border-gray-300' : 'border-red-500'}`}
value={startBlock === "startBlockContinue" ? indexerDetails.rule.affected_account_id : contractFilter}
onChange={(e) => handleSetContractFilter(e.target.value)}
required
className={`px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-gray-500 focus:border-gray-500 ${isContractFilterValid ? 'border-gray-300' : 'border-red-500'}`}
/>
{!isContractFilterValid && (
<div className="mt-2 text-sm text-red-600">
Expand Down

0 comments on commit ca845b9

Please sign in to comment.