Merge remote-tracking branch 'origin/unstable' into unstable

This commit is contained in:
KingRainbow44 2023-05-12 19:05:18 -04:00
commit 63488f826a
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
3 changed files with 6 additions and 18 deletions

View File

@ -12,8 +12,7 @@ function invalid(value: number): boolean {
*/
function basicGive(item: number, amount = 1): string {
// Validate the numbers.
if (invalid(item) || invalid(amount))
return "Invalid arguments.";
if (invalid(item) || invalid(amount)) return "Invalid arguments.";
return `/give ${item} x${amount}`;
}

View File

@ -38,9 +38,7 @@ class TextState extends React.Component<IProps, IState> {
}
render() {
return this.state.state ?
this.props.text2 :
this.props.text1;
return this.state.state ? this.props.text2 : this.props.text1;
}
}

View File

@ -86,15 +86,12 @@ class ItemCard extends React.Component<IProps, IState> {
*/
private async addToInventory(): Promise<void> {
const item = this.props.item?.id ?? 102;
const amount = typeof this.state.count == "string" ?
parseInt(this.state.count) :
this.state.count;
const amount = typeof this.state.count == "string" ? parseInt(this.state.count) : this.state.count;
if (connected) {
await giveItem(item, amount);
} else {
await copyToClipboard(
give.basic(item, amount));
await copyToClipboard(give.basic(item, amount));
}
}
@ -165,14 +162,8 @@ class ItemCard extends React.Component<IProps, IState> {
</div>
</div>
<button className={"ItemCard_Submit"}
onClick={this.addToInventory.bind(this)}
>
<TextState
event={"connected"}
text1={"Copy Command"}
text2={"Add to Inventory"}
/>
<button className={"ItemCard_Submit"} onClick={this.addToInventory.bind(this)}>
<TextState event={"connected"} text1={"Copy Command"} text2={"Add to Inventory"} />
</button>
</div>
</div>