mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Add GridBuffer component
This commit is contained in:
parent
4747a3396c
commit
752cb60b56
6 changed files with 75 additions and 10 deletions
|
|
@ -39,6 +39,7 @@ export default function ({
|
|||
currentWindowId,
|
||||
sendMessage
|
||||
}) {
|
||||
const [targetWindow, setTargetWindow] = useState(null)
|
||||
const [inputText, setInputText] = useState('')
|
||||
const [lastInput, setLastInput] = useState('')
|
||||
const inputEl = useRef(null)
|
||||
|
|
@ -48,13 +49,18 @@ export default function ({
|
|||
inputEl.current && inputEl.current.focus()
|
||||
}, [inputType])
|
||||
|
||||
useEffect(() => {
|
||||
setTargetWindow(
|
||||
windows
|
||||
.find(({id}) =>
|
||||
id === currentWindowId))
|
||||
}, [currentWindowId, windows])
|
||||
|
||||
const send = message => {
|
||||
sendMessage(
|
||||
message,
|
||||
inputType,
|
||||
windows
|
||||
.find(({id}) =>
|
||||
id === currentWindowId))
|
||||
targetWindow)
|
||||
setLastInput(message)
|
||||
setInputText('')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue