From 715080416646204f7891cd5f1d1dae63bba3009d Mon Sep 17 00:00:00 2001 From: trazyn Date: Tue, 31 Oct 2017 23:57:30 +0800 Subject: [PATCH] format code --- src/js/components/Avatar/index.js | 4 +- src/js/components/Loader/index.js | 14 ++++- src/js/components/MessageInput/Emoji/index.js | 7 ++- src/js/components/MessageInput/index.js | 24 ++++---- src/js/components/Modal/index.js | 27 +++++++-- src/js/components/Offline/index.js | 10 +++- src/js/components/Snackbar/index.js | 15 ++++- src/js/components/Switch/index.js | 4 +- src/js/components/UserList/index.js | 24 +++++--- src/js/pages/AddFriend/index.js | 11 +++- src/js/pages/AddMember/index.js | 18 +++++- src/js/pages/BatchSend/index.js | 26 +++++---- src/js/pages/ConfirmImagePaste/index.js | 4 +- src/js/pages/Contacts/index.js | 27 ++++++--- src/js/pages/Footer/Contacts.js | 11 +++- src/js/pages/Footer/Settings.js | 10 +++- src/js/pages/Footer/index.js | 15 ++++- src/js/pages/Forward/index.js | 18 +++++- src/js/pages/Home/ChatContent/index.js | 25 ++++++--- src/js/pages/Home/Chats/index.js | 16 ++++-- src/js/pages/Home/SearchBar/index.js | 35 ++++++++---- src/js/pages/Home/index.js | 8 ++- src/js/pages/Layout.js | 15 +++-- src/js/pages/Login/index.js | 4 +- src/js/pages/Members/index.js | 26 +++++---- src/js/pages/NewChat/index.js | 18 +++++- src/js/pages/Settings/index.js | 56 +++++++++++++++---- src/js/pages/UserInfo/index.js | 40 ++++++++----- 28 files changed, 371 insertions(+), 141 deletions(-) diff --git a/src/js/components/Avatar/index.js b/src/js/components/Avatar/index.js index 6b77fde..54e7fcf 100644 --- a/src/js/components/Avatar/index.js +++ b/src/js/components/Avatar/index.js @@ -28,10 +28,10 @@ export default class Avatar extends Component { return ( this.handleError(e)} onLoad={e => this.handleLoad(e)} - onError={e => this.handleError(e)} /> + src={this.props.src} /> ); } } diff --git a/src/js/components/Loader/index.js b/src/js/components/Loader/index.js index 6b515db..0f28007 100644 --- a/src/js/components/Loader/index.js +++ b/src/js/components/Loader/index.js @@ -27,7 +27,14 @@ export default class Button extends Component { 'Loader--fullscreen': this.props.fullscreen })}> - + ); @@ -35,7 +42,10 @@ export default class Button extends Component { render() { return ( - + {this.renderContent()} ); diff --git a/src/js/components/MessageInput/Emoji/index.js b/src/js/components/MessageInput/Emoji/index.js index 72c60e8..6ee71e6 100644 --- a/src/js/components/MessageInput/Emoji/index.js +++ b/src/js/components/MessageInput/Emoji/index.js @@ -33,7 +33,12 @@ export default class Emoji extends Component { renderEmoji(emoji) { return emoji.map((e, index) => { var { key, className } = e; - return ; + return ( + + ); }); } diff --git a/src/js/components/MessageInput/index.js b/src/js/components/MessageInput/index.js index 20f5282..ab655b4 100644 --- a/src/js/components/MessageInput/index.js +++ b/src/js/components/MessageInput/index.js @@ -154,39 +154,39 @@ export default class MessageInput extends Component { this.handlePaste(e)} + onKeyPress={e => this.handleEnter(e)} placeholder="Type someting to send..." readOnly={!canisend} - onPaste={e => this.handlePaste(e)} - onKeyPress={e => this.handleEnter(e)} /> + ref="input" + type="text" />
canisend && this.refs.uploader.click()} /> canisend && this.toggleEmoji(true)} style={{ color: 'red', - }} - onClick={e => canisend && this.toggleEmoji(true)} /> + }} /> { this.batchProcess(e.target.files[0]); e.target.value = ''; }} + ref="uploader" style={{ display: 'none', - }} /> + }} + type="file" /> this.writeEmoji(emoji)} close={e => setTimeout(() => this.toggleEmoji(false), 100)} + output={emoji => this.writeEmoji(emoji)} show={this.state.showEmoji} />
diff --git a/src/js/components/Modal/index.js b/src/js/components/Modal/index.js index ceff937..d4e9e92 100644 --- a/src/js/components/Modal/index.js +++ b/src/js/components/Modal/index.js @@ -11,8 +11,13 @@ import { on, off } from 'utils/event'; class ModalBody extends Component { render() { return ( - -
+ +
{this.props.children}
@@ -61,7 +66,11 @@ class Modal extends Component { return; } - return (
); + return ( +
+ ); } renderBody() { @@ -98,11 +107,19 @@ class Modal extends Component { return (
- + {this.renderOverlay()} - + {this.renderBody()}
diff --git a/src/js/components/Offline/index.js b/src/js/components/Offline/index.js index 5d69058..33cb8c1 100644 --- a/src/js/components/Offline/index.js +++ b/src/js/components/Offline/index.js @@ -17,10 +17,16 @@ export default class Avatar extends Component { if (!this.props.show) return false; return ( -
+
- + +

Oops, seems like you are offline!

+
diff --git a/src/js/components/Snackbar/index.js b/src/js/components/Snackbar/index.js index 652b9da..7c1f56d 100644 --- a/src/js/components/Snackbar/index.js +++ b/src/js/components/Snackbar/index.js @@ -19,15 +19,24 @@ export default class Snackbar extends Component { return (
-
-
this.props.close()}>DONE
+
+
this.props.close()}> + DONE +
); } render() { return ( - + {this.renderContent()} ); diff --git a/src/js/components/Switch/index.js b/src/js/components/Switch/index.js index 60dbc3d..a52fef3 100644 --- a/src/js/components/Switch/index.js +++ b/src/js/components/Switch/index.js @@ -8,7 +8,9 @@ export default class Switch extends Component { render() { return ( - + ); diff --git a/src/js/components/UserList/index.js b/src/js/components/UserList/index.js index 9fcc1c5..ec39025 100644 --- a/src/js/components/UserList/index.js +++ b/src/js/components/UserList/index.js @@ -153,15 +153,19 @@ export default class UserList extends Component { return list.map((e, index) => { return (
  • this.toggleSelected(e.UserName)}> - - + +
  • @@ -173,14 +177,16 @@ export default class UserList extends Component { return (
    this.navigation(e)} onInput={e => this.search(e.target.value)} - autoFocus={true} /> + placeholder="Type to Search..." + ref="input" + type="text" /> -
      +
        {this.renderList()}
    diff --git a/src/js/pages/AddFriend/index.js b/src/js/pages/AddFriend/index.js index 95abf11..5a8ce07 100644 --- a/src/js/pages/AddFriend/index.js +++ b/src/js/pages/AddFriend/index.js @@ -22,11 +22,18 @@ export default class AddFriend extends Component { var { me, show, close } = this.props; return ( - close()}> + close()} + show={show}> Send friend request first - +
    diff --git a/src/js/pages/AddMember/index.js b/src/js/pages/AddMember/index.js index cbb8884..b6f5e05 100644 --- a/src/js/pages/AddMember/index.js +++ b/src/js/pages/AddMember/index.js @@ -83,7 +83,10 @@ export default class AddMember extends Component { render() { return ( - this.close()}> + this.close()} + show={this.props.show}> Add Members @@ -91,7 +94,12 @@ export default class AddMember extends Component { { this.state.selected.map((e, index) => { var user = this.props.getUser(e); - return this.refs.users.removeSelected(e)} />; + return ( + this.refs.users.removeSelected(e)} + src={user.HeadImgUrl} /> + ); }) }
    @@ -99,7 +107,11 @@ export default class AddMember extends Component { {this.renderList()}
    - +
    diff --git a/src/js/pages/BatchSend/index.js b/src/js/pages/BatchSend/index.js index d5f5c8d..cc8b4a7 100644 --- a/src/js/pages/BatchSend/index.js +++ b/src/js/pages/BatchSend/index.js @@ -101,21 +101,23 @@ export default class BatchSend extends Component {
    ); diff --git a/src/js/pages/NewChat/index.js b/src/js/pages/NewChat/index.js index 3c43c81..50bfc03 100644 --- a/src/js/pages/NewChat/index.js +++ b/src/js/pages/NewChat/index.js @@ -87,7 +87,10 @@ export default class NewChat extends Component { render() { return ( - this.props.close()}> + this.props.close()} + show={this.props.show}> New Chat ({this.state.selected.length} / 20) @@ -95,7 +98,12 @@ export default class NewChat extends Component { { this.state.selected.map((e, index) => { var user = this.props.getUser(e); - return this.refs.users.removeSelected(e)} />; + return ( + this.refs.users.removeSelected(e)} + src={user.HeadImgUrl} /> + ); }) }
    this.search(e.target.value)} - placeholder="Batch to send message, Choose one or more user." /> + placeholder="Batch to send message, Choose one or more user." + type="text" /> this.selectAll()} className={clazz('icon-ion-android-done-all', { [classes.active]: this.state.selected.length === contacts.length })} + onClick={() => this.selectAll()} style={{ marginRight: 20, }} /> - this.close()} /> + this.close()} />
    @@ -133,12 +135,16 @@ export default class BatchSend extends Component { (searching ? filtered : contacts).map((e, index) => { return (
  • this.handleSelected(e)} - key={index}> -
    - + key={index} + onClick={() => this.handleSelected(e)}> +
    + { this.state.selected.find(user => user.UserName === e.UserName) && ( diff --git a/src/js/pages/ConfirmImagePaste/index.js b/src/js/pages/ConfirmImagePaste/index.js index 48625b5..69e1ddb 100644 --- a/src/js/pages/ConfirmImagePaste/index.js +++ b/src/js/pages/ConfirmImagePaste/index.js @@ -28,7 +28,9 @@ export default class ConfirmImagePaste extends Component { var { show, cancel, ok, image } = this.props; return ( - + Send image ? diff --git a/src/js/pages/Contacts/index.js b/src/js/pages/Contacts/index.js index a6978dd..128d0fb 100644 --- a/src/js/pages/Contacts/index.js +++ b/src/js/pages/Contacts/index.js @@ -19,7 +19,9 @@ export default class Contacts extends Component { return list.map((e, index) => { return ( -
    +
    @@ -38,16 +40,25 @@ export default class Contacts extends Component { { e.list.map((e, index) => { return ( -
    this.props.showUserinfo(true, e)}> +
    this.props.showUserinfo(true, e)}>
    - +
    -

    -

    +

    +

    ); diff --git a/src/js/pages/Footer/Contacts.js b/src/js/pages/Footer/Contacts.js index f25a996..377e5c7 100644 --- a/src/js/pages/Footer/Contacts.js +++ b/src/js/pages/Footer/Contacts.js @@ -35,12 +35,19 @@ export default class Filter extends Component { render() { return (
    - this.doFilter(e.target.value)} /> + this.doFilter(e.target.value)} + placeholder="Type someting to search..." + ref="filter" + type="text" />
    diff --git a/src/js/pages/Footer/Settings.js b/src/js/pages/Footer/Settings.js index 38e6f32..f886f9b 100644 --- a/src/js/pages/Footer/Settings.js +++ b/src/js/pages/Footer/Settings.js @@ -7,12 +7,18 @@ export default class Placeholder extends Component { render() { return (
    - + Send feedback - + Fork on Github diff --git a/src/js/pages/Footer/index.js b/src/js/pages/Footer/index.js index 1079c30..9d0a14b 100644 --- a/src/js/pages/Footer/index.js +++ b/src/js/pages/Footer/index.js @@ -20,7 +20,10 @@ export default class Footer extends Component { return (
    @@ -89,7 +97,11 @@ export default class Forward extends Component { {this.renderList()}
    - +
    diff --git a/src/js/pages/Home/ChatContent/index.js b/src/js/pages/Home/ChatContent/index.js index db38a5f..46113f5 100644 --- a/src/js/pages/Home/ChatContent/index.js +++ b/src/js/pages/Home/ChatContent/index.js @@ -626,19 +626,26 @@ export default class ChatContent extends Component {
    -

    +

    this.props.showMembers(user)} - dangerouslySetInnerHTML={{__html: signature || 'No Signature'}} /> + title={signature} />

    - this.showMenu()} /> + this.showMenu()} />
    -
    this.handleScroll(e)}> +
    this.handleScroll(e)} + ref="viewport"> { this.renderMessages(messages.get(user.UserName), user) } @@ -648,15 +655,17 @@ export default class ChatContent extends Component {
    - +

    No Chat selected :(

    ) }
    + className={classes.tips} + ref="tips"> Unread message.
    diff --git a/src/js/pages/Home/Chats/index.js b/src/js/pages/Home/Chats/index.js index e130c0d..8659b6f 100644 --- a/src/js/pages/Home/Chats/index.js +++ b/src/js/pages/Home/Chats/index.js @@ -110,7 +110,9 @@ export default class Chats extends Component { return (
    -
    +
    { !searching && chats.map((e, index) => { var message = this.getTheLastestMessage(e.UserName) || {}; @@ -131,13 +133,19 @@ export default class Chats extends Component { [classes.green]: !muted && this.hasUnreadMessage(e.UserName), [classes.red]: muted && this.hasUnreadMessage(e.UserName) })}> - +
    -

    +

    - +

    diff --git a/src/js/pages/Home/SearchBar/index.js b/src/js/pages/Home/SearchBar/index.js index 4fed7da..ff68760 100644 --- a/src/js/pages/Home/SearchBar/index.js +++ b/src/js/pages/Home/SearchBar/index.js @@ -121,13 +121,19 @@ export default class SearchBar extends Component { renderUser(user) { return ( -
    this.chatTo(user)} data-userid={user.UserName}> +
    this.chatTo(user)} data-userid={user.UserName}>
    -

    +

    - +

    ); @@ -160,7 +166,11 @@ export default class SearchBar extends Component {

    History

    - this.props.clear(e)}>CLEAR + this.props.clear(e)}> + CLEAR +
    { list.map((e, index) => { @@ -195,17 +205,18 @@ export default class SearchBar extends Component { this.navigation(e)} - onFocus={e => this.filter(e.target.value)} onBlur={e => this.handleBlur(e.target.value)} - onInput={e => this.filter(e.target.value)} /> - + onFocus={e => this.filter(e.target.value)} + onInput={e => this.filter(e.target.value)} + onKeyUp={e => this.navigation(e)} + placeholder="Search ..." + ref="search" + type="text" /> { searching && ( -
    +
    { !result.query && (history.length ? this.renderHistory(history) : this.renderPlaceholder()) } diff --git a/src/js/pages/Home/index.js b/src/js/pages/Home/index.js index 1ff8bd9..20acaba 100644 --- a/src/js/pages/Home/index.js +++ b/src/js/pages/Home/index.js @@ -25,7 +25,9 @@ export default class Home extends Component { render() { return (
    - +
    @@ -35,7 +37,9 @@ export default class Home extends Component { { this.props.showRedIcon && ( -
    this.props.newChat()}> +
    this.props.newChat()}>
    ) diff --git a/src/js/pages/Layout.js b/src/js/pages/Layout.js index 20db5f6..1d9f4ab 100644 --- a/src/js/pages/Layout.js +++ b/src/js/pages/Layout.js @@ -70,7 +70,8 @@ export default class Layout extends Component { let node = e.target; while (node) { - if (node.nodeName.match(/^(input|textarea)$/i) || node.isContentEditable) { + if (node.nodeName.match(/^(input|textarea)$/i) + || node.isContentEditable) { menu.popup(remote.getCurrentWindow()); break; } @@ -160,10 +161,14 @@ export default class Layout extends Component {
    -
    +
    {this.props.children}
    -
    +
    @@ -175,7 +180,9 @@ export default class Layout extends Component { ; -
    +
    diff --git a/src/js/pages/Login/index.js b/src/js/pages/Login/index.js index e33c61e..4b7f45d 100644 --- a/src/js/pages/Login/index.js +++ b/src/js/pages/Login/index.js @@ -19,7 +19,9 @@ export default class Login extends Component { return (
    { - + }

    Scan successful

    diff --git a/src/js/pages/Members/index.js b/src/js/pages/Members/index.js index fdfe784..c7be25b 100644 --- a/src/js/pages/Members/index.js +++ b/src/js/pages/Members/index.js @@ -57,7 +57,9 @@ export default class Members extends Component { marginRight: 20, }} /> - this.props.close()} /> + this.props.close()} />
    @@ -87,10 +89,14 @@ export default class Members extends Component { ${frontColor[2]} )`, }}> -
    - +
    +
  • ); }) @@ -99,13 +105,13 @@ export default class Members extends Component {
    this.props.search(e.target.value)} /> + onInput={e => this.props.search(e.target.value)} + placeholder="Type someting to search..." + ref="input" + type="text" />
    @@ -103,7 +111,11 @@ export default class NewChat extends Component { {this.renderList()}
    - +
    diff --git a/src/js/pages/Settings/index.js b/src/js/pages/Settings/index.js index 6e9f8b8..162452a 100644 --- a/src/js/pages/Settings/index.js +++ b/src/js/pages/Settings/index.js @@ -36,7 +36,9 @@ export default class Settings extends Component { renderPlugins(plugins) { return plugins.map((e, index) => { return ( -
    +
    @@ -45,7 +47,11 @@ export default class Settings extends Component { {e.version}

    - View on Github + + View on Github +

    {e.description}
    @@ -104,7 +110,10 @@ export default class Settings extends Component { }
  • - setDownloads(e.target.files[0])} /> + setDownloads(e.target.files[0])} + ref="downloads" + type="file" />

    Downloads

    this.choiceDownloadDir()}>{downloads}

    @@ -114,56 +123,81 @@ export default class Settings extends Component {
  • diff --git a/src/js/pages/UserInfo/index.js b/src/js/pages/UserInfo/index.js index 087c0cc..22e1412 100644 --- a/src/js/pages/UserInfo/index.js +++ b/src/js/pages/UserInfo/index.js @@ -130,7 +130,9 @@ export default class UserInfo extends Component { } return ( - this.handleClose()}> + this.handleClose()} + show={this.props.show}>
    this.toggleEdit()}> +
    this.toggleEdit()}>
    ) }
    -
    +
    -
    +
    { !this.props.remove ? ( @@ -172,7 +180,9 @@ export default class UserInfo extends Component {

    - + {City || 'UNKNOW'}, {Province || 'UNKNOW'}
    @@ -180,13 +190,13 @@ export default class UserInfo extends Component { ) : (
    this.props.removeMember(this.props.user)} style={{ color: buttonColor, opacity: .6, marginTop: 20, marginBottom: -30, - }} - onClick={() => this.props.removeMember(this.props.user)}> + }}> Delete
    ) @@ -194,11 +204,11 @@ export default class UserInfo extends Component {
    this.handleAction(this.props.user)} style={{ color: buttonColor, opacity: .6, - }} - onClick={() => this.handleAction(this.props.user)}> + }}> {helper.isChatRoom(UserName) || isFriend ? 'Send Message' : 'Add Friend'}
    @@ -207,12 +217,12 @@ export default class UserInfo extends Component { /* eslint-disable */ this.state.showEdit && ( this.handleEnter(e)} /> + onKeyPress={e => this.handleEnter(e)} + placeholder="Type the remark name" + ref="input" + type="text" /> ) /* eslint-enable */ }