mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-16 09:04:45 +01:00
game download menu
This commit is contained in:
58
src/ui/components/menu/Game.tsx
Normal file
58
src/ui/components/menu/Game.tsx
Normal 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>
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user