style: minimium codemod

This commit is contained in:
AkaraChen 2024-10-21 17:22:05 +08:00
parent 764daf0040
commit 9edd0a6eae
5 changed files with 10 additions and 6 deletions

View File

@ -44,7 +44,7 @@ const Flowchart = React.forwardRef((props: {
const chartId = useRef(`flowchart_${CryptoJS.MD5(props.PrimitiveCode).toString()}`) const chartId = useRef(`flowchart_${CryptoJS.MD5(props.PrimitiveCode).toString()}`)
const prevPrimitiveCode = usePrevious(props.PrimitiveCode) const prevPrimitiveCode = usePrevious(props.PrimitiveCode)
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const timeRef = useRef<NodeJS.Timeout>() const timeRef = useRef<number>()
const [errMsg, setErrMsg] = useState('') const [errMsg, setErrMsg] = useState('')
const renderFlowchart = async (PrimitiveCode: string) => { const renderFlowchart = async (PrimitiveCode: string) => {
@ -74,9 +74,9 @@ const Flowchart = React.forwardRef((props: {
return return
} }
if (timeRef.current) if (timeRef.current)
clearTimeout(timeRef.current) window.clearTimeout(timeRef.current)
timeRef.current = setTimeout(() => { timeRef.current = window.setTimeout(() => {
renderFlowchart(props.PrimitiveCode) renderFlowchart(props.PrimitiveCode)
}, 300) }, 300)
}, [props.PrimitiveCode]) }, [props.PrimitiveCode])

View File

@ -34,15 +34,15 @@ export default function CustomPopover({
disabled = false, disabled = false,
}: IPopover) { }: IPopover) {
const buttonRef = useRef<HTMLButtonElement>(null) const buttonRef = useRef<HTMLButtonElement>(null)
const timeOutRef = useRef<NodeJS.Timeout | null>(null) const timeOutRef = useRef<number | null>(null)
const onMouseEnter = (isOpen: boolean) => { const onMouseEnter = (isOpen: boolean) => {
timeOutRef.current && clearTimeout(timeOutRef.current) timeOutRef.current && window.clearTimeout(timeOutRef.current)
!isOpen && buttonRef.current?.click() !isOpen && buttonRef.current?.click()
} }
const onMouseLeave = (isOpen: boolean) => { const onMouseLeave = (isOpen: boolean) => {
timeOutRef.current = setTimeout(() => { timeOutRef.current = window.setTimeout(() => {
isOpen && buttonRef.current?.click() isOpen && buttonRef.current?.click()
}, timeoutDuration) }, timeoutDuration)
} }

View File

@ -63,6 +63,7 @@ const RuleDetail: FC<{ sourceData?: ProcessRuleResponse }> = ({ sourceData }) =>
default: default:
value = sourceData?.mode === 'automatic' value = sourceData?.mode === 'automatic'
? (t('datasetDocuments.embedding.automatic') as string) ? (t('datasetDocuments.embedding.automatic') as string)
// eslint-disable-next-line array-callback-return
: sourceData?.rules?.pre_processing_rules?.map((rule) => { : sourceData?.rules?.pre_processing_rules?.map((rule) => {
if (rule.enabled) if (rule.enabled)
return getRuleName(rule.id) return getRuleName(rule.id)

View File

@ -85,6 +85,7 @@ const RuleDetail: FC<{ sourceData?: ProcessRuleResponse; docName?: string }> = (
default: default:
value = sourceData?.mode === 'automatic' value = sourceData?.mode === 'automatic'
? (t('datasetDocuments.embedding.automatic') as string) ? (t('datasetDocuments.embedding.automatic') as string)
// eslint-disable-next-line array-callback-return
: sourceData?.rules?.pre_processing_rules?.map((rule) => { : sourceData?.rules?.pre_processing_rules?.map((rule) => {
if (rule.enabled) if (rule.enabled)
return getRuleName(rule.id) return getRuleName(rule.id)

View File

@ -3,6 +3,8 @@ const translation = {
welcome: 'आपका स्वागत है', welcome: 'आपका स्वागत है',
appUnavailable: 'ऐप उपलब्ध नहीं है', appUnavailable: 'ऐप उपलब्ध नहीं है',
appUnknownError: 'अज्ञात त्रुटि, कृपया पुनः प्रयास करें', appUnknownError: 'अज्ञात त्रुटि, कृपया पुनः प्रयास करें',
// @ts-expect-error TODO: fix this
// eslint-disable-next-line no-dupe-keys
appUnknownError: 'ऐप अनुपलब्ध है', appUnknownError: 'ऐप अनुपलब्ध है',
}, },
chat: { chat: {