Skip to content

Commit

Permalink
feat: [SC-25798] 💄 Enhanced UX of Explore Collections namegraph.dev m…
Browse files Browse the repository at this point in the history
…ini-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
  • Loading branch information
FrancoAguzzi authored Dec 23, 2024
1 parent 501b1ae commit 927f339
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 55 deletions.
121 changes: 69 additions & 52 deletions apps/namegraph.dev/app/explore-collections/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
import { getCollectionsForQuery } from "@/lib/utils";
import { DebounceInput } from "react-debounce-input";
import { useEffect, useState } from "react";
import lodash, { debounce } from "lodash";
import lodash from "lodash";
import { MagnifyingGlassCircleIcon } from "@heroicons/react/24/solid";

const SUGGESTION_CATEGORY_CLASSNAME = "suggestionCategory";

Expand Down Expand Up @@ -216,36 +217,47 @@ export default function ExploreCollectionsPage() {
className="w-full bg-gray-100 border border-gray-300 rounded-md p-3 px-4"
/>
{nameIdeasLoading ? (
<div role="status">
<>
{/* Display a Loading icon if the dApp query is being typed by the visitor */}
<div role="status">
<svg
aria-hidden="true"
className="w-5 h-5 ml-1 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
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"
fill="currentColor"
/>
<path
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"
fill="currentFill"
/>
</svg>
<span className="sr-only">Loading...</span>
</div>
</>
) : debouncedValue ? (
<>
{/* Display a Check (similar to ✅) if the dApp submitted the debouncedValue query to NameGraph SDK */}
<svg
className="w-6 h-6 text-green-500 dark:text-green-400 flex-shrink-0"
aria-hidden="true"
className="w-6 h-6 me-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
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"
fill="currentColor"
/>
<path
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"
fill="currentFill"
/>
<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" />
</svg>
<span className="sr-only">Loading...</span>
</div>
) : debouncedValue ? (
<svg
className="w-6 h-6 me-2 text-green-500 dark:text-green-400 flex-shrink-0"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<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" />
</svg>
) : null}
</>
) : (
<>
{/* Display a Magnifying glass icon if the dApp is awaiting for a query */}
<MagnifyingGlassCircleIcon className="w-8 h-8 text-gray-300" />
</>
)}
</div>
<p className="leading-6 text-sm font-semibold text-gray-600 max-w-[760px] mx-auto text-center mt-6">
Use NameGraph SDK to generate multiple name ideas suggestions for
Expand All @@ -256,7 +268,7 @@ export default function ExploreCollectionsPage() {
{"'Batman Supporting Characters'"} and much more!
</p>
</div>
<div className="mx-auto py-12 text-center">
<div className="mx-auto py-4 pb-12 text-center">
<div className="w-full">
<div className="relative space-y-6">
{/*
Expand All @@ -283,45 +295,50 @@ export default function ExploreCollectionsPage() {
<div
className={`
h-8 mb-[72px]
${!nameIdeasLoading ? "sticky top-16 left-0 z-20" : ""}
${!nameIdeasLoading ? "sticky top-10 left-0 z-20" : ""}
`}
>
<div className="bg-gradient-white-to-transparent-top-bottom transform rotate-180 w-full h-12"></div>
<QuickJumpsByCategory
search={debouncedValue}
nameIdeas={nameIdeas}
activeCategoryID={activeCategoryID}
/>
<div className="bg-gradient-white-to-transparent-top-bottom w-full h-12"></div>
</div>
</>
) : null}
<div className="pb-5">
<div
id="scrollable-elm"
className="relative z-10 transition mb-6 max-h-[600px] overflow-auto bg-gray-100 shadow"
>
{nameIdeas
? nameIdeas.categories.map(
(
category: NameGraphFetchTopCollectionMembersResponse,
idx: number,
) => {
return (
<div
id={getCategoryID(category)}
key={`${idx}-${window.innerWidth}`}
className={`
{debouncedValue && (
<div className="pb-5">
<div
id="scrollable-elm"
className="relative z-10 transition max-h-[600px] py-20 overflow-auto bg-white"
>
{nameIdeas
? nameIdeas.categories.map(
(
category: NameGraphFetchTopCollectionMembersResponse,
idx: number,
) => {
return (
<div
id={getCategoryID(category)}
key={`${idx}-${window.innerWidth}`}
className={`
${SUGGESTION_CATEGORY_CLASSNAME}
-mb-4 pt-12
${idx === 0 ? "-mt-12" : ""}`}
>
<SuggestionCategory category={category} />
</div>
);
},
)
: null}
>
<SuggestionCategory category={category} />
</div>
);
},
)
: null}
</div>
<div className="bg-gradient-white-to-transparent-top-bottom w-full h-12"></div>
</div>
</div>
)}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export const QuickJumpsByCategory = ({
if (nameIdeas?.categories === null) return null;

return (
<div className="w-full px-3 relative bg-white border-b border-gray-300 pt-3 border-t">
<div className="w-full px-3 relative bg-white pt-3">
<h2 className="text-lg font-regular mb-4 text-center">
📚 Collections and name ideas found for{" "}
<b>{search.includes(".") ? search.split(".")[0] : search}</b> ⬇️
</h2>
{!quickJumpCategories || loadingQuickJumpPills ? (
<div className="mx-3 px-2 mb-3 md:px-7 lg:px-12">
<div className="mx-3 px-2 md:px-7 lg:px-12">
<QuickJumpPillsSkeleton />
</div>
) : (
Expand Down Expand Up @@ -174,7 +174,7 @@ export const scrollToNameIdeasCategory = (
if (scrollableContainer && categoryElm && categoryElmTopPosition) {
setTimeout(() => {
scrollableContainer.scrollTo({
top: categoryElmTopPosition - 375,
top: categoryElmTopPosition - 425,
behavior: "smooth",
});
}, 100);
Expand Down
2 changes: 2 additions & 0 deletions apps/namegraph.dev/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const config: Config = {
backgroundImage: {
"gradient-white-to-transparent":
"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%)",
"gradient-white-to-transparent-top-bottom":
"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%)",
},
borderRadius: {
lg: "var(--radius)",
Expand Down

0 comments on commit 927f339

Please sign in to comment.