From 89a44d590cdf63005998450017e7bf337635c779 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 20 May 2019 00:27:28 +0300 Subject: [PATCH] Code style --- DropDownBase.js | 2 +- DropDownMenu.js | 18 +++--- ListSortSettings.js | 2 +- MessageList.js | 88 ++++++++++++++------------- MessageView.js | 144 ++++++++++++++++++++++---------------------- 5 files changed, 127 insertions(+), 127 deletions(-) diff --git a/DropDownBase.js b/DropDownBase.js index 3afd678..5481bbf 100644 --- a/DropDownBase.js +++ b/DropDownBase.js @@ -109,7 +109,7 @@ function getOffset(elem) else { let top = 0, left = 0; - while(elem) + while (elem) { top = top + parseInt(elem.offsetTop); left = left + parseInt(elem.offsetLeft); diff --git a/DropDownMenu.js b/DropDownMenu.js index 6d2c7d9..0e8df05 100644 --- a/DropDownMenu.js +++ b/DropDownMenu.js @@ -12,16 +12,14 @@ export default class DropDownMenu extends DropDownBase return
- {this.state.items.map(function(i, index) { - return (i.split - ?
: -
- {i.hotkey ?
{i.hotkey}
: null} - {i.icon ? : null} - {i.text} -
- ); - })} + {this.state.items.map((i, index) => (i.split + ?
+ :
+ {i.hotkey ?
{i.hotkey}
: null} + {i.icon ? : null} + {i.text} +
+ ))}
} diff --git a/ListSortSettings.js b/ListSortSettings.js index fe24b33..ba96772 100644 --- a/ListSortSettings.js +++ b/ListSortSettings.js @@ -6,7 +6,7 @@ export default class ListSortSettings extends React.PureComponent { return
diff --git a/MessageList.js b/MessageList.js index 4395e87..880246b 100644 --- a/MessageList.js +++ b/MessageList.js @@ -219,11 +219,52 @@ export default class MessageList extends ListWithSelection this._searchTimeout = setTimeout(() => this.props.search(s), 300); } + renderGroup = (grp, i) => + { + if (i > 0) + { + this.total++; + } + let start = this.total+(this.state.firstGrp == i ? this.state.firstMsg : 0); + let r = [ + i > 0 ?
{grp.name.toUpperCase()}
: null, +
+ {(this.state.firstGrp > i || this.state.lastGrp < i + ?
+ : [ + (this.state.firstGrp == i + ?
+ : null), + this.getMessages(grp, + this.state.firstGrp == i ? this.state.firstMsg : 0, + this.state.lastGrp == i ? this.state.lastMsg+1 : grp.messageCount + ).map((msg, j) => (msg + ? [ + , + /*(msg.thread && this.props.threads ? +
+ {msg.thread.map(reply => )} +
+ : null)*/ + ] + :
+ )), + (this.state.lastGrp == i + ?
+ : null) + ] + )} +
+ ]; + this.total += grp.messageCount; + return r; + } + render() { - let total = 0; - let itemH = (this.props.layout == 'message-on-right' ? 60 : 30); - return
+ this.itemH = (this.props.layout == 'message-on-right' ? 60 : 30); + this.total = 0; + return (
@@ -243,46 +284,9 @@ export default class MessageList extends ListWithSelection style={{ top: this.state.firstDayTop, display: this.state.firstDay ? '' : 'none' }}> {(this.state.firstDay||'').toUpperCase()}
- {(this.props.groups||[]).map((grp, i) => - { - if (i > 0) - total++; - let start = total+(this.state.firstGrp == i ? this.state.firstMsg : 0); - let r = [ - i > 0 ?
{grp.name.toUpperCase()}
: null, -
- {(this.state.firstGrp > i || this.state.lastGrp < i - ?
- : [ - (this.state.firstGrp == i - ?
- : null), - this.getMessages(grp, - this.state.firstGrp == i ? this.state.firstMsg : 0, - this.state.lastGrp == i ? this.state.lastMsg+1 : grp.messageCount - ).map((msg, j) => (msg - ? [ - , - /*(msg.thread && this.props.threads ? -
- {msg.thread.map(reply => )} -
- : null)*/ - ] - :
- )), - (this.state.lastGrp == i - ?
- : null) - ] - )} -
- ]; - total += grp.messageCount; - return r; - })} + {(this.props.groups||[]).map(this.renderGroup)}
-
+
); } componentDidMount() diff --git a/MessageView.js b/MessageView.js index a8ba057..1c5bc3e 100644 --- a/MessageView.js +++ b/MessageView.js @@ -73,82 +73,80 @@ export default class MessageView extends React.PureComponent
{msg ? [ -
-
-
-
{this.formatLongDate(msg.time)}
-
{msg.subject}
-
-
-
-
From
-
{msg.props.from ? msg.props.from[0]+' <'+msg.props.from[1]+'>' : 'unknown'}
+
+
+
+
{this.formatLongDate(msg.time)}
+
{msg.subject}
-
-
To
-
- {msg.props.to.map(a => ' : a[1]}>{a[0] || a[1]})} +
+ +
+
To
+
+ {msg.props.to.map(a => ' : a[1]}>{a[0] || a[1]})} +
+
+ {msg.props.cc.length + ?
+
Cc
+
+ {msg.props.cc.map(a => ' : a[1]}>{a[0] || a[1]})} +
+
+ : null} + {msg.props.bcc.length + ?
+
Bcc
+
+ {msg.props.bcc.map(a => ' : a[1]}>{a[0] || a[1]})} +
+
+ : null} + {msg.props.replyto + ?
+
Reply-to
+
+ {[msg.props.replyto].map(a => ' : a[1]}>{a[0] || a[1]})} +
+
+ : null} + {msg.props.attachments && msg.props.attachments.length + ?
+
Attachments
+
+ {msg.props.attachments.map(a => ( + + {a.name+' ('+Util.formatBytes(a.size)+')'} + + ))} +
+
+ : null} +
+
, + (this.state.blockedImages && !this.state.showImages + ?
+ This message contains blocked images. + Load Images + {(msg.props.from ? : null)} +
+ : null), + (html + ?
+ :
{msg.body_text}
), + (this.props.quickReply + ? - {msg.props.cc.length ? -
-
Cc
-
- {msg.props.cc.map(a => ' : a[1]}>{a[0] || a[1]})} -
-
- : null} - {msg.props.bcc.length ? -
-
Bcc
-
- {msg.props.bcc.map(a => ' : a[1]}>{a[0] || a[1]})} -
-
- : null} - {msg.props.replyto ? -
-
Reply-to
-
- {[msg.props.replyto].map(a => ' : a[1]}>{a[0] || a[1]})} -
-
- : null} - {msg.props.attachments && msg.props.attachments.length ? -
-
Attachments
-
- {msg.props.attachments.map(a => ( - - {a.name+' ('+Util.formatBytes(a.size)+')'} - - ))} -
-
- : null} -
-
, - (this.state.blockedImages && !this.state.showImages - ?
- This message contains blocked images. - Load Images - {(msg.props.from ? : null)} -
- : null), - (html - ?
- :
{msg.body_text}
- ), - (this.props.quickReply - ?
- - -
- : null - ) + : null), ] : null}
}