Update TranslationPanel.tsx

This commit is contained in:
xxnuo
2026-01-01 17:16:15 +08:00
parent 37dc708264
commit 540661e419

View File

@@ -54,6 +54,7 @@ export function TranslationPanel({
const [translatedText, setTranslatedText] = useState('')
const [loading, setLoading] = useState(false)
const [autoTranslate, setAutoTranslate] = useState(() => localStorage.getItem(storageKey('autoTranslate')) === 'true')
const firstTranslateTipKey = 'firstTranslateTipShown'
const translateTimeoutRef = useRef<number | null>(null)
@@ -102,6 +103,11 @@ export function TranslationPanel({
return
}
if (localStorage.getItem(firstTranslateTipKey) !== 'true') {
localStorage.setItem(firstTranslateTipKey, 'true')
toast(t('firstTranslationTip'), { position: 'bottom-right' })
}
setLoading(true)
setTranslatedText('')
@@ -479,4 +485,4 @@ export function TranslationPanel({
</CardContent>
</Card>
)
}
}