import * as React from 'react' ; import { Expansion } from 'shared/schema/Constants' ; import { Quest } from 'shared/schema/Quests' ; import { ContentSetsType } from '../../reducers/StateTypes' ; import Card from '../base/Card' ; import QuestButtonContainer from '../base/QuestButtonContainer' ; export interface StateProps { quests : Quest [ ] ; contentSets : Set < keyof ContentSetsType > ; title : string ; icon : string ; } export interface DispatchProps { onQuestSelect : ( quest : Quest ) => any ; onReturn : ( ) => void ; } export interface Props extends StateProps , DispatchProps { } const QuestListCard = ( props ) : JSX . Element => { const items = props . quests . filter ( ( quest ) : boolean => { return ( ! quest . expansionhorror || props . contentSets . has ( Expansion . horror ) ) && ( ! quest . expansionfuture || props . contentSets . has ( Expansion . future ) ) && ( ! quest . expansionscarredlands || props . contentSets . has ( Expansion . scarredlands ) ) ; } ) . map ( ( quest , i ) : JSX . Element => { return ( < QuestButtonContainer key = { i } id = { `quest${ i }` } quest = { quest } onClick = { ( ) => props . onQuestSelect ( quest ) } />); } ) ; return ( < Card title = { props . title } icon = { props . icon } onReturn = { props . onReturn } > { items } < /Card>); } ; export default QuestListCard ;