1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-21 08:31:50 +02:00

Show the recently updated item on top

This commit is contained in:
Kamran Ahmed
2023-05-26 15:38:04 +01:00
parent 35f500d218
commit 12f385dffd

View File

@@ -101,7 +101,14 @@ export function ActivityPage() {
Continue Following
</h2>
<div class="flex flex-col gap-3">
{learningRoadmaps.reverse().map((roadmap) => (
{learningRoadmaps
.sort((a, b) => {
const updatedAtA = new Date(a.updatedAt);
const updatedAtB = new Date(b.updatedAt);
return updatedAtB.getTime() - updatedAtA.getTime();
})
.map((roadmap) => (
<ResourceProgress
doneCount={roadmap.done || 0}
learningCount={roadmap.learning || 0}
@@ -120,7 +127,14 @@ export function ActivityPage() {
/>
))}
{learningBestPractices.reverse().map((bestPractice) => (
{learningBestPractices
.sort((a, b) => {
const updatedAtA = new Date(a.updatedAt);
const updatedAtB = new Date(b.updatedAt);
return updatedAtB.getTime() - updatedAtA.getTime();
})
.map((bestPractice) => (
<ResourceProgress
doneCount={bestPractice.done || 0}
totalCount={bestPractice.total || 0}