import { useBackend } from '../backend'; import { Box, Button, Section, Collapsible, Table } from '../components'; import { Window } from '../layouts'; export const Stack = (props, context) => { const { act, data } = useBackend(context); const { amount, recipes } = data; return (
); }; const RecipeList = (props, context) => { const { act, data } = useBackend(context); const { recipes } = props; let sortedKeys = Object.keys(recipes).sort(); // Shunt all categories to the top. // We're not using this for now, keeping it here in case someone really hates color coding later. // let nonCategories = sortedKeys.filter(item => recipes[item].ref !== undefined); // let categories = sortedKeys.filter(item => recipes[item].ref === undefined); // categories.unshift("--DIVIDER--"); // let newSortedKeys = nonCategories.concat(categories); return sortedKeys.map((title) => { // if (title === "--DIVIDER--") { // return ( // // // // ); // } let recipe = recipes[title]; if (recipe.ref === undefined) { return ( ); } else { return ; } }); }; const buildMultiplier = (recipe, amount) => { if (recipe.req_amount > amount) { return 0; } return Math.floor(amount / recipe.req_amount); }; const Multipliers = (props, context) => { const { act, data } = useBackend(context); const { recipe, maxMultiplier } = props; let maxM = Math.min( maxMultiplier, Math.floor(recipe.max_res_amount / recipe.res_amount) ); let multipliers = [5, 10, 25]; let finalResult = []; for (let multiplier of multipliers) { if (maxM >= multiplier) { finalResult.push(