From cc74107dfe4eb398c4dbc20bcc39198a7b358a3a Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 25 Jul 2022 18:26:04 -0700 Subject: [PATCH] move help buttons to alerts --- src/ui/components/common/HelpButton.tsx | 33 +++++-------------------- src/ui/components/menu/Downloads.tsx | 20 ++++----------- src/ui/components/menu/Game.tsx | 4 +-- 3 files changed, 12 insertions(+), 45 deletions(-) diff --git a/src/ui/components/common/HelpButton.tsx b/src/ui/components/common/HelpButton.tsx index de78c8c..f981b06 100644 --- a/src/ui/components/common/HelpButton.tsx +++ b/src/ui/components/common/HelpButton.tsx @@ -3,6 +3,7 @@ import React from 'react' import './HelpButton.css' import Help from '../../../resources/icons/help.svg' import MiniDialog from '../MiniDialog' +import { translate } from '../../../utils/language' interface IProps { children?: React.ReactNode[] | React.ReactNode @@ -10,45 +11,23 @@ interface IProps { id?: string } -interface IState { - opened: boolean -} - -export default class HelpButton extends React.Component { +export default class HelpButton extends React.Component { constructor(props: IProps) { super(props) - this.state = { - opened: false, - } - - this.setOpen = this.setOpen.bind(this) - this.setClosed = this.setClosed.bind(this) + this.showAlert = this.showAlert.bind(this) } - setOpen() { - this.setState({ opened: true }) - } - - setClosed() { - this.setState({ opened: false }) + async showAlert() { + if (this.props.contents) alert(await translate(this.props.contents)) } render() { return (
-
+
- -
- {this.props.contents || this.props.children} -
) } diff --git a/src/ui/components/menu/Downloads.tsx b/src/ui/components/menu/Downloads.tsx index a97b769..9687651 100644 --- a/src/ui/components/menu/Downloads.tsx +++ b/src/ui/components/menu/Downloads.tsx @@ -199,9 +199,7 @@ export default class Downloads extends React.Component { - - - +
{ - - - +
{ : 'downloads.grasscutter_stable_data_update' } /> - - - +
{ : 'downloads.grasscutter_latest_data_update' } /> - - - +
{
- - - +
{ Download Game )} - - - +