Skip to content

Commit

Permalink
feat(ui): updated Article listing on Data Feed in UI to be sorted by …
Browse files Browse the repository at this point in the history
…created date

Updated the Article Table shown on the Data Feed Details page to sort the articles by date created
desc

re #41
  • Loading branch information
flamingquaks committed Jun 28, 2024
1 parent b86d734 commit 9fb68ab
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,16 @@ export default function DataFeedArticleTable () {
return
}
if (result.data.listArticles?.items !== null) {
setArticles(result.data.listArticles?.items as Article[])
const sortedArticles = [...(result.data.listArticles?.items as Article[])]
.sort((a, b) => {
const dateA = new Date(a.createdAt ?? 0);
const dateB = new Date(b.createdAt ?? 0);
return dateB.getTime() - dateA.getTime();
});
setArticles(sortedArticles);
}


setLoading(false)
}, [appContext, dataFeedId])

Expand Down Expand Up @@ -101,7 +108,6 @@ export default function DataFeedArticleTable () {
if (flagArticle !== null && flagArticle == 'true' && articleId !== null) {
setLoading(true)
try {
console.log('TRIGGER')
flagDataFeedArticle(articleId, true)
} catch (error) {
console.log(error)
Expand Down

0 comments on commit 9fb68ab

Please sign in to comment.