Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Oct 31, 2017
1 parent 814faeb commit 7150804
Show file tree
Hide file tree
Showing 28 changed files with 371 additions and 141 deletions.
4 changes: 2 additions & 2 deletions src/js/components/Avatar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export default class Avatar extends Component {
return (
<img
className={`Avatar fade fadein ${this.props.className}`}
src={this.props.src}
onClick={this.props.onClick}
onError={e => this.handleError(e)}
onLoad={e => this.handleLoad(e)}
onError={e => this.handleError(e)} />
src={this.props.src} />
);
}
}
14 changes: 12 additions & 2 deletions src/js/components/Loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ export default class Button extends Component {
'Loader--fullscreen': this.props.fullscreen
})}>
<svg className="Loader-circular">
<circle className="Loader-path" cx="50" cy="50" r="20" fill="none" strokeWidth="5" strokeMiterlimit="10" />
<circle
className="Loader-path"
cx="50"
cy="50"
fill="none"
r="20"
strokeWidth="5"
strokeMiterlimit="10" />
</svg>
</div>
);
}

render() {
return (
<Transition transitionName="Loader" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
<Transition
transitionName="Loader"
transitionEnterTimeout={200}
transitionLeaveTimeout={200}>
{this.renderContent()}
</Transition>
);
Expand Down
7 changes: 6 additions & 1 deletion src/js/components/MessageInput/Emoji/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export default class Emoji extends Component {
renderEmoji(emoji) {
return emoji.map((e, index) => {
var { key, className } = e;
return <a key={index} title={key} className={className} />;
return (
<a
className={className}
key={index}
title={key} />
);
});
}

Expand Down
24 changes: 12 additions & 12 deletions src/js/components/MessageInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,39 +154,39 @@ export default class MessageInput extends Component {
</div>
<input
id="messageInput"
type="text"
ref="input"
onPaste={e => 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" />

<div className={classes.action}>
<i
id="showUploader"
className="icon-ion-android-attach"
id="showUploader"
onClick={e => canisend && this.refs.uploader.click()} />
<i
id="showEmoji"
className="icon-ion-ios-heart"
id="showEmoji"
onClick={e => canisend && this.toggleEmoji(true)}
style={{
color: 'red',
}}
onClick={e => canisend && this.toggleEmoji(true)} />
}} />

<input
type="file"
ref="uploader"
onChange={e => {
this.batchProcess(e.target.files[0]);
e.target.value = '';
}}
ref="uploader"
style={{
display: 'none',
}} />
}}
type="file" />
<Emoji
output={emoji => this.writeEmoji(emoji)}
close={e => setTimeout(() => this.toggleEmoji(false), 100)}
output={emoji => this.writeEmoji(emoji)}
show={this.state.showEmoji} />
</div>
</div>
Expand Down
27 changes: 22 additions & 5 deletions src/js/components/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import { on, off } from 'utils/event';
class ModalBody extends Component {
render() {
return (
<Transition transitionName="fade" transitionEnterTimeout={1000} transitionLeaveTimeout={1000}>
<div className={clazz('Modal-body', this.props.className)} style={this.props.style}>
<Transition
transitionName="fade"
transitionEnterTimeout={1000}
transitionLeaveTimeout={1000}>
<div
className={clazz('Modal-body', this.props.className)}
style={this.props.style}>
{this.props.children}
</div>
</Transition>
Expand Down Expand Up @@ -61,7 +66,11 @@ class Modal extends Component {
return;
}

return (<div className={clazz('Modal-overlay', this.props.className)} onClick={this.props.onCancel} />);
return (
<div
className={clazz('Modal-overlay', this.props.className)}
onClick={this.props.onCancel} />
);
}

renderBody() {
Expand Down Expand Up @@ -98,11 +107,19 @@ class Modal extends Component {

return (
<div className="Modal" ref="node">
<Transition transitionName={this.props.transition4overlay} transitionEnterTimeout={200} transitionLeaveTimeout={200} ref="overlay">
<Transition
transitionName={this.props.transition4overlay}
transitionEnterTimeout={200}
transitionLeaveTimeout={200}
ref="overlay">
{this.renderOverlay()}
</Transition>

<TransitionPortal transitionName={this.props.transition4body} transitionEnterTimeout={200} transitionLeaveTimeout={140} ref="content">
<TransitionPortal
transitionName={this.props.transition4body}
transitionEnterTimeout={200}
transitionLeaveTimeout={140}
ref="content">
{this.renderBody()}
</TransitionPortal>
</div>
Expand Down
10 changes: 8 additions & 2 deletions src/js/components/Offline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ export default class Avatar extends Component {
if (!this.props.show) return false;

return (
<div className={classes.container} {...this.props}>
<div
className={classes.container}
{...this.props}>
<div>
<img src="assets/images/offline.png" className="disabledDrag" />
<img
className="disabledDrag"
src="assets/images/offline.png" />

<h1>Oops, seems like you are offline!</h1>

<button onClick={e => window.location.reload()}>Reload</button>
</div>
</div>
Expand Down
15 changes: 12 additions & 3 deletions src/js/components/Snackbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@ export default class Snackbar extends Component {

return (
<div className="Snackbar">
<div className="Snackbar-text" dangerouslySetInnerHTML={{__html: this.props.text}} />
<div className="Snackbar-action" onClick={() => this.props.close()}>DONE</div>
<div
className="Snackbar-text"
dangerouslySetInnerHTML={{__html: this.props.text}} />
<div
className="Snackbar-action"
onClick={() => this.props.close()}>
DONE
</div>
</div>
);
}

render() {
return (
<TransitionPortal transitionEnterTimeout={0} transitionLeaveTimeout={150} transitionName="Snackbar">
<TransitionPortal
transitionEnterTimeout={0}
transitionLeaveTimeout={150}
transitionName="Snackbar">
{this.renderContent()}
</TransitionPortal>
);
Expand Down
4 changes: 3 additions & 1 deletion src/js/components/Switch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export default class Switch extends Component {
render() {
return (
<span className="Switch">
<input type="checkbox" {...blacklist(this.props, 'className', 'children')} />
<input
{...blacklist(this.props, 'className', 'children')}
type="checkbox" />
<span className="Switch--fake" />
</span>
);
Expand Down
24 changes: 15 additions & 9 deletions src/js/components/UserList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,19 @@ export default class UserList extends Component {
return list.map((e, index) => {
return (
<li
key={index}
data-userid={e.UserName}
className={clazz({
[classes.selected]: this.state.selected.includes(e.UserName),
[classes.active]: this.state.active === e.UserName,
})}
data-userid={e.UserName}
key={index}
onClick={ev => this.toggleSelected(e.UserName)}>
<img src={e.HeadImgUrl} className={classes.avatar} />
<span className={classes.username} dangerouslySetInnerHTML={{__html: e.RemarkName || e.NickName}} />
<img
className={classes.avatar}
src={e.HeadImgUrl} />
<span
className={classes.username}
dangerouslySetInnerHTML={{__html: e.RemarkName || e.NickName}} />

<i className="icon-ion-android-done-all" />
</li>
Expand All @@ -173,14 +177,16 @@ export default class UserList extends Component {
return (
<div className={classes.container}>
<input
ref="input"
type="text"
placeholder="Type to Search..."
autoFocus={true}
onKeyUp={e => this.navigation(e)}
onInput={e => this.search(e.target.value)}
autoFocus={true} />
placeholder="Type to Search..."
ref="input"
type="text" />

<ul className={classes.list} ref="list">
<ul
className={classes.list}
ref="list">
{this.renderList()}
</ul>
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/js/pages/AddFriend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ export default class AddFriend extends Component {
var { me, show, close } = this.props;

return (
<Modal show={show} fullscreen={true} onCancel={e => close()}>
<Modal
fullscreen={true}
onCancel={e => close()}
show={show}>
<ModalBody className={classes.container}>
Send friend request first

<input type="text" defaultValue={`Hallo, im ${me && me.User.NickName}`} autoFocus={true} ref="input" />
<input
autoFocus={true}
defaultValue={`Hallo, im ${me && me.User.NickName}`}
ref="input"
type="text" />

<div>
<button onClick={e => this.addFriend()}>Send</button>
Expand Down
18 changes: 15 additions & 3 deletions src/js/pages/AddMember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,35 @@ export default class AddMember extends Component {

render() {
return (
<Modal show={this.props.show} fullscreen={true} onCancel={e => this.close()}>
<Modal
fullscreen={true}
onCancel={e => this.close()}
show={this.props.show}>
<ModalBody className={classes.container}>
Add Members

<div className={classes.avatars}>
{
this.state.selected.map((e, index) => {
var user = this.props.getUser(e);
return <img src={user.HeadImgUrl} key={index} onClick={ev => this.refs.users.removeSelected(e)} />;
return (
<img
key={index}
onClick={ev => this.refs.users.removeSelected(e)}
src={user.HeadImgUrl} />
);
})
}
</div>

{this.renderList()}

<div>
<button onClick={e => this.add(this.state.selected)} disabled={!this.state.selected.length}>Add</button>
<button
disabled={!this.state.selected.length}
onClick={e => this.add(this.state.selected)}>
Add
</button>

<button onClick={e => this.close()}>Cancel</button>
</div>
Expand Down
26 changes: 16 additions & 10 deletions src/js/pages/BatchSend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,23 @@ export default class BatchSend extends Component {
<div className={classes.container}>
<header>
<input
type="text"
autoFocus={true}
onInput={e => 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" />

<span>
<i
onClick={() => this.selectAll()}
className={clazz('icon-ion-android-done-all', {
[classes.active]: this.state.selected.length === contacts.length
})}
onClick={() => this.selectAll()}
style={{
marginRight: 20,
}} />
<i className="icon-ion-android-close" onClick={e => this.close()} />
<i
className="icon-ion-android-close"
onClick={e => this.close()} />
</span>
</header>

Expand All @@ -133,12 +135,16 @@ export default class BatchSend extends Component {
(searching ? filtered : contacts).map((e, index) => {
return (
<li
onClick={() => this.handleSelected(e)}
key={index}>
<div className={classes.cover} style={{
backgroundImage: `url(${e.HeadImgUrl})`,
}} />
<span className={classes.username} dangerouslySetInnerHTML={{ __html: e.RemarkName || e.NickName }} />
key={index}
onClick={() => this.handleSelected(e)}>
<div
className={classes.cover}
style={{
backgroundImage: `url(${e.HeadImgUrl})`,
}} />
<span
className={classes.username}
dangerouslySetInnerHTML={{ __html: e.RemarkName || e.NickName }} />

{
this.state.selected.find(user => user.UserName === e.UserName) && (
Expand Down
4 changes: 3 additions & 1 deletion src/js/pages/ConfirmImagePaste/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default class ConfirmImagePaste extends Component {
var { show, cancel, ok, image } = this.props;

return (
<Modal show={show} fullscreen={true}>
<Modal
fullscreen={true}
show={show}>
<ModalBody className={classes.container}>
Send image ?

Expand Down
Loading

0 comments on commit 7150804

Please sign in to comment.