import { toTitleCase } from 'common/string';
import { Component, Fragment } from 'inferno';
import { useBackend } from '../backend';
import { BlockQuote, Box, Button, NumberInput, Section, Table } from '../components';
export const OreRedemptionMachine = props => {
const { act, data } = useBackend(props);
const {
unclaimedPoints,
materials,
alloys,
diskDesigns,
hasDisk,
} = data;
return (
This machine only accepts ore.
Gibtonite and Slag are not accepted.
Unclaimed points:
{unclaimedPoints}
{hasDisk && (
{diskDesigns.map(design => (
File {design.index}: {design.name}
))}
) || (
{materials.map(material => (
act('Release', {
id: material.id,
sheets: amount,
})} />
))}
{alloys.map(material => (
act('Smelt', {
id: material.id,
sheets: amount,
})} />
))}
);
};
class MaterialRow extends Component {
constructor() {
super();
this.state = {
amount: 1,
};
}
render() {
const { amount } = this.state;
const { material, onRelease } = this.props;
const amountAvailable = Math.floor(material.amount);
return (
{toTitleCase(material.name).replace('Alloy', '')}
{material.value && material.value + ' cr'}
{amountAvailable} sheets
this.setState({
amount: value,
})} />
);
}
}