Skip to content

Commit

Permalink
Explore: Implemented sort by newest humans (#38)
Browse files Browse the repository at this point in the history
* explore: implemented sort by newest humans (#23)

* chore: fixed lint issues
  • Loading branch information
muhammadsalihu authored Jun 8, 2022
1 parent 71056d4 commit 20d8c72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/explorer/src/views/Browse.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ const Page = () => {
})()
}, [services, user])

const sortByNewest = items => {
return Object.values(items).sort((a, b) => b.created - a.created)
}

return (
<div className='flex flex-col min-h-screen'>
<Navbar
Expand All @@ -96,7 +100,7 @@ const Page = () => {
<div className='block text-center'>
<h1 className='uppercase text-center py-4'>Humans</h1>
<ul>
{state && state.profiles && Object.entries(state.profiles).map(([_, e]) => {
{state && state.profiles && sortByNewest(state.profiles).map((e) => {
const meta = e
const profile = e.data
const created = Date.now() - meta.created
Expand Down

0 comments on commit 20d8c72

Please sign in to comment.