Skip to content

Instantly share code, notes, and snippets.

@quicksnap
Created January 8, 2019 19:36
Show Gist options
  • Save quicksnap/6a520a7935f291141696e89b9f1b1e3d to your computer and use it in GitHub Desktop.
Save quicksnap/6a520a7935f291141696e89b9f1b1e3d to your computer and use it in GitHub Desktop.
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