game download menu

This commit is contained in:
SpikeHD
2022-05-24 21:38:49 -07:00
parent 5879207181
commit b4a6c2cb35
7 changed files with 143 additions and 10 deletions

View File

@@ -0,0 +1,58 @@
import React from 'react'
import Menu from './Menu'
import Tr, { translate } from '../../../utils/language'
import DownloadHandler from '../../../utils/download'
import './Game.css'
import DirInput from '../common/DirInput'
import BigButton from '../common/BigButton'
interface IProps {
closeFn: () => void;
downloadManager: DownloadHandler;
}
interface IState {
gameDownloading: boolean;
gameDownloadFolder: string;
dirPlaceholder: string;
}
export default class Downloads extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props)
this.state = {
gameDownloading: false,
gameDownloadFolder: '',
dirPlaceholder: ''
}
}
async componentDidMount() {
this.setState({
dirPlaceholder: await translate('components.select_folder')
})
}
downloadGame() {
console.log('Download!')
}
render() {
return (
<Menu heading='Download Game' closeFn={this.props.closeFn} className="GameDownloadMenu">
<div className="GameDownload">
<BigButton id="downloadGameBtn" onClick={this.downloadGame}>Download Game</BigButton>
</div>
<div className="GameDownloadDir">
<DirInput placeholder={this.state.dirPlaceholder} clearable={false} readonly={false} onChange={(value: string) => this.setState({
gameDownloading: true,
gameDownloadFolder: value
})}/>
</div>
</Menu>
)
}
}