mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
GridBuffer: hide when the buffer contains only empty lines
This commit is contained in:
parent
0c5a763414
commit
2bd264659c
1 changed files with 22 additions and 11 deletions
|
|
@ -28,17 +28,28 @@ export default function ({ inbox, currentWindow }) {
|
||||||
.map(newOrPrev(currentInbox, prevMessages))
|
.map(newOrPrev(currentInbox, prevMessages))
|
||||||
|
|
||||||
setPrevMessages(rawMessages)
|
setPrevMessages(rawMessages)
|
||||||
setMessages(rawMessages
|
|
||||||
|
const rawMessagesContent =
|
||||||
|
rawMessages
|
||||||
.map(x => x.content)
|
.map(x => x.content)
|
||||||
.map(([x]) => x)
|
.map(([x]) => x)
|
||||||
.map(({text}) => text)
|
.map(({text}) => text)
|
||||||
.map(text => text.trim())
|
.map(text => text.trim())
|
||||||
|
|
||||||
|
const isEmpty =
|
||||||
|
rawMessagesContent
|
||||||
|
.map(text => text.length)
|
||||||
|
.every(l => l === 0)
|
||||||
|
|
||||||
|
const messages =
|
||||||
|
rawMessagesContent
|
||||||
.map(text =>
|
.map(text =>
|
||||||
text.replace(' ', ' / '))
|
text.replace(' ', ' / '))
|
||||||
.map(text => ({
|
.map(text => ({
|
||||||
style: 'grid',
|
style: 'grid',
|
||||||
text}))
|
text}))
|
||||||
)
|
|
||||||
|
setMessages(isEmpty ? [] : messages)
|
||||||
}, [inbox, currentWindow])
|
}, [inbox, currentWindow])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue