~emersion/gamja

4df9328be80772397da330147caaa171f63b625e — Simon Ser 10 days ago 8972130
Move auto-join field out of advanced options if pre-filled

Closes: https://todo.sr.ht/~emersion/gamja/82
2 files changed, 15 insertions(+), 6 deletions(-)

M components/app.js
M components/connect-form.js
M components/app.js => components/app.js +1 -1
@@ 183,7 183,7 @@ export default class App extends Component {
			connectParams.url = config.server.url;
			if (Array.isArray(config.server.autojoin)) {
				connectParams.autojoin = config.server.autojoin;
			} else {
			} else if (config.server.autojoin) {
				connectParams.autojoin = [config.server.autojoin];
			}
		}

M components/connect-form.js => components/connect-form.js +14 -5
@@ 116,6 116,17 @@ export default class ConnectForm extends Component {
			`;
		}

		let autojoin = html`
			<label>
				Auto-join channels:<br/>
				<input type="text" name="autojoin" value=${this.state.autojoin} disabled=${disabled} placeholder="Comma-separated list of channels"/>
			</label>
			<br/>
		`;

		// Show autojoin field in advanced options, except if it's pre-filled
		let isAutojoinAdvanced = (this.props.params.autojoin || []).length === 0;

		return html`
			<form onChange=${this.handleChange} onSubmit=${this.handleSubmit}>
				<h2>Connect to IRC</h2>


@@ 128,6 139,8 @@ export default class ConnectForm extends Component {

				${auth}

				${!isAutojoinAdvanced ? [autojoin, html`<br/>`] : null}

				<label>
					<input type="checkbox" name="rememberMe" checked=${this.state.rememberMe} disabled=${disabled}/>
					Remember me


@@ 159,11 172,7 @@ export default class ConnectForm extends Component {
					</label>
					<br/><br/>

					<label>
						Auto-join channels:<br/>
						<input type="text" name="autojoin" value=${this.state.autojoin} disabled=${disabled} placeholder="Comma-separated list of channels"/>
					</label>
					<br/>
					${isAutojoinAdvanced ? autojoin : null}
				</details>

				<br/>