on master help sign in
ecosystem: show groups
c1fe23fMatilde Park
pages/ecosystem/index.js+65−2
@@ -25,6 +25,7 @@ export default function Ecosystem({
25 post,
25 post,
26 posts,
26 posts,
27 applications,
27 applications,
28+ groups,
28 marketplaces,
29 marketplaces,
29 organizations,
30 organizations,
30 podcasts,
31 podcasts,
@@ -113,7 +114,7 @@ export default function Ecosystem({
113 "grid-cols-2 md:grid-cols-3": type !== "podcasts",
114 "grid-cols-2 md:grid-cols-3": type !== "podcasts",
114 "grid-cols-1": type === "podcasts",
115 "grid-cols-1": type === "podcasts",
115 "grid-cols-1 md:grid-cols-1 lg:grid-cols-1 xl:grid-cols-2":
116 "grid-cols-1 md:grid-cols-1 lg:grid-cols-1 xl:grid-cols-2":
116− type === "applications",
117+ type === "applications" || type === "groups",
117 hidden: type === undefined,
118 hidden: type === undefined,
118 })}
119 })}
119 >
120 >
@@ -153,6 +154,34 @@ export default function Ecosystem({
153 </div>
154 </div>
154 </Link>
155 </Link>
155 ))}
156 ))}
157+ {type === "groups" &&
158+ groups.map((group) => (
159+ <Link href={`/groups/${group.ship}/${group.slug}`}>
160+ <div className="flex space-x-4 items-center cursor-pointer hover:opacity-90">
161+ <div
162+ className="h-36 w-36 rounded-xl items-center justify-center shrink-0 overflow-hidden"
163+ style={{
164+ backgroundColor: group?.tile?.startsWith("#")
165+ ? group?.tile
166+ : "rgba(0,0,0,0)",
167+ }}
168+ >
169+ {!group?.tile?.startsWith("#") && (
170+ <img
171+ className="items-center h-36 w-36"
172+ src={group.tile}
173+ />
174+ )}
175+ </div>
176+ <div className="">
177+ <p className="text-left font-bold">{group.title}</p>
178+ <p className="text-left text-wall-400 font-light">
179+ {group.description}
180+ </p>
181+ </div>
182+ </div>
183+ </Link>
184+ ))}
156 {type === "marketplaces" &&
185 {type === "marketplaces" &&
157 marketplaces.map((market) => (
186 marketplaces.map((market) => (
158 <Link href={`/marketplaces/${market.slug}`}>
187 <Link href={`/marketplaces/${market.slug}`}>
@@ -232,6 +261,13 @@ function EcosystemSidebar() {
232 >
261 >
233 Applications
262 Applications
234 </ActiveLink>
263 </ActiveLink>
264+ <ActiveLink
265+ currentPath={currentPath}
266+ className="type-ui"
267+ href="/ecosystem?type=groups"
268+ >
269+ Groups
270+ </ActiveLink>
235 <ActiveLink
271 <ActiveLink
236 currentPath={currentPath}
272 currentPath={currentPath}
237 className="type-ui"
273 className="type-ui"
@@ -348,6 +384,25 @@ export async function getStaticProps({}) {
348 const nameB = b.title.toLowerCase();
384 const nameB = b.title.toLowerCase();
349 return nameA < nameB ? -1 : 1;
385 return nameA < nameB ? -1 : 1;
350 });
386 });
387+ const groups = fs
388+ .readdirSync(path.join(process.cwd(), "content/groups"), {
389+ withFileTypes: true,
390+ })
391+ .filter((f) => f.isDirectory())
392+ .map((dir) =>
393+ getAllPosts(
394+ ["title", "tile", "slug", "description"],
395+ `groups/${dir.name}`
396+ )
397+ .map((e) => ({ ...e, ship: dir.name }))
398+ .flat()
399+ )
400+ .flat()
401+ .sort((a, b) => {
402+ const nameA = a.title.toLowerCase();
403+ const nameB = b.title.toLowerCase();
404+ return nameA < nameB ? -1 : 1;
405+ });
351
406
352 ["featured-1", "featured-2", "featured-3"].forEach((feat) => {
407 ["featured-1", "featured-2", "featured-3"].forEach((feat) => {
353 if (post?.[feat]) {
408 if (post?.[feat]) {
@@ -369,6 +424,14 @@ export async function getStaticProps({}) {
369 });
424 });
370
425
371 return {
426 return {
372− props: { posts, post, applications, marketplaces, podcasts, organizations },
427+ props: {
428+ posts,
429+ post,
430+ applications,
431+ groups,
432+ marketplaces,
433+ podcasts,
434+ organizations,
435+ },
373 };
436 };
374}
437}