From 3b1a25c9a4a0665b752bdc13719ec00b516a95c0 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 20 Jun 2024 19:42:34 -0400 Subject: [PATCH 1/4] fix: contract filter was uneditable --- .../Modals/ModalsContainer/PublishFormContainer.tsx | 9 +++++++-- .../src/components/Modals/ModalsView/PublishFormView.jsx | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx index b49727b44..13234ef52 100644 --- a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx +++ b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx @@ -57,8 +57,12 @@ const ViewContainer: React.FC = ({ updateConfig }) => { } }; - function handleSetContractFilter (contractFilter: string): void { - setContractFilter(contractFilter); + const onChangeContractFilter = (e: ChangeEvent): void => { + setContractFilter(e.target.value); + handleSetContractFilter(e.target.value) + }; + + function handleSetContractFilter(contractFilter: string): void { const isContractFilterValid = validateContractIds(contractFilter); setIsContractFilterValid(isContractFilterValid); } @@ -86,6 +90,7 @@ const ViewContainer: React.FC = ({ updateConfig }) => { onChangeStartBlock={onChangeStartBlock} setIndexerNameField={setIndexerNameField} setBlockHeight={setBlockHeight} + onChangeContractFilter={onChangeContractFilter} handleSetContractFilter={handleSetContractFilter} updateConfig={updateConfig} indexerDetails={indexerDetails} diff --git a/frontend/src/components/Modals/ModalsView/PublishFormView.jsx b/frontend/src/components/Modals/ModalsView/PublishFormView.jsx index dc7bf0752..5bf1a95eb 100644 --- a/frontend/src/components/Modals/ModalsView/PublishFormView.jsx +++ b/frontend/src/components/Modals/ModalsView/PublishFormView.jsx @@ -13,6 +13,7 @@ const PublishFormView = ({ onChangeStartBlock, setIndexerNameField, setBlockHeight, + onChangeContractFilter, handleSetContractFilter, updateConfig, indexerDetails, @@ -94,11 +95,11 @@ const PublishFormView = ({ id="contractFilter" type="text" placeholder="social.near" - value={startBlock === "startBlockContinue" ? contractFilter : indexerDetails.rule.affected_account_id} - onChange={(e) => handleSetContractFilter(e.target.value)} - required + 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'}`} + required /> {!isContractFilterValid && (
From 6e3b12a84b26432559c5769d334d2c7100f1c0a6 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 20 Jun 2024 19:45:26 -0400 Subject: [PATCH 2/4] chore: lint --- frontend/replacement.dev.json | 2 +- .../Modals/ModalsContainer/PublishFormContainer.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/replacement.dev.json b/frontend/replacement.dev.json index 1a233cb9d..1b56e05bc 100644 --- a/frontend/replacement.dev.json +++ b/frontend/replacement.dev.json @@ -1,6 +1,6 @@ { "REPL_ACCOUNT_ID": "dev-queryapi.dataplatform.near", "REPL_GRAPHQL_ENDPOINT": "https://near-queryapi.dev.api.pagoda.co", - "REPL_EXTERNAL_APP_URL": "https://queryapi-frontend-vcqilefdcq-ew.a.run.app", + "REPL_EXTERNAL_APP_URL": "http://localhost:3000", "REPL_REGISTRY_CONTRACT_ID": "dev-queryapi.dataplatform.near" } diff --git a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx index 13234ef52..2b4c072c6 100644 --- a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx +++ b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx @@ -59,13 +59,13 @@ const ViewContainer: React.FC = ({ updateConfig }) => { const onChangeContractFilter = (e: ChangeEvent): void => { setContractFilter(e.target.value); - handleSetContractFilter(e.target.value) + handleSetContractFilter(e.target.value); }; - function handleSetContractFilter(contractFilter: string): void { + const handleSetContractFilter = (contractFilter: string): void => { const isContractFilterValid = validateContractIds(contractFilter); setIsContractFilterValid(isContractFilterValid); - } + }; useEffect(() => { if (startBlock === START_BLOCK.HEIGHT && parseInt(blockHeight) <= GENESIS_BLOCK_HEIGHT) { From 3e8e191ce304836e74e4027ecb9fc712945e174e Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 20 Jun 2024 19:45:34 -0400 Subject: [PATCH 3/4] chore: lint --- frontend/replacement.dev.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/replacement.dev.json b/frontend/replacement.dev.json index 1b56e05bc..1a233cb9d 100644 --- a/frontend/replacement.dev.json +++ b/frontend/replacement.dev.json @@ -1,6 +1,6 @@ { "REPL_ACCOUNT_ID": "dev-queryapi.dataplatform.near", "REPL_GRAPHQL_ENDPOINT": "https://near-queryapi.dev.api.pagoda.co", - "REPL_EXTERNAL_APP_URL": "http://localhost:3000", + "REPL_EXTERNAL_APP_URL": "https://queryapi-frontend-vcqilefdcq-ew.a.run.app", "REPL_REGISTRY_CONTRACT_ID": "dev-queryapi.dataplatform.near" } From ca845b9c69e275368c6ee7ec22288bb8f69d2255 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 20 Jun 2024 19:58:09 -0400 Subject: [PATCH 4/4] fix: swapped ternary assigments --- .../Modals/ModalsContainer/PublishFormContainer.tsx | 11 +++-------- .../components/Modals/ModalsView/PublishFormView.jsx | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx index 2b4c072c6..b49727b44 100644 --- a/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx +++ b/frontend/src/components/Modals/ModalsContainer/PublishFormContainer.tsx @@ -57,15 +57,11 @@ const ViewContainer: React.FC = ({ updateConfig }) => { } }; - const onChangeContractFilter = (e: ChangeEvent): 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) { @@ -90,7 +86,6 @@ const ViewContainer: React.FC = ({ updateConfig }) => { onChangeStartBlock={onChangeStartBlock} setIndexerNameField={setIndexerNameField} setBlockHeight={setBlockHeight} - onChangeContractFilter={onChangeContractFilter} handleSetContractFilter={handleSetContractFilter} updateConfig={updateConfig} indexerDetails={indexerDetails} diff --git a/frontend/src/components/Modals/ModalsView/PublishFormView.jsx b/frontend/src/components/Modals/ModalsView/PublishFormView.jsx index 5bf1a95eb..ba6817fe2 100644 --- a/frontend/src/components/Modals/ModalsView/PublishFormView.jsx +++ b/frontend/src/components/Modals/ModalsView/PublishFormView.jsx @@ -13,7 +13,6 @@ const PublishFormView = ({ onChangeStartBlock, setIndexerNameField, setBlockHeight, - onChangeContractFilter, handleSetContractFilter, updateConfig, indexerDetails, @@ -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 && (