Skip to content

Commit

Permalink
Sorted the cards in alphabetical order. (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-shivam-gupta authored Sep 22, 2023
1 parent 5f140ae commit 5d2a116
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
24 changes: 21 additions & 3 deletions app/datasets/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,32 @@ export default function Datasets() {
}
}, [theme]);

// Sort datasets by title in alphabetical order
const sortedDatasets = [...datasets].sort((a: Data, b: Data) =>
a.title.localeCompare(b.title)
);

return (
<div className="flex">
<main className="mt-8 flex bg-[--light-bg] dark:bg-[--dark-bg] dark:text-[--light-bg] flex-row justify-center flex-wrap md:m-12">
{datasets.map((dataset: Data, index: number) => (
<Card id={index} datasets={true} data={dataset} setModalActive={setModalActive} setModalData={setModalData} />
{sortedDatasets.map((dataset: Data, index: number) => (
<Card
key={index}
id={index}
datasets={true}
data={dataset}
setModalActive={setModalActive}
setModalData={setModalData}
/>
))}
</main>
{modalActive && <Modal data={modalData} datasets={true} setModalActive={setModalActive} />}
{modalActive && (
<Modal
data={modalData}
datasets={true}
setModalActive={setModalActive}
/>
)}
</div>
);
}
16 changes: 14 additions & 2 deletions app/prompts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ export default function Prompts() {
}
}, [theme]);

// Sort prompts by title in alphabetical order
const sortedPrompts = [...prompts].sort((a: Data, b: Data) =>
a.title.localeCompare(b.title)
);

return (
<div className="flex">
<main className="mt-8 flex bg-[--light-bg] dark:bg-[--dark-bg] dark:text-[--light-bg] flex-row justify-center flex-wrap md:m-12">
{prompts.map((prompt: Data, index: number) => (
{sortedPrompts.map((prompt: Data, index: number) => (
<Card
key={index}
id={index}
prompts={true}
data={prompt}
Expand All @@ -35,7 +41,13 @@ export default function Prompts() {
/>
))}
</main>
{modalActive && <Modal data={modalData} prompts={true} setModalActive={setModalActive} />}
{modalActive && (
<Modal
data={modalData}
prompts={true}
setModalActive={setModalActive}
/>
)}
</div>
);
}
20 changes: 17 additions & 3 deletions app/tools/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,28 @@ export default function Tools() {
}
}, [theme]);

// Sort tools by title in alphabetical order
const sortedTools = [...tools].sort((a: Data, b: Data) =>
a.title.localeCompare(b.title)
);

return (
<div className="flex">
<main className="mt-8 flex bg-[--light-bg] dark:bg-[--dark-bg] dark:text-[--light-bg] flex-row justify-center flex-wrap md:m-12">
{tools.map((tool: Data, index: number) => (
<Card id={index} tools={true} data={tool} setModalActive={setModalActive} setModalData={setModalData} />
{sortedTools.map((tool: Data, index: number) => (
<Card
key={index}
id={index}
tools={true}
data={tool}
setModalActive={setModalActive}
setModalData={setModalData}
/>
))}
</main>
{modalActive && <Modal data={modalData} tools={true} setModalActive={setModalActive} />}
{modalActive && (
<Modal data={modalData} tools={true} setModalActive={setModalActive} />
)}
</div>
);
}

1 comment on commit 5d2a116

@vercel
Copy link

@vercel vercel bot commented on 5d2a116 Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

aifusion – ./

aifusion.vercel.app
aifusion-priyansu.vercel.app
aifusion-git-main-priyansu.vercel.app

Please sign in to comment.