import React from 'react'; import type { 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, separator) { let result = array.reduce((acc, elt) => acc.concat(elt, separator), []); return result.slice(0, -1); } 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: number): string { return `/images/tokens/${tokenName}.png`; } function getTokenName(resourceType: ApiResourceType): string { return `resources/${resourceType.toLowerCase()}`; }