From b26bae40a6cfa89e6cb6902fd22e10b2ce53ffd3 Mon Sep 17 00:00:00 2001 From: Shamim Bin Nur Date: Thu, 26 Oct 2023 12:43:49 +0600 Subject: [PATCH 1/5] Implemented the logic to force the user to tag at least one repository if the system detects an empty array of repositories while creating a highlight. --- .../molecules/HighlightInput/highlight-input-form.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/molecules/HighlightInput/highlight-input-form.tsx b/components/molecules/HighlightInput/highlight-input-form.tsx index 11410ee5ed..85edb53efb 100644 --- a/components/molecules/HighlightInput/highlight-input-form.tsx +++ b/components/molecules/HighlightInput/highlight-input-form.tsx @@ -432,6 +432,12 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E const taggedRepoFullNames = taggedRepoList.map((repo) => `${repo.repoOwner}/${repo.repoName}`); + // Check if the user has tagged at least one repo and ask them to tag at least one if they haven't + if (taggedRepoList.length < 1) { + setError("Please tag at least one repo!"); + return; + } + if (res.isError) { setLoading(false); @@ -439,6 +445,8 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E return; } else { setLoading(true); + console.log("taggedReposList", taggedRepoList); + console.log("taggedRepoFullNames", taggedRepoFullNames); const res = await createHighlights({ highlight, url: highlightLink, From cd9f15038c047a562fc4245c0bd0856c009807a1 Mon Sep 17 00:00:00 2001 From: Shamim Bin Nur Date: Thu, 26 Oct 2023 13:10:19 +0600 Subject: [PATCH 2/5] Removed console log --- components/molecules/HighlightInput/highlight-input-form.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/molecules/HighlightInput/highlight-input-form.tsx b/components/molecules/HighlightInput/highlight-input-form.tsx index 85edb53efb..f6a75d6ab6 100644 --- a/components/molecules/HighlightInput/highlight-input-form.tsx +++ b/components/molecules/HighlightInput/highlight-input-form.tsx @@ -445,8 +445,6 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E return; } else { setLoading(true); - console.log("taggedReposList", taggedRepoList); - console.log("taggedRepoFullNames", taggedRepoFullNames); const res = await createHighlights({ highlight, url: highlightLink, From bc10ca879db5bf8bbef295027fb7899f59a0492f Mon Sep 17 00:00:00 2001 From: Shamim Bin Nur Date: Thu, 26 Oct 2023 22:32:07 +0600 Subject: [PATCH 3/5] Changed wording --- components/molecules/HighlightInput/highlight-input-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/molecules/HighlightInput/highlight-input-form.tsx b/components/molecules/HighlightInput/highlight-input-form.tsx index f6a75d6ab6..5d45b0e136 100644 --- a/components/molecules/HighlightInput/highlight-input-form.tsx +++ b/components/molecules/HighlightInput/highlight-input-form.tsx @@ -434,7 +434,7 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E // Check if the user has tagged at least one repo and ask them to tag at least one if they haven't if (taggedRepoList.length < 1) { - setError("Please tag at least one repo!"); + setError("Please add at least one repository associated with your blog post"); return; } From ed98a83876319633266a9e82565dad6be326986e Mon Sep 17 00:00:00 2001 From: Shamim Bin Nur Date: Thu, 26 Oct 2023 22:35:33 +0600 Subject: [PATCH 4/5] Wording changes --- components/molecules/HighlightInput/highlight-input-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/molecules/HighlightInput/highlight-input-form.tsx b/components/molecules/HighlightInput/highlight-input-form.tsx index 5d45b0e136..30a685f651 100644 --- a/components/molecules/HighlightInput/highlight-input-form.tsx +++ b/components/molecules/HighlightInput/highlight-input-form.tsx @@ -434,7 +434,7 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E // Check if the user has tagged at least one repo and ask them to tag at least one if they haven't if (taggedRepoList.length < 1) { - setError("Please add at least one repository associated with your blog post"); + setError("Please add at least one repository associated with the blog post"); return; } From ddcdc12ab2db6961c8f57ea37297fc1cd72b1333 Mon Sep 17 00:00:00 2001 From: Shamim Bin Nur Date: Thu, 26 Oct 2023 22:38:01 +0600 Subject: [PATCH 5/5] Wording changes --- components/molecules/HighlightInput/highlight-input-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/molecules/HighlightInput/highlight-input-form.tsx b/components/molecules/HighlightInput/highlight-input-form.tsx index 30a685f651..5d45b0e136 100644 --- a/components/molecules/HighlightInput/highlight-input-form.tsx +++ b/components/molecules/HighlightInput/highlight-input-form.tsx @@ -434,7 +434,7 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E // Check if the user has tagged at least one repo and ask them to tag at least one if they haven't if (taggedRepoList.length < 1) { - setError("Please add at least one repository associated with the blog post"); + setError("Please add at least one repository associated with your blog post"); return; }