Skip to content

Commit

Permalink
Merge pull request #343 from HoomanDgtl/main
Browse files Browse the repository at this point in the history
update: ecosystem apps order
  • Loading branch information
HoomanDgtl authored Aug 22, 2024
2 parents 66b7a8f + 3002b86 commit 120936e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 76 deletions.
73 changes: 27 additions & 46 deletions src/pages/ecosystem/deployed-on-akash/[tag]/latest/[page].astro
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
---
import { getCollection, type CollectionEntry } from "astro:content";
import type { PaginateFunction } from "astro";
import Layout from "@/layouts/layout.astro";
import Tag from "@/components/ui/tag.astro";
import Pagination from "@/components/pagination.astro";
import Categories from "@/components/ecosystem-pages/categories.astro";
import ProjectCard from "@/components/ecosystem-pages/project-card.astro";
import EcosystemNavbar from "@/components/ecosystem-pages/ecosystem-navbar.astro";
import { SortActions } from "@/components/ecosystem-pages/sort-actions";
import SortDropDown from "@/components/ecosystem-pages/sort-dropdown";
import TagsSortDropDown from "@/components/ecosystem-pages/tags-sort-dropdown";
import SearchDialog from "@/components/ecosystem-pages/search-dialog";
import TopMargin from "@/components/ui/top-margin.astro";
import TopHeader from "@/components/ecosystem-pages/top-header.astro";
import Categories from "@/components/ecosystem-pages/categories.astro";
import Pagination from "@/components/pagination.astro";
import TopMargin from "@/components/ui/top-margin.astro";
import Layout from "@/layouts/layout.astro";
import { getPriorityIndex } from "@/utils/sequences/deployedOnAkash";
import type { PaginateFunction } from "astro";
import { getCollection, type CollectionEntry } from "astro:content";
type Project = CollectionEntry<"Ecosystem_Page">;
// Define a function to generate static paths
const priorityTitles = [
"Brev.dev",
"Venice.ai",
"Prime Intellect",
"University of Texas at Austin",
"Nous Research",
"Flock.io",
"Akash Chat API",
"Akash Chat",
"Auki"
];
// Function to get the index of a project based on the priority list
function getPriorityIndex(title) {
const index = priorityTitles.indexOf(title);
return index === -1 ? priorityTitles.length : index; // If not found, place it at the end
}
export async function getStaticPaths({
paginate,
}: {
Expand Down Expand Up @@ -120,22 +97,26 @@ const formattedTag = currentTag.charAt(0).toUpperCase() + currentTag.slice(1);
class="mt-4 grid flex-shrink-0 grid-cols-1 gap-y-[24px] sm:grid-cols-2 sm:gap-x-8 md:gap-y-8 lg:grid-cols-3 lg:gap-x-[36px] lg:gap-y-[32px]"
>
{
[...page.data].sort((a, b) =>
getPriorityIndex(a.data.projectTitle) - getPriorityIndex(b.data.projectTitle)
).map((project: Project, i: number) => {
return (
<ProjectCard
title={project.data.projectTitle}
description={project.data.description}
image={project.data.projectImage}
button={project.data.ctaButton}
githubLink={project.data.githubLink}
twitterLink={project.data.twitterLink}
websiteLink={project.data.websiteLink}
discordLink={project.data.discordLink}
/>
);
})
[...page.data]
.sort(
(a, b) =>
getPriorityIndex(a.data.projectTitle) -
getPriorityIndex(b.data.projectTitle),
)
.map((project: Project, i: number) => {
return (
<ProjectCard
title={project.data.projectTitle}
description={project.data.description}
image={project.data.projectImage}
button={project.data.ctaButton}
githubLink={project.data.githubLink}
twitterLink={project.data.twitterLink}
websiteLink={project.data.websiteLink}
discordLink={project.data.discordLink}
/>
);
})
}
</div>

Expand Down
57 changes: 27 additions & 30 deletions src/pages/ecosystem/deployed-on-akash/latest/[...page].astro
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
---
import Layout from "@/layouts/layout.astro";
import { SortActions } from "../../../../components/ecosystem-pages/sort-actions";
import ProjectCard from "@/components/ecosystem-pages/project-card.astro";
import type { PaginateFunction } from "astro";
import { getCollection, type CollectionEntry } from "astro:content";
import Pagination from "@/components/pagination.astro";
import { Image } from "astro:assets";
import ChevronRight from "@/assets/chevron-right.svg";
import Tag from "@/components/ui/tag.astro";
import EcosystemNavbar from "@/components/ecosystem-pages/ecosystem-navbar.astro";
import SearchDialog from "@/components/ecosystem-pages/search-dialog";
import SortDropDown from "@/components/ecosystem-pages/sort-dropdown";
import TagsSortDropDown from "@/components/ecosystem-pages/tags-sort-dropdown";
import Pagination from "@/components/pagination.astro";
import Layout from "@/layouts/layout.astro";
import type { PaginateFunction } from "astro";
import { getCollection, type CollectionEntry } from "astro:content";
import TopMargin from "@/components/ui/top-margin.astro";
import TopHeader from "@/components/ecosystem-pages/top-header.astro";
import Categories from "@/components/ecosystem-pages/categories.astro";
import TopHeader from "@/components/ecosystem-pages/top-header.astro";
import TopMargin from "@/components/ui/top-margin.astro";
import { getPriorityIndex } from "@/utils/sequences/deployedOnAkash";
type Project = CollectionEntry<"Ecosystem_Page">;
Expand Down Expand Up @@ -55,12 +50,8 @@ export async function getStaticPaths({
});
}
// All paginated data is passed on the "page" prop
const { page, tags } = Astro.props;
const astroUrl = Astro.url;
console.log(tags);
const pathName = astroUrl.pathname.split("/");
---

<Layout title={`Deployed On Akash`} image="/meta-images/ecosystem.png">
Expand Down Expand Up @@ -97,20 +88,26 @@ const pathName = astroUrl.pathname.split("/");
class="mt-4 grid flex-shrink-0 grid-cols-1 gap-y-[24px] sm:grid-cols-2 sm:gap-x-8 md:gap-y-8 lg:grid-cols-3 lg:gap-x-[36px] lg:gap-y-[32px]"
>
{
page.data.map((project: Project, i: number) => {
return (
<ProjectCard
title={project.data.projectTitle}
description={project.data.description}
image={project.data.projectImage}
button={project.data.ctaButton}
githubLink={project.data.githubLink}
twitterLink={project.data.twitterLink}
websiteLink={project.data.websiteLink}
discordLink={project.data.discordLink}
/>
);
})
[...page.data]
.sort(
(a, b) =>
getPriorityIndex(a.data.projectTitle) -
getPriorityIndex(b.data.projectTitle),
)
?.map((project: Project, i: number) => {
return (
<ProjectCard
title={project.data.projectTitle}
description={project.data.description}
image={project.data.projectImage}
button={project.data.ctaButton}
githubLink={project.data.githubLink}
twitterLink={project.data.twitterLink}
websiteLink={project.data.websiteLink}
discordLink={project.data.discordLink}
/>
);
})
}
</div>

Expand Down
16 changes: 16 additions & 0 deletions src/utils/sequences/deployedOnAkash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const deployedOnAkash = [
"Brev.dev",
"Venice.ai",
"Prime Intellect",
"University of Texas at Austin",
"Nous Research",
"Flock.io",
"Akash Chat API",
"Akash Chat",
"Auki",
];

export function getPriorityIndex(title: any) {
const index = deployedOnAkash.indexOf(title);
return index === -1 ? deployedOnAkash.length : index;
}

0 comments on commit 120936e

Please sign in to comment.