diff --git a/src/components/ecosystem-pages/categories-mobile.tsx b/src/components/ecosystem-pages/categories-mobile.tsx index 1f900da3..a91e1dba 100644 --- a/src/components/ecosystem-pages/categories-mobile.tsx +++ b/src/components/ecosystem-pages/categories-mobile.tsx @@ -15,7 +15,10 @@ const Categories = ({ page: string; className?: string; }) => { - console.log(page); + const sortedTags = [ + ...tags.filter((tag: string) => tag.toLowerCase().includes("ai")), + ...tags.filter((tag: string) => !tag.toLowerCase().includes("ai")), + ]; return ( )} - {tags?.map((tag: string) => ( + {sortedTags?.map((tag: string) => ( {({ active }) => ( - {tag === "ai & ml" - ? "AI & ML" - : tag.charAt(0).toUpperCase() + tag.slice(1)} + {tag} )} diff --git a/src/components/ecosystem-pages/categories.astro b/src/components/ecosystem-pages/categories.astro index 35d9ea67..bbf77359 100644 --- a/src/components/ecosystem-pages/categories.astro +++ b/src/components/ecosystem-pages/categories.astro @@ -1,97 +1,86 @@ --- import { ArrowUpCircle } from "lucide-react"; import ButtonLink from "../ui/button-link.astro"; -const astroUrl = Astro.url; -type Props = { + +interface Props { tags: string[]; -}; -const pathName = astroUrl.pathname.split("/"); -const { tags } = Astro.props; +} -const normalizedTags = [...new Set(tags.map((tag) => tag.toLowerCase()))]; +const { tags } = Astro.props; +const astroUrl = Astro.url; +const pathName = astroUrl.pathname.split("/"); +const isDeployedOnAkash = pathName.includes("deployed-on-akash"); +const currentCategory = decodeURIComponent(astroUrl?.pathname?.split("/")?.[3]); -const aiMlTag = normalizedTags?.find((tag) => tag === "ai & ml") - ? ["ai & ml"] - : []; const sortedTags = [ - ...aiMlTag, - ...normalizedTags - .filter((tag) => tag !== "ai & ml") - .sort((a, b) => a.localeCompare(b)), + ...tags.filter((tag) => tag.toLowerCase().includes("ai")), + ...tags.filter((tag) => !tag.toLowerCase().includes("ai")), ]; -const displayTag = (tag: string) => { - const specialCases: Record = { - dao: "DAO", - "pos validator": "PoS Validator", - "ai & ml": "AI & ML", - }; +const getCategoryLink = (category?: string) => { + return `/ecosystem/${pathName[2]}${category ? `/${category}` : "/"}`; +}; - return ( - specialCases[tag.toLowerCase()] || - tag - .split(" ") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" ") - ); +const isActiveLink = (path: string) => { + return path === astroUrl.pathname ? "text-primary" : "text-para"; }; --- -