Skip to content

Commit 308b3a1

Browse files
authored
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)
1 parent 1fff48b commit 308b3a1

File tree

4 files changed

+10
-56
lines changed

4 files changed

+10
-56
lines changed

web/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"jsoneditor": "^10.4.2",
9393
"lexical": "^0.23.1",
9494
"lodash": "^4.17.23",
95-
"lucide-react": "^0.546.0",
95+
"lucide-react": "^1.7.0",
9696
"mammoth": "^1.7.2",
9797
"next-themes": "^0.4.6",
9898
"openai-speech-stream-player": "^1.0.8",

web/src/app.tsx

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ import { Toaster } from '@/components/ui/toaster';
33
import i18n, { changeLanguageAsync } from '@/locales/config';
44
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
55
import { configResponsive } from 'ahooks';
6-
import { ConfigProvider, ConfigProviderProps, theme } from 'antd';
7-
import pt_BR from 'antd/lib/locale/pt_BR';
8-
import arEG from 'antd/locale/ar_EG';
9-
import deDE from 'antd/locale/de_DE';
10-
import enUS from 'antd/locale/en_US';
11-
import ru_RU from 'antd/locale/ru_RU';
12-
import trTR from 'antd/locale/tr_TR';
13-
import vi_VN from 'antd/locale/vi_VN';
14-
import zhCN from 'antd/locale/zh_CN';
15-
import zh_HK from 'antd/locale/zh_HK';
166
import dayjs from 'dayjs';
177
import 'dayjs/locale/ar';
188
import 'dayjs/locale/tr';
@@ -23,9 +13,9 @@ import localeData from 'dayjs/plugin/localeData';
2313
import weekOfYear from 'dayjs/plugin/weekOfYear';
2414
import weekYear from 'dayjs/plugin/weekYear';
2515
import weekday from 'dayjs/plugin/weekday';
26-
import React, { useEffect, useState } from 'react';
16+
import React, { useEffect } from 'react';
2717
import { RouterProvider } from 'react-router';
28-
import { ThemeProvider, useTheme } from './components/theme-provider';
18+
import { ThemeProvider } from './components/theme-provider';
2919
import { TooltipProvider } from './components/ui/tooltip';
3020
import { ThemeEnum } from './constants/common';
3121
import { routers } from './routes';
@@ -50,18 +40,6 @@ dayjs.extend(localeData);
5040
dayjs.extend(weekOfYear);
5141
dayjs.extend(weekYear);
5242

53-
const AntLanguageMap = {
54-
en: enUS,
55-
zh: zhCN,
56-
'zh-TRADITIONAL': zh_HK,
57-
ru: ru_RU,
58-
vi: vi_VN,
59-
'pt-BR': pt_BR,
60-
de: deDE,
61-
ar: arEG,
62-
tr: trTR,
63-
};
64-
6543
if (process.env.NODE_ENV === 'development') {
6644
import('@welldone-software/why-did-you-render').then(
6745
(whyDidYouRenderModule) => {
@@ -85,24 +63,16 @@ const queryClient = new QueryClient({
8563
},
8664
});
8765

88-
type Locale = ConfigProviderProps['locale'];
89-
9066
function Root({ children }: React.PropsWithChildren) {
91-
const { theme: themeragflow } = useTheme();
92-
const getLocale = (lng: string) =>
93-
AntLanguageMap[lng as keyof typeof AntLanguageMap] ?? enUS;
9467
const updateDocumentLocale = (lng: string) => {
9568
document.documentElement.lang = lng;
9669
document.documentElement.dir = 'ltr';
9770
dayjs.locale(lng === 'zh' ? 'zh-cn' : lng);
9871
};
9972

100-
const [locale, setLocal] = useState<Locale>(getLocale(storage.getLanguage()));
101-
10273
useEffect(() => {
10374
const handleLanguageChanged = (lng: string) => {
10475
storage.setLanguage(lng);
105-
setLocal(getLocale(lng));
10676
updateDocumentLocale(lng);
10777
};
10878

@@ -115,26 +85,11 @@ function Root({ children }: React.PropsWithChildren) {
11585
}, []);
11686
return (
11787
<>
118-
<ConfigProvider
119-
theme={{
120-
token: {
121-
fontFamily:
122-
"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",
123-
},
124-
algorithm:
125-
themeragflow === 'dark'
126-
? theme.darkAlgorithm
127-
: theme.defaultAlgorithm,
128-
}}
129-
locale={locale}
130-
direction={'ltr'}
131-
>
132-
{children}
88+
{children}
13389

134-
<Sonner position="top-right" expand richColors closeButton />
90+
<Sonner position="top-right" expand richColors closeButton />
13591

136-
<Toaster />
137-
</ConfigProvider>
92+
<Toaster />
13893
</>
13994
);
14095
}

web/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ export default defineConfig(({ mode }) => {
165165
'react',
166166
'react-dom',
167167
'react-router',
168-
'antd',
169168
'axios',
170169
'lodash',
171170
'dayjs',

0 commit comments

Comments
 (0)