diff options
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/api/index.js | 6 | ||||
-rw-r--r-- | vnext/src/ui/Settings.js | 53 |
2 files changed, 33 insertions, 26 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js index f2112dda..31bb3096 100644 --- a/vnext/src/api/index.js +++ b/vnext/src/api/index.js @@ -25,6 +25,12 @@ const apiBaseUrl = 'https://juick.com'; * @typedef {Object} SecureUserProperties * @property {string=} hash * @property {Token[]=} tokens + * @property {string=} telegramName + * @property {string=} twitterName + * @property {string[]=} jids + * @property {string[]=} emails + * @property {string=} activeEmail + * @property {{connected: boolean, crosspostEnabled: boolean}=} facebookStatus */ /** diff --git a/vnext/src/ui/Settings.js b/vnext/src/ui/Settings.js index 72537d86..c16a8289 100644 --- a/vnext/src/ui/Settings.js +++ b/vnext/src/ui/Settings.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef } from 'react'; +import React, { useState, useRef } from 'react'; import { me, updateAvatar } from '../api'; @@ -8,7 +8,7 @@ import UploadButton from './UploadButton'; import Avatar from './Avatar'; /** - * @param {{ visitor: import('../api').User, onChange: function }} props + * @param {{ visitor: import('../api').SecureUser, onChange: React.ChangeEvent<import('../api').SecureUser> }} props */ function ChangeAvatarForm({ visitor, onChange }) { const [avatar, setAvatar] = useState(''); @@ -53,7 +53,7 @@ function ChangeAvatarForm({ visitor, onChange }) { } /** - * @param {{ visitor: import('../api').User, onChange: React.ChangeEvent }} props + * @param {{ visitor: import('../api').SecureUser, onChange: React.ChangeEvent<import('../api').SecureUser> }} props */ export default function Settings({ visitor, onChange }) { @@ -105,7 +105,7 @@ export default function Settings({ visitor, onChange }) { <fieldset> <legend><Icon name="ei-unlock" size="m" />Changing your password</legend> <form> - <p>Change password: <input type="password" name="password" size="8" + <p>Change password: <input type="password" name="password" size={8} onChange={passwordChanged} /> <Button onClick={onSubmitPassword}>Update</Button><br /> <i>(max. length - 16 symbols)</i></p> @@ -124,30 +124,31 @@ export default function Settings({ visitor, onChange }) { </p> )} </fieldset> - {me.jids && ( - <form> - <fieldset> - <legend>XMPP accounts + { + visitor.jids && ( + <form> + <fieldset> + <legend>XMPP accounts </legend> - <p>Your accounts:</p> - <p> + <p>Your accounts:</p> + <p> + { + visitor.jids.map(jid => + <React.Fragment key={jid}> + <label><input type="radio" name="delete" value={jid} />{jid}</label><br /> + </React.Fragment> + ) + } + </p> { - visitor.jids.map(jid => - <React.Fragment key={jid}> - <label><input type="radio" name="delete" value={jid} />{jid}</label><br /> - </React.Fragment> - ) + visitor.jids && visitor.jids.length > 1 && + <p><Button onClick={deleteJid}>Delete</Button></p> } - </p> - { - visitor.jids && visitor.jids.length > 1 && - <p><Button onClick={deleteJid}>Delete</Button></p> - } - <p>To add new jabber account: send any text message to <span><a href="xmpp:juick@juick.com?message;body=login">juick@juick.com</a></span> - </p> - </fieldset> - </form> - )} + <p>To add new jabber account: send any text message to <span><a href="xmpp:juick@juick.com?message;body=login">juick@juick.com</a></span> + </p> + </fieldset> + </form> + )} <fieldset> <legend><Icon name="ei-envelope" size="m" />E-mail</legend> <form> @@ -182,7 +183,7 @@ export default function Settings({ visitor, onChange }) { {/** email_off **/} <form> You can receive notifications to email:<br /> - Sent to <select name="account" value={me.activeEmail || 'Disabled'} onChange={emailChanged}> + Sent to <select name="account" value={visitor.activeEmail || 'Disabled'} onChange={emailChanged}> <option value="">Disabled</option> { visitor.emails.map(email => |