feat: implement category-based filtering in Dashboard and add dynamic category pages

This commit is contained in:
Caleb Joshua
2024-11-19 04:32:15 +05:30
committed by Steve Paul
parent 87f6a7f777
commit 75dadabc58
3 changed files with 59 additions and 11 deletions

View File

@@ -1,13 +1,11 @@
import { useState } from "react";
import CategoryNav from "./CategoryNav";
import CardsContainer from "./CardsContainer";
export default function Dashboard() {
const [filter, setFilter] = useState("all");
return <>
<CategoryNav filter={filter} setFilter={setFilter} />
<CardsContainer filter={filter} />
</>
}
export default function Dashboard({ category }) {
return (
<>
<CategoryNav filter={category} />
<CardsContainer filter={category} />
</>
);
}

View File

@@ -0,0 +1,50 @@
---
import Layout from "../../layouts/Layout.astro";
import "@new-ui/reset";
import "@new-ui/colors";
import "@new-ui/typography";
import "@new-ui/effects";
import "@new-ui/spacings";
import Dashboard from "../../components/Dashboard";
export function getStaticPaths() {
return [
{params: {category: 'all'}},
{params: {category: 'art'}},
{params: {category: 'audio'}},
{params: {category: 'code'}},
{params: {category: 'copywriting'}},
{params: {category: 'design'}},
{params: {category: 'developer'}},
{params: {category: 'education'}},
{params: {category: 'enterprise'}},
{params: {category: 'fashion'}},
{params: {category: 'gaming'}},
{params: {category: 'health'}},
{params: {category: 'legal'}},
{params: {category: 'llm'}},
{params: {category: 'music'}},
{params: {category: 'nocode'}},
{params: {category: 'photos'}},
{params: {category: 'productivity'}},
{params: {category: 'prompts'}},
{params: {category: 'research'}},
{params: {category: 'seo'}},
{params: {category: 'social'}},
{params: {category: 'xtras'}},
];
}
const { category } = Astro.params;
---
<Layout
site=`Rise of Machine - ${category}`
title="Make the Most of It"
tagline="Discover AI tools curated for makers and SMBs."
>
<main>
<Dashboard client:load category=`${category}` />
</main>
</Layout>

View File

@@ -15,6 +15,6 @@ import Dashboard from "../components/Dashboard";
tagline="Discover AI tools curated for makers and SMBs."
>
<main>
<Dashboard client:load />
<Dashboard client:load category='all' />
</main>
</Layout>