From 15c9694902fb930efabf91ca2c01680af0ba503c Mon Sep 17 00:00:00 2001 From: michalrozekariane <156693677+michalrozekariane@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:16:40 +0200 Subject: [PATCH] feature/copy-fixes (#12) * Update page title and description in index.html and en.json Signed-off-by: Bartosz Solka * feat: account ids field validation improvements Signed-off-by: michalrozekariane --------- Signed-off-by: Bartosz Solka Signed-off-by: michalrozekariane Co-authored-by: Bartosz Solka --- index.html | 2 +- package.json | 2 +- src/App.tsx | 2 +- src/dictionary/en.json | 6 +++--- src/utils/formSchema.ts | 5 ++++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 6cd2f4c..c31721f 100755 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Hedera airdrop helper + Hedera Airdrop List Verifier
diff --git a/package.json b/package.json index 52b9228..6581c6f 100755 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "airdrop-list-verifier", + "name": "hedera-airdrop-list-verifier", "homepage": "https://Ashe-Oro-Accelerator.github.io/airdrop-list-verifier", "private": true, "version": "0.0.0", diff --git a/src/App.tsx b/src/App.tsx index 1100be2..ae1d870 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -32,7 +32,7 @@ import { defaultNetwork } from '@/utils/const'; const App = () => { const [tokenId, setTokenId] = useState(''); const [accountIds, setAccountIds] = useState([]); - const [shouldFetch, setShouldFetch] = useState(false); + const [shouldFetch, setShouldFetch] = useState(false); const [fetchedAccountsBalance, setFetchedAccountsBalance] = useState(0); const { diff --git a/src/dictionary/en.json b/src/dictionary/en.json index 76269d3..a31467c 100755 --- a/src/dictionary/en.json +++ b/src/dictionary/en.json @@ -2,8 +2,8 @@ "copiedToClipboard": "Copied to clipboard", "copyToClipboard": "Copy to clipboard", "httpError": "HTTP error! Status:", - "title": "Hedera airdrop helper", - "description": "Just pass a TokenId and a list of account ids that you want to airdrop to. The app will return you a list of addresses that are either associated with the token or have available auto association slots.", + "title": "Hedera Airdrop List Verifier", + "description": "Provide a list of Account IDs and a Token ID and this app will return only the accounts which can successfully receive the token as an airdrop.", "tokenId": "TokenId", "exampleTokenId": "0.0.1234", "accountIds": "Account Ids list", @@ -15,5 +15,5 @@ "successfullyFetchedData": "Successfully fetched data", "tokenIdFormatError": "TokenId must be in the format 0.0.x", "minAmountFormatError": "MinAmount must be a number greater than or equal to 0", - "accountIdsFormatError": "AccountIds must be a string representation of an csv. Example: 0.0.123, 0.0.124, 0.0.125, 0.0.126" + "accountIdsFormatError": "Account ids should be comma separated." } diff --git a/src/utils/formSchema.ts b/src/utils/formSchema.ts index c8b2876..8003db8 100755 --- a/src/utils/formSchema.ts +++ b/src/utils/formSchema.ts @@ -26,7 +26,10 @@ export const formSchema = z.object({ }), accountIds: z.string().refine( (value) => { - const splitValues = value.split(/, |\s|\n/); + const splitValues = value + .split(/\s*,\s*|\n/) + .map((item) => item.trim()) + .filter((item) => item); return splitValues.every((item) => /^0\.0\.\d*$/.test(item)); }, {