const preact = require('preact');
const range = require('lodash/range');
const reactStringReplace = require('react-string-replace');
const { INFO } = require('./../constants');
const { convertItem, removeTier } = require('../utils');
const { tutorialStage } = require('../tutorial.utils');
const shapes = require('./shapes');
class InfoComponent extends preact.Component {
shouldComponentUpdate(newProps) {
if (newProps.tutorial !== this.props.tutorial) return true;
// We don't care about info during tutorial
if (newProps.tutorial && this.props.instance.time_control === 'Practice'
&& this.props.instance.rounds.length === 1) return false;
if (newProps.info !== this.props.info) return true;
return false;
}
render(args) {
const {
// Variables that will change
info,
tutorial,
// Static
player, // Only used for colour calcs which will be update if info changes
ws,
itemInfo,
instance, // Only used for instance id
// functions
setInfo,
setTutorialNull,
} = args;
function Info() {
if (tutorial) {
const tutorialStageInfo = tutorialStage(tutorial, ws, setTutorialNull, instance);
if (tutorialStageInfo) return tutorialStageInfo;
}
if (!info) return false;
if (info.includes('constructName')) {
return (
{info.replace('constructName ', '')}
This is the name of your construct.
Names are randomly generated and are purely cosmetic.
You can change change your construct name in the reshape tab outside of games.
);
}
if (info.includes('constructAvatar')) {
return (
{info.replace('constructAvatar ', '')}
This is your construct avatar.
Avatars are randomly generated and are purely cosmetic.
You can change your construct avatar in the reshape tab outside of games.
You can preview combos by clicking them when they appear in this section.
Reclaim can be used to sell items in the inventory.
Click the READY button to start the GAME PHASE.
);
if (!player) return generalNotes;
if (!info) return generalNotes;
const vboxCombos = itemInfo.combos.filter(c => c.components.includes(info));
if (vboxCombos.length > 6 || vboxCombos.length === 0) return generalNotes;
return (