mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 09:27:23 +00:00
Linting
This commit is contained in:
parent
3288234f36
commit
7a96d99055
21 changed files with 174 additions and 170 deletions
|
|
@ -3,10 +3,10 @@ import { useEffect, useRef, useState } from 'preact/hooks'
|
|||
|
||||
import TextMessage from './TextMessage'
|
||||
|
||||
const isFakeStatus = w =>
|
||||
const isFakeStatus = (w) =>
|
||||
w.height < 5
|
||||
|
||||
const trimInputPrompt = messages =>
|
||||
const trimInputPrompt = (messages) =>
|
||||
messages.length < 1
|
||||
? messages
|
||||
: messages.slice(-1)[0].text === '>'
|
||||
|
|
@ -21,7 +21,7 @@ const parseInbox = (inbox, currentWindow) => {
|
|||
if (!currentInbox) {
|
||||
return {
|
||||
clear: false,
|
||||
incoming: []
|
||||
incoming: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,11 +45,11 @@ const parseInbox = (inbox, currentWindow) => {
|
|||
incoming,
|
||||
clear: isFakeStatus(currentWindow)
|
||||
? true
|
||||
: currentInbox.clear
|
||||
: currentInbox.clear,
|
||||
}
|
||||
}
|
||||
|
||||
export default function ({ inbox, currentWindow }) {
|
||||
export default function TextBuffer ({ inbox, currentWindow }) {
|
||||
const [messages, setMessages] = useState([])
|
||||
const textBufferEl = useRef(null)
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
const { incoming, clear } =
|
||||
parseInbox(inbox, currentWindow)
|
||||
|
||||
setMessages(messages => clear
|
||||
setMessages((messages) => clear
|
||||
? incoming
|
||||
: messages.concat(incoming))
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
tabindex='0'
|
||||
ref={textBufferEl}
|
||||
className={classes}>
|
||||
{messages.map(TextMessage)}
|
||||
{messages.map(TextMessage)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue