diff options
author | Vitaly Takmazov | 2018-08-27 15:32:09 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:53 +0300 |
commit | 2bcad655fca844d06390e6431073a46091988f39 (patch) | |
tree | 798a96c0c45fe7c2779533b0391ed87d333349c8 /vnext/src | |
parent | 59af8a28a0f4b808cf44fbb22fd900bd98e23f0e (diff) |
moar /settings updates
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/components/Settings.js | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js index d3eced63..2a24e35c 100644 --- a/vnext/src/components/Settings.js +++ b/vnext/src/components/Settings.js @@ -29,7 +29,7 @@ export default class Settings extends React.Component { } passwordChanged = (event) => { this.setState({ - settings: { password : event.target.value } + settings: { password: event.target.value } }); } onSubmitPassword = (event) => { @@ -38,6 +38,29 @@ export default class Settings extends React.Component { } console.log('password update'); } + emailChanged = (event) => { + this.setState({ + me: { activeEmail: event.target.value } + }); + } + disableTelegram = () => { + console.log('telegram disable'); + } + disableFacebook = (event) => { + if (event.preventDefault) { + event.preventDefault(); + } + console.log('facebook disable'); + } + enableFacebook = (event) => { + if (event.preventDefault) { + event.preventDefault(); + } + console.log('facebook enable'); + } + disableTwitter = () => { + console.log('twitter disable'); + } render() { const { me } = this.state; return ( @@ -45,29 +68,28 @@ export default class Settings extends React.Component { <h1>Settings</h1> <fieldset> <legend>Changing your avatar</legend> - <form> - <p>Avatar: <input type="file" name="avatar" /><br /> - <small>Recommendations: PNG, 96x96, <50Kb. Also, JPG and GIF supported.</small></p> - <p><input type="hidden" name="page" value="about" /> - <Button onClick={this.onSubmitAvatar}>Update</Button> - </p> - </form> + <form> + <p>Avatar: <input type="file" name="avatar" /><br /> + <small>Recommendations: PNG, 96x96, <50Kb. Also, JPG and GIF supported.</small></p> + <p><input type="hidden" name="page" value="about" /> + <Button onClick={this.onSubmitAvatar}>Update</Button> + </p> + </form> </fieldset> <fieldset> <legend>Changing your password</legend> <form> <p>Change password: <input type="password" name="password" size="8" onChange={this.passwordChanged} /> - <Button onClick={this.onSubmitPassword}>Update</Button><br /> + <Button onClick={this.onSubmitPassword}>Update</Button><br /> <i>(max. length - 16 symbols)</i></p> </form> </fieldset> <fieldset> <legend>Telegram</legend> {me.telegramName ? ( - <form action="/settings" method="post"> + <form> <div>Telegram: <b> {me.telegramName} </b>— - <input type="hidden" name="page" value="telegram-del" /> - <input type="submit" value=" Disable " /> + <Button onClick={this.disableTelegram}>Disable</Button> </div> </form> ) : ( @@ -122,7 +144,7 @@ export default class Settings extends React.Component { me.emails ? me.emails.map(email => <React.Fragment key={email}> <label> - <input type="radio" name="account" value="{{ email }}" />{email} + <input type="radio" name="account" value={email} />{email} </label> <br /> {me.emails.length > 1 && @@ -133,15 +155,16 @@ export default class Settings extends React.Component { } </p> </form> - {me.emails && + { + me.emails && <React.Fragment> {/** email_off **/} <form> You can receive notifications to email:<br /> - Sent to <select name="account"> + Sent to <select name="account" value={me.activeEmail} onChange={this.emailChanged}> <option value="">Disabled</option> {me.emails.map(email => - <option key={email} value={email} selected={me.activeEmail == email}> + <option key={email} value={email}> {email} </option> )} @@ -164,19 +187,17 @@ export default class Settings extends React.Component { </legend> {me.facebookStatus && me.facebookStatus.connected ? ( me.facebookStatus.crosspostEnabled ? - <form action="/settings" method="post"> + <form> <div> Facebook: <b>Enabled</b> — - <input type="hidden" name="page" value="facebook-disable" /> - <input type="submit" value=" Disable " /> + <Button onClick={this.disableFacebook}>Disable</Button> </div> </form> : - <form action="/settings" method="post"> + <form> <div> Facebook: <b>Disabled</b> — - <input type="hidden" name="page" value="facebook-enable" /> - <input type="submit" value=" Enable " /> + <Button onClick={this.enableFacebook}>Enable</Button> </div> </form> ) : ( @@ -197,7 +218,7 @@ export default class Settings extends React.Component { <form action="/settings" method="post"> <div>Twitter: <b>{me.twitterName}</b> — <input type="hidden" name="page" value="twitter-del" /> - <input type="submit" value=" Disable " /> + <Button onClick={this.disableTwitter}>Disable</Button> </div> </form> : |