Feat: Remove antd-related code and upgrade lucide-react to the latest version. (#13830)

### What problem does this PR solve?

Feat: Remove antd-related code and upgrade lucide-react to the latest
version.

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2026-03-27 19:24:52 +08:00
committed by GitHub
parent 1fff48b656
commit 308b3a1299
4 changed files with 10 additions and 56 deletions

8
web/package-lock.json generated
View File

@@ -73,7 +73,7 @@
"jsoneditor": "^10.4.2",
"lexical": "^0.23.1",
"lodash": "^4.17.23",
"lucide-react": "^0.546.0",
"lucide-react": "^1.7.0",
"mammoth": "^1.7.2",
"next-themes": "^0.4.6",
"openai-speech-stream-player": "^1.0.8",
@@ -18722,9 +18722,9 @@
}
},
"node_modules/lucide-react": {
"version": "0.546.0",
"resolved": "https://registry.npmmirror.com/lucide-react/-/lucide-react-0.546.0.tgz",
"integrity": "sha512-Z94u6fKT43lKeYHiVyvyR8fT7pwCzDu7RyMPpTvh054+xahSgj4HFQ+NmflvzdXsoAjYGdCguGaFKYuvq0ThCQ==",
"version": "1.7.0",
"resolved": "https://registry.npmmirror.com/lucide-react/-/lucide-react-1.7.0.tgz",
"integrity": "sha512-yI7BeItCLZJTXikmK4KNUGCKoGzSvbKlfCvw44bU4fXAL6v3gYS4uHD1jzsLkfwODYwI6Drw5Tu9Z5ulDe0TSg==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"

View File

@@ -92,7 +92,7 @@
"jsoneditor": "^10.4.2",
"lexical": "^0.23.1",
"lodash": "^4.17.23",
"lucide-react": "^0.546.0",
"lucide-react": "^1.7.0",
"mammoth": "^1.7.2",
"next-themes": "^0.4.6",
"openai-speech-stream-player": "^1.0.8",

View File

@@ -3,16 +3,6 @@ import { Toaster } from '@/components/ui/toaster';
import i18n, { changeLanguageAsync } from '@/locales/config';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { configResponsive } from 'ahooks';
import { ConfigProvider, ConfigProviderProps, theme } from 'antd';
import pt_BR from 'antd/lib/locale/pt_BR';
import arEG from 'antd/locale/ar_EG';
import deDE from 'antd/locale/de_DE';
import enUS from 'antd/locale/en_US';
import ru_RU from 'antd/locale/ru_RU';
import trTR from 'antd/locale/tr_TR';
import vi_VN from 'antd/locale/vi_VN';
import zhCN from 'antd/locale/zh_CN';
import zh_HK from 'antd/locale/zh_HK';
import dayjs from 'dayjs';
import 'dayjs/locale/ar';
import 'dayjs/locale/tr';
@@ -23,9 +13,9 @@ import localeData from 'dayjs/plugin/localeData';
import weekOfYear from 'dayjs/plugin/weekOfYear';
import weekYear from 'dayjs/plugin/weekYear';
import weekday from 'dayjs/plugin/weekday';
import React, { useEffect, useState } from 'react';
import React, { useEffect } from 'react';
import { RouterProvider } from 'react-router';
import { ThemeProvider, useTheme } from './components/theme-provider';
import { ThemeProvider } from './components/theme-provider';
import { TooltipProvider } from './components/ui/tooltip';
import { ThemeEnum } from './constants/common';
import { routers } from './routes';
@@ -50,18 +40,6 @@ dayjs.extend(localeData);
dayjs.extend(weekOfYear);
dayjs.extend(weekYear);
const AntLanguageMap = {
en: enUS,
zh: zhCN,
'zh-TRADITIONAL': zh_HK,
ru: ru_RU,
vi: vi_VN,
'pt-BR': pt_BR,
de: deDE,
ar: arEG,
tr: trTR,
};
if (process.env.NODE_ENV === 'development') {
import('@welldone-software/why-did-you-render').then(
(whyDidYouRenderModule) => {
@@ -85,24 +63,16 @@ const queryClient = new QueryClient({
},
});
type Locale = ConfigProviderProps['locale'];
function Root({ children }: React.PropsWithChildren) {
const { theme: themeragflow } = useTheme();
const getLocale = (lng: string) =>
AntLanguageMap[lng as keyof typeof AntLanguageMap] ?? enUS;
const updateDocumentLocale = (lng: string) => {
document.documentElement.lang = lng;
document.documentElement.dir = 'ltr';
dayjs.locale(lng === 'zh' ? 'zh-cn' : lng);
};
const [locale, setLocal] = useState<Locale>(getLocale(storage.getLanguage()));
useEffect(() => {
const handleLanguageChanged = (lng: string) => {
storage.setLanguage(lng);
setLocal(getLocale(lng));
updateDocumentLocale(lng);
};
@@ -115,26 +85,11 @@ function Root({ children }: React.PropsWithChildren) {
}, []);
return (
<>
<ConfigProvider
theme={{
token: {
fontFamily:
"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",
},
algorithm:
themeragflow === 'dark'
? theme.darkAlgorithm
: theme.defaultAlgorithm,
}}
locale={locale}
direction={'ltr'}
>
{children}
{children}
<Sonner position="top-right" expand richColors closeButton />
<Sonner position="top-right" expand richColors closeButton />
<Toaster />
</ConfigProvider>
<Toaster />
</>
);
}

View File

@@ -165,7 +165,6 @@ export default defineConfig(({ mode }) => {
'react',
'react-dom',
'react-router',
'antd',
'axios',
'lodash',
'dayjs',