diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index 21fd547..af392db 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -51,6 +51,9 @@ export default class ServerLaunchSection extends React.Component async componentDidMount() { const config = await getConfig() + console.log(config.last_ip) + console.log(config.last_port) + this.setState({ grasscutterEnabled: config.toggle_grasscutter, buttonLabel: await translate('main.launch_button'), @@ -152,10 +155,10 @@ export default class ServerLaunchSection extends React.Component { this.state.grasscutterEnabled && (
- + + }} id="port" key="port" placeholder={this.state.portPlaceholder} onChange={this.setPort} initalValue={this.state.port} />
) diff --git a/src/ui/components/common/TextInput.tsx b/src/ui/components/common/TextInput.tsx index c72c604..2d8dbe2 100644 --- a/src/ui/components/common/TextInput.tsx +++ b/src/ui/components/common/TextInput.tsx @@ -5,6 +5,7 @@ import Close from '../../../resources/icons/close.svg' interface IProps { value?: string; + initalValue?: string; placeholder?: string; onChange?: (value: string) => void; readOnly?: boolean; @@ -38,6 +39,14 @@ export default class TextInput extends React.Component { return { value: props.value || '' } } + async componentDidMount() { + if (this.props.initalValue) { + this.setState({ + value: this.props.initalValue + }) + } + } + render() { return (