mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Display last event time when folding messages
This commit is contained in:
parent
2bc89a6655
commit
8b20b463ff
1 changed files with 18 additions and 1 deletions
|
@ -172,6 +172,7 @@ class FoldGroup extends Component {
|
|||
|
||||
render() {
|
||||
var msgs = this.props.messages;
|
||||
var buf = this.props.buffer;
|
||||
|
||||
var onNickClick = this.props.onNickClick;
|
||||
function createNick(nick) {
|
||||
|
@ -189,9 +190,25 @@ class FoldGroup extends Component {
|
|||
}
|
||||
});
|
||||
|
||||
var lastMsg = msgs[msgs.length - 1];
|
||||
var firstDate = new Date(msgs[0].tags.time);
|
||||
var lastDate = new Date(lastMsg.tags.time);
|
||||
var timestamp = html`
|
||||
<${Timestamp} date=${firstDate} url=${getMessageURL(buf, msgs[0])}/>
|
||||
`;
|
||||
if (lastDate - firstDate > 60 * 100) {
|
||||
timestamp = [
|
||||
timestamp,
|
||||
" — ",
|
||||
html`
|
||||
<${Timestamp} date=${lastDate} url=${getMessageURL(buf, lastMsg)}/>
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
return html`
|
||||
<div class="logline" data-key=${msgs[0].key}>
|
||||
<${Timestamp} date=${new Date(msgs[0].tags.time)} url=${getMessageURL(this.props.buffer, msgs[0])}/>
|
||||
${timestamp}
|
||||
${" "}
|
||||
${content}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue