From d8f7d98e95569e9f7cf08dc6885d80bda7edc891 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Tue, 22 Apr 2025 17:08:14 +0200 Subject: [PATCH] add lazy icon request button --- web/src/app/icons/components/icon-search.tsx | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/web/src/app/icons/components/icon-search.tsx b/web/src/app/icons/components/icon-search.tsx index 82ef6790..c096fcbe 100644 --- a/web/src/app/icons/components/icon-search.tsx +++ b/web/src/app/icons/components/icon-search.tsx @@ -26,6 +26,7 @@ import Link from "next/link" import { usePathname, useRouter, useSearchParams } from "next/navigation" import posthog from "posthog-js" import { useCallback, useEffect, useMemo, useRef, useState } from "react" +import { toast } from "sonner" type SortOption = "relevance" | "alphabetical-asc" | "alphabetical-desc" | "newest" @@ -42,6 +43,7 @@ export function IconSearch({ icons }: IconSearchProps) { const [sortOption, setSortOption] = useState(initialSort) const timeoutRef = useRef(null) const { resolvedTheme } = useTheme() + const [isLazyRequestSubmitted, setIsLazyRequestSubmitted] = useState(false) useEffect(() => { const timer = setTimeout(() => { @@ -395,19 +397,28 @@ export function IconSearch({ icons }: IconSearchProps) { {filteredIcons.length === 0 ? ( -
+

We don't have this one...yet!

-

- {searchQuery && selectedCategories.length > 0 - ? `No icons found matching "${searchQuery}" with the selected filters.` - : searchQuery - ? `No icons found matching "${searchQuery}".` - : selectedCategories.length > 0 - ? "No icons found with the selected filters." - : "No icons found matching your criteria."} -

+
) : (