Show the recently updated item on top

pull/3968/head
Kamran Ahmed 2 years ago
parent 35f500d218
commit 12f385dffd
  1. 86
      src/components/Activity/ActivityPage.tsx

@ -101,43 +101,57 @@ export function ActivityPage() {
Continue Following Continue Following
</h2> </h2>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
{learningRoadmaps.reverse().map((roadmap) => ( {learningRoadmaps
<ResourceProgress .sort((a, b) => {
doneCount={roadmap.done || 0} const updatedAtA = new Date(a.updatedAt);
learningCount={roadmap.learning || 0} const updatedAtB = new Date(b.updatedAt);
totalCount={roadmap.total || 0}
skippedCount={roadmap.skipped || 0}
resourceId={roadmap.id}
resourceType={'roadmap'}
updatedAt={roadmap.updatedAt}
title={roadmap.title}
onCleared={() => {
pageLoadingMessage.set('Updating activity');
loadActivity().finally(() => {
pageLoadingMessage.set('');
});
}}
/>
))}
{learningBestPractices.reverse().map((bestPractice) => ( return updatedAtB.getTime() - updatedAtA.getTime();
<ResourceProgress })
doneCount={bestPractice.done || 0} .map((roadmap) => (
totalCount={bestPractice.total || 0} <ResourceProgress
learningCount={bestPractice.learning || 0} doneCount={roadmap.done || 0}
resourceId={bestPractice.id} learningCount={roadmap.learning || 0}
skippedCount={bestPractice.skipped || 0} totalCount={roadmap.total || 0}
resourceType={'best-practice'} skippedCount={roadmap.skipped || 0}
title={bestPractice.title} resourceId={roadmap.id}
updatedAt={bestPractice.updatedAt} resourceType={'roadmap'}
onCleared={() => { updatedAt={roadmap.updatedAt}
pageLoadingMessage.set('Updating activity'); title={roadmap.title}
loadActivity().finally(() => { onCleared={() => {
pageLoadingMessage.set(''); pageLoadingMessage.set('Updating activity');
}); loadActivity().finally(() => {
}} pageLoadingMessage.set('');
/> });
))} }}
/>
))}
{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}
learningCount={bestPractice.learning || 0}
resourceId={bestPractice.id}
skippedCount={bestPractice.skipped || 0}
resourceType={'best-practice'}
title={bestPractice.title}
updatedAt={bestPractice.updatedAt}
onCleared={() => {
pageLoadingMessage.set('Updating activity');
loadActivity().finally(() => {
pageLoadingMessage.set('');
});
}}
/>
))}
</div> </div>
</> </>
)} )}

Loading…
Cancel
Save