From 24463a53c50f00313e3502438ae5f47254635253 Mon Sep 17 00:00:00 2001 From: Stixx Date: Mon, 2 Dec 2024 15:34:17 +0100 Subject: [PATCH 1/3] fix: inform user then search term provided no results --- src/pages/create/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index a65a559..588957b 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -199,8 +199,11 @@ export const CreatePage = () => { return uniqueEvents }, []) - console.log('fineFilteredEvents', fineFilteredEvents) + console.info('fineFilteredEvents', fineFilteredEvents) setFoundUsers(fineFilteredEvents) + + if (!fineFilteredEvents.length) + toast.info('No user found with the provided search term') }) .catch((error) => { console.error(error) From bbe34b60116af3081a45ec55dde6e6e7620818a3 Mon Sep 17 00:00:00 2001 From: Stixx Date: Tue, 3 Dec 2024 10:48:40 +0100 Subject: [PATCH 2/3] fix: display `no results` when no submissions are found --- src/pages/home/index.tsx | 72 +++++++++++++++++++------------- src/pages/home/style.module.scss | 7 ++++ 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 1a29021..f7166e2 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -135,6 +135,46 @@ export const HomePage = () => { const [filter, setFilter] = useState('Show all') const [sort, setSort] = useState('desc') + const renderSubmissions = () => { + const submissions = Object.keys(parsedSigits) + .filter((s) => { + const { title, signedStatus } = parsedSigits[s] + const isMatch = title?.toLowerCase().includes(q.toLowerCase()) + switch (filter) { + case 'Completed': + return signedStatus === SigitStatus.Complete && isMatch + case 'In-progress': + return signedStatus === SigitStatus.Partial && isMatch + case 'Show all': + return isMatch + default: + console.error('Filter case not handled.') + } + }) + .sort((a, b) => { + const x = parsedSigits[a].createdAt ?? 0 + const y = parsedSigits[b].createdAt ?? 0 + return sort === 'desc' ? y - x : x - y + }) + + if (submissions.length) { + return submissions.map((key) => ( + + )) + } else { + return ( +
+

No results

+
+ ) + } + } + return (
@@ -233,36 +273,8 @@ export const HomePage = () => { )} -
- {Object.keys(parsedSigits) - .filter((s) => { - const { title, signedStatus } = parsedSigits[s] - const isMatch = title?.toLowerCase().includes(q.toLowerCase()) - switch (filter) { - case 'Completed': - return signedStatus === SigitStatus.Complete && isMatch - case 'In-progress': - return signedStatus === SigitStatus.Partial && isMatch - case 'Show all': - return isMatch - default: - console.error('Filter case not handled.') - } - }) - .sort((a, b) => { - const x = parsedSigits[a].createdAt ?? 0 - const y = parsedSigits[b].createdAt ?? 0 - return sort === 'desc' ? y - x : x - y - }) - .map((key) => ( - - ))} -
+ +
{renderSubmissions()}
diff --git a/src/pages/home/style.module.scss b/src/pages/home/style.module.scss index 63917a0..5efd4fd 100644 --- a/src/pages/home/style.module.scss +++ b/src/pages/home/style.module.scss @@ -99,3 +99,10 @@ gap: 25px; grid-template-columns: repeat(auto-fit, minmax(365px, 1fr)); } + +.noResults { + display: flex; + justify-content: center; + font-weight: normal; + color: #a1a1a1; +} From 98fbe80648e6b8e80af1e6c15de8bb963d27c070 Mon Sep 17 00:00:00 2001 From: Stixx Date: Tue, 3 Dec 2024 11:25:31 +0100 Subject: [PATCH 3/3] fix: create page, improving message "preparing document for signing" --- src/pages/create/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index a65a559..d9aeb03 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -761,7 +761,7 @@ export const CreatePage = () => { title } - setLoadingSpinnerDesc('Signing nostr event for create signature') + setLoadingSpinnerDesc('Preparing document(s) for signing') const createSignature = await signEventForMetaFile( JSON.stringify(content),