'use client'; import TextareaAutosize from 'react-textarea-autosize'; import { BsCapslockFill } from "react-icons/bs"; import * as R from 'ramda' import { BsFillStopFill } from "react-icons/bs"; import React, { useMemo } from 'react'; const Sender = ({ input, onInput, isSending, onCommit, onStop, effectButtons = [] }) => { const onKeyDown = (e) => { if (e.key === 'Enter' && R.none(R.equals(true), R.props(['altKey', 'shiftKey', 'ctrlKey', 'metaKey'], e))) { onCommit() e.preventDefault() } } const EffectElement = useMemo(() => { if (effectButtons?.length) { return (
{effectButtons}
) } return null }, [effectButtons]) return (
{EffectElement} onInput(ev.target.value)} maxRows={4} onKeyDown={onKeyDown} /> { isSending ? ( ) : ( ) }
) } export default React.memo(Sender)