fix textboxes

This commit is contained in:
SpikeHD
2022-06-03 23:03:22 -07:00
parent ae37feebea
commit 154d79b2e4
3 changed files with 17 additions and 3 deletions

View File

@@ -80,8 +80,8 @@ class App extends React.Component<IProps, IState> {
const cert_generated = await getConfigOption('cert_generated') const cert_generated = await getConfigOption('cert_generated')
const game_exe = await getConfigOption('game_install_path') const game_exe = await getConfigOption('game_install_path')
const custom_bg = await getConfigOption('customBackground') const custom_bg = await getConfigOption('customBackground')
const game_path = game_exe.substring(0, game_exe.replace(/\\/g, '/').lastIndexOf('/')) const game_path = game_exe?.substring(0, game_exe.replace(/\\/g, '/').lastIndexOf('/')) || ''
const root_path = game_path.substring(0, game_path.replace(/\\/g, '/').lastIndexOf('/')) const root_path = game_path?.substring(0, game_path.replace(/\\/g, '/').lastIndexOf('/')) || ''
// Load a theme if it exists // Load a theme if it exists
const theme = await getConfigOption('theme') const theme = await getConfigOption('theme')

View File

@@ -53,7 +53,6 @@ export default class TextInput extends React.Component<IProps, IState> {
this.props.clearable ? this.props.clearable ?
<div className="TextClear" onClick={() => { <div className="TextClear" onClick={() => {
// Run custom behaviour first // Run custom behaviour first
console.log('cleared')
if (this.props.customClearBehaviour) return this.props.customClearBehaviour() if (this.props.customClearBehaviour) return this.props.customClearBehaviour()
this.setState({ value: '' }) this.setState({ value: '' })

View File

@@ -43,6 +43,9 @@ export default class Options extends React.Component<IProps, IState> {
theme: '' theme: ''
} }
this.setGameExec = this.setGameExec.bind(this)
this.setGrasscutterJar = this.setGrasscutterJar.bind(this)
this.setJavaPath = this.setJavaPath.bind(this)
this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this) this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this)
this.setCustomBackground = this.setCustomBackground.bind(this) this.setCustomBackground = this.setCustomBackground.bind(this)
} }
@@ -68,14 +71,26 @@ export default class Options extends React.Component<IProps, IState> {
setGameExec(value: string) { setGameExec(value: string) {
setConfigOption('game_install_path', value) setConfigOption('game_install_path', value)
this.setState({
game_install_path: value
})
} }
setGrasscutterJar(value: string) { setGrasscutterJar(value: string) {
setConfigOption('grasscutter_path', value) setConfigOption('grasscutter_path', value)
this.setState({
grasscutter_path: value
})
} }
setJavaPath(value: string) { setJavaPath(value: string) {
setConfigOption('java_path', value) setConfigOption('java_path', value)
this.setState({
java_path: value
})
} }
async setLanguage(value: string) { async setLanguage(value: string) {