summaryrefslogtreecommitdiffstats
path: root/ui/src/components/setup.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-10-18 17:20:27 -0700
committerDessalines <tyhou13@gmx.com>2019-10-18 17:20:27 -0700
commit4e5561283392d2ab1545cabb4455a8ffc490f86b (patch)
treea4ee9cc096826dc32faf3675212c7f95f1b3ea5e /ui/src/components/setup.tsx
parent82ea5ae9186e5a8e631c87a61077e16713eb87a4 (diff)
Running prettier on code.
- #305 , #309
Diffstat (limited to 'ui/src/components/setup.tsx')
-rw-r--r--ui/src/components/setup.tsx105
1 files changed, 80 insertions, 25 deletions
diff --git a/ui/src/components/setup.tsx b/ui/src/components/setup.tsx
index 24a5f2d6..d421e46f 100644
--- a/ui/src/components/setup.tsx
+++ b/ui/src/components/setup.tsx
@@ -1,5 +1,5 @@
import { Component, linkEvent } from 'inferno';
-import { Subscription } from "rxjs";
+import { Subscription } from 'rxjs';
import { retryWhen, delay, take } from 'rxjs/operators';
import { RegisterForm, LoginResponse, UserOperation } from '../interfaces';
import { WebSocketService, UserService } from '../services';
@@ -27,8 +27,7 @@ export class Setup extends Component<any, State> {
},
doneRegisteringUser: false,
userLoading: false,
- }
-
+ };
constructor(props: any, context: any) {
super(props, context);
@@ -36,12 +35,19 @@ export class Setup extends Component<any, State> {
this.state = this.emptyState;
this.subscription = WebSocketService.Instance.subject
- .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
- .subscribe(
- (msg) => this.parseMessage(msg),
- (err) => console.error(err),
- () => console.log("complete")
- );
+ .pipe(
+ retryWhen(errors =>
+ errors.pipe(
+ delay(3000),
+ take(10)
+ )
+ )
+ )
+ .subscribe(
+ msg => this.parseMessage(msg),
+ err => console.error(err),
+ () => console.log('complete')
+ );
}
componentWillUnmount() {
@@ -57,54 +63,103 @@ export class Setup extends Component<any, State> {
<div class="container">
<div class="row">
<div class="col-12 offset-lg-3 col-lg-6">
- <h3><T i18nKey="lemmy_instance_setup">#</T></h3>
- {!this.state.doneRegisteringUser ? this.registerUser() : <SiteForm />}
+ <h3>
+ <T i18nKey="lemmy_instance_setup">#</T>
+ </h3>
+ {!this.state.doneRegisteringUser ? (
+ this.registerUser()
+ ) : (
+ <SiteForm />
+ )}
</div>
</div>
</div>
- )
+ );
}
registerUser() {
return (
<form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
- <h5><T i18nKey="setup_admin">#</T></h5>
+ <h5>
+ <T i18nKey="setup_admin">#</T>
+ </h5>
<div class="form-group row">
- <label class="col-sm-2 col-form-label"><T i18nKey="username">#</T></label>
+ <label class="col-sm-2 col-form-label">
+ <T i18nKey="username">#</T>
+ </label>
<div class="col-sm-10">
- <input type="text" class="form-control" value={this.state.userForm.username} onInput={linkEvent(this, this.handleRegisterUsernameChange)} required minLength={3} maxLength={20} pattern="[a-zA-Z0-9_]+" />
+ <input
+ type="text"
+ class="form-control"
+ value={this.state.userForm.username}
+ onInput={linkEvent(this, this.handleRegisterUsernameChange)}
+ required
+ minLength={3}
+ maxLength={20}
+ pattern="[a-zA-Z0-9_]+"
+ />
</div>
</div>
<div class="form-group row">
- <label class="col-sm-2 col-form-label"><T i18nKey="email">#</T></label>
+ <label class="col-sm-2 col-form-label">
+ <T i18nKey="email">#</T>
+ </label>
<div class="col-sm-10">
- <input type="email" class="form-control" placeholder={i18n.t('optional')} value={this.state.userForm.email} onInput={linkEvent(this, this.handleRegisterEmailChange)} minLength={3} />
+ <input
+ type="email"
+ class="form-control"
+ placeholder={i18n.t('optional')}
+ value={this.state.userForm.email}
+ onInput={linkEvent(this, this.handleRegisterEmailChange)}
+ minLength={3}
+ />
</div>
</div>
<div class="form-group row">
- <label class="col-sm-2 col-form-label"><T i18nKey="password">#</T></label>
+ <label class="col-sm-2 col-form-label">
+ <T i18nKey="password">#</T>
+ </label>
<div class="col-sm-10">
- <input type="password" value={this.state.userForm.password} onInput={linkEvent(this, this.handleRegisterPasswordChange)} class="form-control" required />
+ <input
+ type="password"
+ value={this.state.userForm.password}
+ onInput={linkEvent(this, this.handleRegisterPasswordChange)}
+ class="form-control"
+ required
+ />
</div>
</div>
<div class="form-group row">
- <label class="col-sm-2 col-form-label"><T i18nKey="verify_password">#</T></label>
+ <label class="col-sm-2 col-form-label">
+ <T i18nKey="verify_password">#</T>
+ </label>
<div class="col-sm-10">
- <input type="password" value={this.state.userForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
+ <input
+ type="password"
+ value={this.state.userForm.password_verify}
+ onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
+ class="form-control"
+ required
+ />
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
- <button type="submit" class="btn btn-secondary">{this.state.userLoading ?
- <svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg> : i18n.t('sign_up')}</button>
-
+ <button type="submit" class="btn btn-secondary">
+ {this.state.userLoading ? (
+ <svg class="icon icon-spinner spin">
+ <use xlinkHref="#icon-spinner"></use>
+ </svg>
+ ) : (
+ i18n.t('sign_up')
+ )}
+ </button>
</div>
</div>
</form>
);
}
-
handleRegisterSubmit(i: Setup, event: any) {
event.preventDefault();
i.state.userLoading = true;