import * as React from 'react'

import data from '../../../../data'
import {FundPrereq} from "../../../../definitions/Prerequisites/FundPrereq"

function stringifyCondition(condition: any) {
    if (condition.familyMember) {
        return ` if you have ${condition.familyMember} family members`
    }
}

const FundBox = (props: {prereq: FundPrereq}) => {
    if (props.prereq.type === "possess") {
        return (
            <div>
                You have
                {
                    props.prereq.schemes.map((scheme, index) => 
                        <div key={index}>
                            {data.common.currencies[scheme.fund.currencyId].code}
                            {" "}
                            {scheme.fund.value}
                            {
                                scheme.condition && stringifyCondition(scheme.condition)
                            }
                        </div>
                    )
                }
            </div>
        )
    } else {
        return <noscript />
    }
}

export default FundBox

import * as React from 'react'

import data from '../../../../data'
import {FundPrereq} from "../../../../definitions/Prerequisites/FundPrereq"

function stringifyCondition(condition: any) {
    if (condition.familyMember) {
        return ` if you have ${condition.familyMember} family members`
    }
}

const FundBox = (props: {prereq: FundPrereq}) => {
    if (props.prereq.type === "possess") {
        return (
            <div>
                You have
                {
                    props.prereq.schemes.map((scheme, index) => 
                        <div key={index}>
                            {data.common.currencies[scheme.fund.currencyId].code}
                            {" "}
                            {scheme.fund.value.toLocaleString(data.app.lang, {
                                style: "decimal",
                                currency: scheme.fund.currencyId
                            })}
                            {
                                scheme.condition && stringifyCondition(scheme.condition)
                            }
                        </div>
                    )
                }
            </div>
        )
    } else {
        return <noscript />
    }
}

export default FundBox

Add commata to currency numbers
Add commata to currency numbers

Signed-off-by: Andy Shu <d9a5ae79e0620530e640970c782273ccd89702f2@gmail.com>
