diff --git a/src/renderer/src/pages/settings/DocProcessSettings/OcrSettings.tsx b/src/renderer/src/pages/settings/DocProcessSettings/OcrSettings.tsx index c26b4045f0..bf6b3d7bb7 100644 --- a/src/renderer/src/pages/settings/DocProcessSettings/OcrSettings.tsx +++ b/src/renderer/src/pages/settings/DocProcessSettings/OcrSettings.tsx @@ -1,62 +1,60 @@ -import { PictureOutlined } from '@ant-design/icons' -import { cn, Tabs, TabsContent, TabsList, TabsTrigger } from '@cherrystudio/ui' import { ErrorBoundary } from '@renderer/components/ErrorBoundary' import { useTheme } from '@renderer/context/ThemeProvider' import { useOcrProviders } from '@renderer/hooks/useOcrProvider' -import type { FC, ReactNode } from 'react' -import { useCallback, useMemo, useState } from 'react' +import type { FC } from 'react' import { useTranslation } from 'react-i18next' -import * as z from 'zod' import { SettingDivider, SettingGroup, SettingTitle } from '..' import OcrImageSettings from './OcrImageSettings' import OcrProviderSettings from './OcrProviderSettings' -const TabSchema = z.enum(['image']) -type Tab = z.infer -const isValidTab = (value: string): value is Tab => TabSchema.safeParse(value).success -type TabItem = { - name: string - value: Tab - icon: ReactNode - content: ReactNode -} +// const TabSchema = z.enum(['image']) +// type Tab = z.infer +// const isValidTab = (value: string): value is Tab => TabSchema.safeParse(value).success +// type TabItem = { +// name: string +// value: Tab +// icon: ReactNode +// content: ReactNode +// } const OcrSettings: FC = () => { const { t } = useTranslation() const { theme: themeMode } = useTheme() - const { imageProvider } = useOcrProviders() - const [activeTab, setActiveTab] = useState('image') - const provider = useMemo(() => { - switch (activeTab) { - case 'image': - return imageProvider - } - }, [imageProvider, activeTab]) + const { imageProvider: provider } = useOcrProviders() + // const [activeTab, setActiveTab] = useState('image') + // const provider = useMemo(() => { + // switch (activeTab) { + // case 'image': + // return imageProvider + // default: + // return undefined + // } + // }, [imageProvider, activeTab]) - const tabs = [ - { - name: t('settings.tool.ocr.image.title'), - value: 'image', - icon: , - content: - } - ] satisfies TabItem[] + // const tabs = [ + // { + // name: t('settings.tool.ocr.image.title'), + // value: 'image', + // icon: , + // content: + // } + // ] satisfies TabItem[] - const handleTabChange = useCallback((value: string) => { - if (isValidTab(value)) { - setActiveTab(value) - } else { - window.toast.error('Unexpected behavior: Not a valid tab.') - } - }, []) + // const handleTabChange = useCallback((value: string) => { + // if (isValidTab(value)) { + // setActiveTab(value) + // } else { + // window.toast.error('Unexpected behavior: Not a valid tab.') + // } + // }, []) return ( {t('settings.tool.ocr.title')} - + {/* {tabs.map((tab) => { return ( @@ -76,7 +74,11 @@ const OcrSettings: FC = () => { ) })} - + */} + + {/* Since only image is supported for now, we just don't use tabs component, + but keep code of tabs. */} +