@@ -12,7 +12,8 @@ import {
1212import { getCollectionsForQuery } from "@/lib/utils" ;
1313import { DebounceInput } from "react-debounce-input" ;
1414import { useEffect , useState } from "react" ;
15- import lodash , { debounce } from "lodash" ;
15+ import lodash from "lodash" ;
16+ import { MagnifyingGlassCircleIcon } from "@heroicons/react/24/solid" ;
1617
1718const SUGGESTION_CATEGORY_CLASSNAME = "suggestionCategory" ;
1819
@@ -216,36 +217,47 @@ export default function ExploreCollectionsPage() {
216217 className = "w-full bg-gray-100 border border-gray-300 rounded-md p-3 px-4"
217218 />
218219 { nameIdeasLoading ? (
219- < div role = "status" >
220+ < >
221+ { /* Display a Loading icon if the dApp query is being typed by the visitor */ }
222+ < div role = "status" >
223+ < svg
224+ aria-hidden = "true"
225+ className = "w-5 h-5 ml-1 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
226+ viewBox = "0 0 100 101"
227+ fill = "none"
228+ xmlns = "http://www.w3.org/2000/svg"
229+ >
230+ < path
231+ d = "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
232+ fill = "currentColor"
233+ />
234+ < path
235+ d = "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
236+ fill = "currentFill"
237+ />
238+ </ svg >
239+ < span className = "sr-only" > Loading...</ span >
240+ </ div >
241+ </ >
242+ ) : debouncedValue ? (
243+ < >
244+ { /* Display a Check (similar to ✅) if the dApp submitted the debouncedValue query to NameGraph SDK */ }
220245 < svg
246+ className = "w-6 h-6 text-green-500 dark:text-green-400 flex-shrink-0"
221247 aria-hidden = "true"
222- className = "w-6 h-6 me-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
223- viewBox = "0 0 100 101"
224- fill = "none"
225248 xmlns = "http://www.w3.org/2000/svg"
249+ fill = "currentColor"
250+ viewBox = "0 0 20 20"
226251 >
227- < path
228- d = "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
229- fill = "currentColor"
230- />
231- < path
232- d = "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
233- fill = "currentFill"
234- />
252+ < path d = "M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z" />
235253 </ svg >
236- < span className = "sr-only" > Loading...</ span >
237- </ div >
238- ) : debouncedValue ? (
239- < svg
240- className = "w-6 h-6 me-2 text-green-500 dark:text-green-400 flex-shrink-0"
241- aria-hidden = "true"
242- xmlns = "http://www.w3.org/2000/svg"
243- fill = "currentColor"
244- viewBox = "0 0 20 20"
245- >
246- < path d = "M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z" />
247- </ svg >
248- ) : null }
254+ </ >
255+ ) : (
256+ < >
257+ { /* Display a Magnifying glass icon if the dApp is awaiting for a query */ }
258+ < MagnifyingGlassCircleIcon className = "w-8 h-8 text-gray-300" />
259+ </ >
260+ ) }
249261 </ div >
250262 < p className = "leading-6 text-sm font-semibold text-gray-600 max-w-[760px] mx-auto text-center mt-6" >
251263 Use NameGraph SDK to generate multiple name ideas suggestions for
@@ -256,7 +268,7 @@ export default function ExploreCollectionsPage() {
256268 { "'Batman Supporting Characters'" } and much more!
257269 </ p >
258270 </ div >
259- < div className = "mx-auto py-12 text-center" >
271+ < div className = "mx-auto py-4 pb- 12 text-center" >
260272 < div className = "w-full" >
261273 < div className = "relative space-y-6" >
262274 { /*
@@ -283,45 +295,50 @@ export default function ExploreCollectionsPage() {
283295 < div
284296 className = { `
285297 h-8 mb-[72px]
286- ${ ! nameIdeasLoading ? "sticky top-16 left-0 z-20" : "" }
298+ ${ ! nameIdeasLoading ? "sticky top-10 left-0 z-20" : "" }
287299 ` }
288300 >
301+ < div className = "bg-gradient-white-to-transparent-top-bottom transform rotate-180 w-full h-12" > </ div >
289302 < QuickJumpsByCategory
290303 search = { debouncedValue }
291304 nameIdeas = { nameIdeas }
292305 activeCategoryID = { activeCategoryID }
293306 />
307+ < div className = "bg-gradient-white-to-transparent-top-bottom w-full h-12" > </ div >
294308 </ div >
295309 </ >
296310 ) : null }
297- < div className = "pb-5" >
298- < div
299- id = "scrollable-elm"
300- className = "relative z-10 transition mb-6 max-h-[600px] overflow-auto bg-gray-100 shadow"
301- >
302- { nameIdeas
303- ? nameIdeas . categories . map (
304- (
305- category : NameGraphFetchTopCollectionMembersResponse ,
306- idx : number ,
307- ) => {
308- return (
309- < div
310- id = { getCategoryID ( category ) }
311- key = { `${ idx } -${ window . innerWidth } ` }
312- className = { `
311+ { debouncedValue && (
312+ < div className = "pb-5" >
313+ < div
314+ id = "scrollable-elm"
315+ className = "relative z-10 transition max-h-[600px] py-20 overflow-auto bg-white"
316+ >
317+ { nameIdeas
318+ ? nameIdeas . categories . map (
319+ (
320+ category : NameGraphFetchTopCollectionMembersResponse ,
321+ idx : number ,
322+ ) => {
323+ return (
324+ < div
325+ id = { getCategoryID ( category ) }
326+ key = { `${ idx } -${ window . innerWidth } ` }
327+ className = { `
313328 ${ SUGGESTION_CATEGORY_CLASSNAME }
314329 -mb-4 pt-12
315330 ${ idx === 0 ? "-mt-12" : "" } ` }
316- >
317- < SuggestionCategory category = { category } />
318- </ div >
319- ) ;
320- } ,
321- )
322- : null }
331+ >
332+ < SuggestionCategory category = { category } />
333+ </ div >
334+ ) ;
335+ } ,
336+ )
337+ : null }
338+ </ div >
339+ < div className = "bg-gradient-white-to-transparent-top-bottom w-full h-12" > </ div >
323340 </ div >
324- </ div >
341+ ) }
325342 </ div >
326343 </ div >
327344 </ div >
0 commit comments