import React from 'react'; import { ApiCountedResource, ApiProduction, ApiResourceType } from '../../api/model'; import './ProductionBar.css' type ProductionBarProps = { gold: number, production: ApiProduction, } export const ProductionBar = ({gold, production}: ProductionBarProps) => { return
; }; type GoldIndicatorProps = { amount: number, } const GoldIndicator = ({amount}: GoldIndicatorProps) => { return }; type FixedResourcesProps = { resources: ApiCountedResource[], } const FixedResources = ({resources}: FixedResourcesProps) => { return
{resources.map(r => )}
}; type AlternativeResourcesProps = { resources: ApiResourceType[][], } const AlternativeResources = ({resources}: AlternativeResourcesProps) => { return
{resources.map((types, i) => )}
}; type ResourceChoiceProps = { types: ApiResourceType[], } const ResourceChoice = ({types}: ResourceChoiceProps) => { let typeImages = types.map(type => ); let separator = ; return
{intersperce(typeImages, separator)}
}; function intersperce(array: T[], separator: T): T[] { let result = array.reduce((acc: T[], elt: T) => acc.concat(elt, separator), []); return result.slice(0, -1); // remove extra separator at the end } type TokenWithCountProps = { tokenName: string, count: number, otherClasses?: string, } const TokenWithCount = ({tokenName, count, otherClasses = ""}: TokenWithCountProps) => { return
× {count}
}; type TokenImageProps = { tokenName: string, } const TokenImage = ({tokenName}: TokenImageProps) => { return {tokenName} }; function getTokenImagePath(tokenName: string): string { return `/images/tokens/${tokenName}.png`; } function getTokenName(resourceType: ApiResourceType): string { return `resources/${resourceType.toLowerCase()}`; }