Created
January 8, 2019 19:36
-
-
Save quicksnap/6a520a7935f291141696e89b9f1b1e3d 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
getTabs = (isEventFinished: boolean) => { | |
const { isParticipant, isGodOrOwner: isGodOrOwnerProp } = this.props | |
const { | |
summary, | |
activitylog, | |
scorebreakdown, | |
participants, | |
leaderboard, | |
attachments, | |
} = TABS | |
const visibleTabList = [ | |
{ | |
content: summary, | |
check: () => isEventFinished, | |
}, | |
{ | |
content: activitylog, | |
check: () => isEventFinished && isGodOrOwnerProp, | |
}, | |
{ | |
content: participants, | |
check: () => true, | |
}, | |
{ | |
content: scorebreakdown, | |
check: () => isParticipant, | |
}, | |
{ | |
content: leaderboard, | |
check: () => isGodOrOwnerProp || isEventFinished, | |
}, | |
{ | |
content: attachments, | |
check: () => isGodOrOwnerProp || isEventFinished, | |
}, | |
] | |
return visibleTabList.filter(t => t.check()).map(t => t.content) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment