Last active
June 28, 2023 21:55
-
-
Save jonidelv/c813da85320a9b6490b502a20d9781b2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
window.currentUser = { id: '19', name: 'Jane', email: 'jane@chameleon.io' }; | |
export const ActiveProfiles({ profiles, onLaunchProfile }) => { | |
var active = []; | |
for(i=0; i < profiles.length; i++) { | |
if(!profiles[i].disabled && profiles[i]['last_seen_time'] > new Date(new Date().getTime()-(24*60*1000)).toISOString()) { // within the last 24 hours | |
active.push(profiles[i]); | |
} | |
} | |
if(active.length == 1 && active[0].email === window.currentUser.email) { | |
active.length = 0; | |
} | |
return ( | |
<div> | |
{active.map(function(a) { return <div onClick={() => onLaunchProfile(a.name, a.email)}>{a.name} - {a.email}</div> })} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is how I would modify this component to utilize the
Dropdown
component created above.