Last active
July 11, 2022 12:20
-
-
Save koss-lebedev/3eac0d0a06186cb6fca50b3e589af213 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const UserItem = ({ user }) => { | |
return ( | |
<li> | |
<img src={user.avatarUrl} /> | |
<p>{user.fullName}</p> | |
<small>{user.role}</small> | |
</li> | |
) | |
} | |
const ActiveUsersList = () => { | |
const { users } = useUsers() | |
const weekAgo = new Date() | |
weekAgo.setDate(weekAgo.getDate() - 7) | |
return ( | |
<ul> | |
{users.filter(user => !user.isBanned && user.lastActivityAt >= weekAgo).map(user => | |
<UserItem key={user.id} user={user} /> | |
)} | |
</ul> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment