Commit cfaf6ee6 authored by StyleZhang's avatar StyleZhang

fix ui

parent 826c1a59
......@@ -594,7 +594,7 @@ const Chat: FC<IChatProps> = ({
)}
</div>
{
voiceInputShow && <VoiceInput onConverted={() => setVoiceInputShow(false)} />
voiceInputShow && <VoiceInput onCancel={() => setVoiceInputShow(false)} onConverted={() => setVoiceInputShow(false)} />
}
</div>
</div>
......
......@@ -8,9 +8,11 @@ import { Loading02, XClose } from '@/app/components/base/icons/src/vender/line/g
type VoiceInputTypes = {
onConverted: (text: string) => void
onCancel: () => void
}
const VoiceInput = ({
onCancel,
onConverted,
}: VoiceInputTypes) => {
const { t } = useTranslation()
......@@ -36,14 +38,14 @@ const VoiceInput = ({
let v = dataArray[i * gap]
if (v < 128)
v = 128
if (v > 188)
v = 188
const y = (v - 118) / 70 * canvas.height
if (v > 178)
v = 178
const y = (v - 128) / 50 * canvas.height
ctx.moveTo(x, 16)
ctx.roundRect(x, 16 - y, 2, y, [1, 1, 0, 0])
ctx.fill()
x += 4
x += 3
}
ctx.closePath()
}, [])
......@@ -74,9 +76,6 @@ const VoiceInput = ({
if (canvasRef.current && ctxRef.current)
drawRecord()
}
const handleStopConvert = () => {
handleStartRecord()
}
const initCanvas = () => {
const dpr = window.devicePixelRatio || 1
......@@ -138,7 +137,7 @@ const VoiceInput = ({
startConvert && (
<div
className='flex justify-center items-center mr-1 w-8 h-8 hover:bg-primary-100 rounded-lg cursor-pointer'
onClick={handleStopConvert}
onClick={onCancel}
>
<XClose className='w-4 h-4 text-gray-500' />
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment