Skip to content

Commit 927f339

Browse files
authored
feat: [SC-25798] 💄 Enhanced UX of Explore Collections namegraph.dev mini-app (#501)
* feat: [SC-25948] 🔧 Update code organization in NameGraph SDK * feat: [SC-25948] 📝 Add README to NameGraph SDK * feat: [SC-25948] ♻️ Syntax updates in NameGraph SDK * feat: [SC-25948] ♻️ Reduce changesets files from 2 to 1 * feat: [SC-25975] 📝 Update namegraph.dev README * feat: [SC-25975] 📦 Update NameGuard SDK package and app that uses it * feat: [SC-25978] 👽 Deploy initial version of namekit migrated features for NameGraph * feat: [SC--25978] ✨ Introduce explore-collections page to namegraph.dev * feat: [SC-25978] ✨ Integrate NameGraph SDK API call into Explore Collections page and make collections exploring page work * feat: [SC-25978] 🔨 Align namegraph.dev with recently merged commits * hotfix: [SC-25978] 🚑 Update namegraph.dev tsconfig.json * hotfix: [SC-25978] 🚑 Remove unneed dependency import * hotfix: [SC-25978] 🚑 Update lockfile * feat: [SC-25978] 💄 Improved UI experience in Explore Collections Mini-App * feat: [SC-25978] 🎨 Improve code format and reduce interfaces needs * feat: [SC-25978] 🔧 Fix namegraph.dev build error * feat: [SC-25798] 💄 Enhanced UX of Explore Collections namegraph.dev mini-app
1 parent 501b1ae commit 927f339

File tree

3 files changed

+74
-55
lines changed

3 files changed

+74
-55
lines changed

apps/namegraph.dev/app/explore-collections/page.tsx

Lines changed: 69 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
import { getCollectionsForQuery } from "@/lib/utils";
1313
import { DebounceInput } from "react-debounce-input";
1414
import { useEffect, useState } from "react";
15-
import lodash, { debounce } from "lodash";
15+
import lodash from "lodash";
16+
import { MagnifyingGlassCircleIcon } from "@heroicons/react/24/solid";
1617

1718
const 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>

apps/namegraph.dev/components/mini-apps/explore-collections/quick-jumps-by-category.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export const QuickJumpsByCategory = ({
7979
if (nameIdeas?.categories === null) return null;
8080

8181
return (
82-
<div className="w-full px-3 relative bg-white border-b border-gray-300 pt-3 border-t">
82+
<div className="w-full px-3 relative bg-white pt-3">
8383
<h2 className="text-lg font-regular mb-4 text-center">
8484
📚 Collections and name ideas found for{" "}
8585
<b>{search.includes(".") ? search.split(".")[0] : search}</b> ⬇️
8686
</h2>
8787
{!quickJumpCategories || loadingQuickJumpPills ? (
88-
<div className="mx-3 px-2 mb-3 md:px-7 lg:px-12">
88+
<div className="mx-3 px-2 md:px-7 lg:px-12">
8989
<QuickJumpPillsSkeleton />
9090
</div>
9191
) : (
@@ -174,7 +174,7 @@ export const scrollToNameIdeasCategory = (
174174
if (scrollableContainer && categoryElm && categoryElmTopPosition) {
175175
setTimeout(() => {
176176
scrollableContainer.scrollTo({
177-
top: categoryElmTopPosition - 375,
177+
top: categoryElmTopPosition - 425,
178178
behavior: "smooth",
179179
});
180180
}, 100);

apps/namegraph.dev/tailwind.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const config: Config = {
3434
backgroundImage: {
3535
"gradient-white-to-transparent":
3636
"linear-gradient(270deg, rgba(255,255,255,1) 50%, rgba(255,255,255,0.80) 60%, rgba(255,255,255,0.70) 65%, rgba(255,255,255,0.60) 70%, rgba(255,255,255,0.50) 75%, rgba(255,255,255,0.40) 80%, rgba(255,255,255,0.30) 85%, rgba(255,255,255,0.15) 90%, rgba(255,255,255,0) 100%)",
37+
"gradient-white-to-transparent-top-bottom":
38+
"linear-gradient(180deg, rgba(255,255,255,1) 50%, rgba(255,255,255,0.80) 60%, rgba(255,255,255,0.70) 65%, rgba(255,255,255,0.60) 70%, rgba(255,255,255,0.50) 75%, rgba(255,255,255,0.40) 80%, rgba(255,255,255,0.30) 85%, rgba(255,255,255,0.15) 90%, rgba(255,255,255,0) 100%)",
3739
},
3840
borderRadius: {
3941
lg: "var(--radius)",

0 commit comments

Comments
 (0)