Commit 6893e298 by liimin

refactor(components): 调整聊天窗口和语音输入样式

- 注释掉聊天窗口中的 hasWorkflowProcess 相关样式
- 调整文本输入框的样式和布局
- 修改语音输入框的背景颜色和样式
1 parent d5e9c1d3
......@@ -16,7 +16,7 @@ const OperationWrapper: FC<OperationWrapperProps> = ({ children }) => {
<div
className={cn(
'absolute flex justify-end gap-1',
hasWorkflowProcess && '-bottom-4 right-2',
// hasWorkflowProcess && '-bottom-4 right-2',
!positionRight && '-bottom-4 right-2',
!hasWorkflowProcess && positionRight && '!top-[9px]',
!hasWorkflowProcess && positionRight ? 'left-auto' : '',
......
......@@ -13,7 +13,8 @@ const TextInput: React.FC<{
const historyRef = useRef([''])
const isComposingRef = useRef(false)
const [currentIndex, setCurrentIndex] = useState(-1)
const { wrapperRef, textareaRef, textValueRef, handleTextareaResize, setIsMultipleLine,isMultipleLine } = useTextAreaHeightContext()
const { wrapperRef, textareaRef, textValueRef, handleTextareaResize, setIsMultipleLine, isMultipleLine } =
useTextAreaHeightContext()
const { handleDragFileEnter, handleDragFileLeave, handleDragFileOver, handleDropFile, handleClipboardPasteFile } =
useFileOperation()
const handleCompositionStart = () => {
......@@ -28,7 +29,7 @@ const TextInput: React.FC<{
}, 50)
}
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
const handleKeyDown = useCallback(()=>(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
// if isComposing, exit
if (isComposingRef.current) return
......@@ -54,7 +55,7 @@ const TextInput: React.FC<{
setQuery('')
}
}
}
},[handleSend])
const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setQuery(e.target.value)
......@@ -71,7 +72,8 @@ const TextInput: React.FC<{
return hasQuery ? undefined : 1
}, [hasQuery])
return (
<div ref={wrapperRef} className="flex items-center justify-between">
// <div ref={wrapperRef} className="flex items-center justify-between">
<div ref={wrapperRef} className="flex items-center justify-between py-[9px]">
<div className="relative flex w-full grow items-center ml-8">
<div
ref={textValueRef}
......
......@@ -9,12 +9,18 @@ import MultipleLineOperation from './multiple-line-operation'
const InputWrapper: FC = () => {
const { isDragActive } = useFileOperation()
return (
// <div
// className={cn(
// 'relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] pb-[9px] shadow-md',
// isDragActive && 'border border-dashed border-components-option-card-option-selected-border',
// )}>
<div
className={cn(
'relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] pb-[9px] shadow-md',
'relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] shadow-md',
isDragActive && 'border border-dashed border-components-option-card-option-selected-border',
)}>
<div className="relative max-h-[158px] overflow-y-auto overflow-x-hidden px-[9px] pt-[9px]">
{/* <div className="relative max-h-[158px] overflow-y-auto overflow-x-hidden px-[9px] pt-[9px]"> */}
<div className="relative max-h-[158px] overflow-y-auto overflow-x-hidden px-[9px]">
<FileList />
<TextInput>
<Opration />
......
......@@ -168,7 +168,7 @@ const VoiceInput = ({ onCancel, onConverted, wordTimestamps }: VoiceInputTypes)
const ctx = canvas.getContext('2d')
if (ctx) {
ctx.scale(dpr, dpr)
ctx.fillStyle = 'rgba(209, 224, 255, 1)'
ctx.fillStyle = 'rgba(0, 0, 255, 1)'
ctxRef.current = ctx
} else {
console.error('Failed to get canvas context')
......@@ -212,7 +212,8 @@ const VoiceInput = ({ onCancel, onConverted, wordTimestamps }: VoiceInputTypes)
return (
<div className={cn(s.wrapper, 'absolute inset-0 rounded-xl')}>
<div className="absolute inset-[1.5px] flex items-center overflow-hidden rounded-[10.5px] bg-primary-25 py-[14px] pl-[14.5px] pr-[6.5px]">
{/* <div className="absolute inset-[1.5px] flex items-center overflow-hidden rounded-[10.5px] bg-primary-25 py-[14px] pl-[14.5px] pr-[6.5px]"></div> */}
<div className="absolute inset-[1.5px] flex items-center overflow-hidden rounded-[10.5px] bg-primary-25 pl-[14.5px] pr-[6.5px]">
<canvas id="voice-input-record" className="absolute bottom-0 left-0 h-4 w-full" />
{startConvert && <RiLoader2Line className="mr-2 h-4 w-4 animate-spin text-primary-700" />}
<div className="grow">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!