const preact = require('preact'); const reactStringReplace = require('react-string-replace'); const specThresholds = require('./info.thresholds'); 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, newState) { 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; if (newState.comboItem !== this.state.comboItem) return true; return false; } componentDidUpdate(prevProps) { // Catch case where mouse events don't properly clear state and info changed if (prevProps.info !== this.props.info && this.state.comboItem) this.setState({ comboItem: null }); } 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; const { comboItem } = this.state; function Info() { if (tutorial) { const tutorialStageInfo = tutorialStage(tutorial, ws, setTutorialNull, instance); if (tutorialStageInfo) return tutorialStageInfo; } if (!info) return false; if (info.includes('constructName')) { return (
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.
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 the combined item when it appears in this section.
Click the READY button to start the GAME PHASE.
| { e.stopPropagation(); this.setState({ comboItem: c.item }); }} onClick={() => setInfo(c.item)} > {convertItem(c.item)} | {c.components.map((u, j) =>{convertItem(u)} | )}