From 8d6acc6295cb3f4a42e145c7d228aca891feef70 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Fri, 13 May 2022 21:53:35 -0700 Subject: [PATCH] server ip and port input --- src/ui/components/ServerLaunchSection.css | 39 +++++++++++++++++++++++ src/ui/components/ServerLaunchSection.tsx | 16 ++++++++++ src/ui/components/common/TextInput.tsx | 3 +- src/ui/custom.css | 21 ------------ 4 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/ui/components/ServerLaunchSection.css b/src/ui/components/ServerLaunchSection.css index f0a0424..673272d 100644 --- a/src/ui/components/ServerLaunchSection.css +++ b/src/ui/components/ServerLaunchSection.css @@ -1,3 +1,28 @@ +#playButton { + display: flex; + flex-direction: column; + justify-content: space-between; + + position: absolute; + top: 75%; + left: 60%; + + width: 30%; + height: 18%; +} + +#playButton > div { + margin-top: 4px; +} + +#playButton .BigButton { + height: 100%; +} + +#serverControls { + color: white; +} + #serverControls .CheckboxDisplay { border-color: #fff; background: #fff; @@ -23,6 +48,7 @@ align-items: center; height: 100%; + max-height: 60px; } #officialPlay { @@ -36,4 +62,17 @@ .ServerIcon { height: 20px; filter: invert(28%) sepia(28%) saturate(1141%) hue-rotate(352deg) brightness(96%) contrast(88%); +} + +.ServerConfig input { + padding: 6px; + border-radius: 6px; +} + +#ip { + margin-right: 6px; +} + +#port { + width: 15%; } \ No newline at end of file diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index c3559dc..05da297 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -7,6 +7,7 @@ import { invoke } from '@tauri-apps/api/tauri' import Server from '../../resources/icons/server.svg' import './ServerLaunchSection.css' +import TextInput from './common/TextInput' interface IProps { [key: string]: any @@ -47,6 +48,11 @@ export default class ServerLaunchSection extends React.Component config.toggle_grasscutter = !config.toggle_grasscutter + // Set state as well + this.setState({ + grasscutterEnabled: config.toggle_grasscutter + }) + await saveConfig(config) } @@ -88,6 +94,16 @@ export default class ServerLaunchSection extends React.Component
+ +
+ { + this.state.grasscutterEnabled ? + [ , + ] + : null + } +
+
{this.state.buttonLabel} diff --git a/src/ui/components/common/TextInput.tsx b/src/ui/components/common/TextInput.tsx index 039f02e..908347d 100644 --- a/src/ui/components/common/TextInput.tsx +++ b/src/ui/components/common/TextInput.tsx @@ -6,6 +6,7 @@ interface IProps { placeholder?: string; onChange?: (value: string) => void; readOnly?: boolean; + id?: string; } interface IState { @@ -33,7 +34,7 @@ export default class TextInput extends React.Component { render() { return ( - { + { this.setState({ value: e.target.value }) if (this.props.onChange) this.props.onChange(e.target.value) }} /> diff --git a/src/ui/custom.css b/src/ui/custom.css index cbfef1d..e69de29 100644 --- a/src/ui/custom.css +++ b/src/ui/custom.css @@ -1,21 +0,0 @@ -#playButton { - display: flex; - flex-direction: column; - align-items: left; - justify-content: space-between; - - position: absolute; - top: 80%; - left: 60%; - - width: 30%; - height: 12%; -} - -#playButton .BigButton { - height: 100%; -} - -#serverControls { - color: white; -} \ No newline at end of file