mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 20:03:21 +00:00
Lint Code [skip actions]
This commit is contained in:
parent
564e4e496b
commit
757dc9f261
@ -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}`;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user