45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
import { ConfigProvider, theme } from 'antd';
|
|
import { ThemeProvider } from './contexts/ThemeContext';
|
|
import { AuthProvider } from './contexts/AuthContext';
|
|
import AppRoutes from './routes/AppRoutes';
|
|
import { useTheme } from './contexts/ThemeContext';
|
|
|
|
const ThemedApp = () => {
|
|
const { isDarkMode } = useTheme();
|
|
|
|
return (
|
|
<ConfigProvider
|
|
theme={{
|
|
algorithm: isDarkMode ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
token: {
|
|
colorPrimary: '#1677ff',
|
|
borderRadius: 4,
|
|
colorBgContainer: isDarkMode ? '#141414' : '#ffffff',
|
|
colorBgElevated: isDarkMode ? '#1f1f1f' : '#ffffff',
|
|
colorText: isDarkMode ? 'rgba(255, 255, 255, 0.85)' : 'rgba(0, 0, 0, 0.85)',
|
|
colorTextSecondary: isDarkMode ? 'rgba(255, 255, 255, 0.45)' : 'rgba(0, 0, 0, 0.45)',
|
|
},
|
|
}}
|
|
>
|
|
<div className={isDarkMode ? 'dark' : ''}>
|
|
<AppRoutes />
|
|
</div>
|
|
</ConfigProvider>
|
|
);
|
|
};
|
|
|
|
const App = () => {
|
|
return (
|
|
<BrowserRouter>
|
|
<AuthProvider>
|
|
<ThemeProvider>
|
|
<ThemedApp />
|
|
</ThemeProvider>
|
|
</AuthProvider>
|
|
</BrowserRouter>
|
|
);
|
|
};
|
|
|
|
export default App; |