Skip to content

Commit e41a925

Browse files
committed
style(projects): change component classification
1 parent e2c0391 commit e41a925

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+186
-130
lines changed

ErrorBoundary.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useRouteError, useNavigate } from 'react-router-dom';
22
import { Button, Typography } from 'antd';
33
import { $t } from './src/locales'
4-
import SvgIcon from '@/components/custom/svg-icon';
54
import type { FallbackProps } from 'react-error-boundary'
65
import { localStg } from '@/utils/storage';
76

src/App.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ import { localStg } from '@/utils/storage';
33
import { getLocale } from '@/store/slice/app';
44
import { getAntdTheme, setupThemeVarsToHtml, toggleCssDarkMode } from '@/store/slice/theme/shared.ts';
55
import { getDarkMode, themeColors } from '@/store/slice/theme/index.ts';
6-
import MenuProvider from '@/components/common/MenuProvider.tsx';
6+
import MenuProvider from '@/components/stateful/MenuProvider.tsx';
77
import { router } from '@/router';
88
import { antdLocales } from './locales/antd';
9-
import AppProvider from './components/common/AppProvider.tsx';
10-
import {info} from '@/constants/app.ts'
9+
import AppProvider from './components/stateful/AppProvider.tsx';
10+
import { info } from '@/constants/app.ts'
11+
import type { WatermarkProps } from 'antd'
12+
13+
const watermarkProps: WatermarkProps = {
14+
font: {
15+
fontSize: 16,
16+
},
17+
width: 240,
18+
height:128,
19+
offset: [12, 60],
20+
rotate: -15,
21+
zIndex: 9999
22+
};
1123

1224
const App = () => {
1325
const locale = useAppSelector(getLocale);
@@ -32,9 +44,13 @@ const App = () => {
3244
locale={antdLocales[locale]}
3345
button={{ classNames: { icon: 'align-1px text-icon' } }}
3446
>
35-
<MenuProvider>
36-
<AppProvider>{router.CustomRouterProvider(<GlobalLoading />)}</AppProvider>
37-
</MenuProvider>
47+
<AppProvider>
48+
<AWatermark className='h-full' {...watermarkProps} >
49+
<MenuProvider>
50+
{router.CustomRouterProvider(<GlobalLoading />)}
51+
</MenuProvider>
52+
</AWatermark>
53+
</AppProvider>
3854
</AConfigProvider>
3955
);
4056
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App } from 'antd';
22
import { cacheTabs } from '@/store/slice/tab';
33
import { DARK_MODE_MEDIA_QUERY } from '@/constants/common';
44
import { setDarkMode } from '@/store/slice/theme/index.ts';
5+
56
function ContextHolder() {
67
const { message, modal, notification } = App.useApp();
78
window.$message = message;
@@ -12,18 +13,21 @@ function ContextHolder() {
1213

1314
const AppProvider = memo(({ children }: { children: React.ReactNode }) => {
1415
const dispatch = useAppDispatch();
16+
1517
useEventListener(
1618
'beforeunload',
1719
() => {
1820
dispatch(cacheTabs());
1921
},
2022
{ target: window }
2123
);
24+
2225
useMount(() => {
2326
window.matchMedia(DARK_MODE_MEDIA_QUERY).addEventListener('change', event => {
2427
dispatch(setDarkMode(event.matches));
2528
});
2629
});
30+
2731
return (
2832
<App className="h-full">
2933
<ContextHolder />
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Dropdown } from 'antd';
22
import { changeLocale, getLocale, getLocaleOptions } from '@/store/slice/app';
3-
import ButtonIcon from '../custom/button-icon';
3+
import ButtonIcon from '../stateless/custom/ButtonIcon';
4+
45
interface Props {
56
/** Show tooltip */
67
showTooltip?: boolean;
@@ -25,7 +26,7 @@ const LangSwitch: FC<Props> = memo(({ showTooltip = true }) => {
2526
tooltipContent={tooltipContent}
2627
tooltipPlacement="left"
2728
icon="heroicons:language"
28-
></ButtonIcon>
29+
/>
2930
</div>
3031
</Dropdown>
3132
);
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import type { FC, ReactNode } from 'react';
22
import { createContext } from 'react';
33
import type { ElegantConstRoute } from '@elegant-router/types';
4-
import type { RouteMeta } from '@ohh-889/react-auto-route';
54
import type { MenuItemType, SubMenuType } from 'antd/es/menu/interface';
65
import { getSortRoutes } from '@/store/slice/route';
76
import { $t } from '@/locales';
8-
import SvgIcon from '../custom/svg-icon';
9-
import BeyondHiding from '../custom/BeyondHiding';
7+
import SvgIcon from '../stateless/custom/SvgIcon';
8+
import BeyondHiding from '../stateless/custom/BeyondHiding';
109

1110
interface Props {
1211
children: ReactNode;
@@ -36,7 +35,7 @@ function getGlobalMenuByBaseRoute(route: ElegantConstRoute): MenuItemType {
3635
i18nKey,
3736
icon = import.meta.env.VITE_MENU_ICON,
3837
localIcon
39-
} = (route.meta as unknown as RouteMeta) ?? {};
38+
} = route.meta ?? {};
4039

4140
const label = i18nKey ? $t(i18nKey) : title!;
4241
const menu: MenuItemType = {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getSiderCollapse, toggleSiderCollapse } from '@/store/slice/app';
2-
import ButtonIcon from '../custom/button-icon';
3-
import SvgIcon from '../custom/svg-icon';
2+
import ButtonIcon from '../stateless/custom/ButtonIcon';
3+
import SvgIcon from '../stateless/custom/SvgIcon';
4+
45
interface Props {
56
/** Arrow style icon */
67
arrowIcon?: boolean;
@@ -19,6 +20,7 @@ const icons: Record<NumberBool, Record<NumberBool, string>> = {
1920
type NumberBool = 0 | 1;
2021
const MenuToggler: FC<Props> = memo(({ arrowIcon, className }) => {
2122
const { t } = useTranslation();
23+
2224
const siderCollapse = useAppSelector(getSiderCollapse);
2325
const dispatch = useAppDispatch();
2426

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ClassNames from 'classnames';
22
import soybeanAvatar from '@/assets/imgs/soybean.jpg';
3-
// eslint-disable-next-line react/prop-types
3+
4+
45
const SoybeanAvatar: FC<React.ComponentProps<'div'>> = ({ className, ...props }) => {
56
return (
67
<div

src/components/common/ThemeSchemaSwitch.tsx renamed to src/components/stateful/ThemeSchemaSwitch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ButtonProps, TooltipProps } from 'antd';
22
import type { CSSProperties } from 'react';
33
import { getDarkMode, getThemeSettings, toggleThemeScheme } from '@/store/slice/theme';
4-
import ButtonIcon from '../custom/button-icon';
4+
import ButtonIcon from '../stateless/custom/ButtonIcon';
55

66
interface Props {
77
/** Show tooltip */
@@ -68,7 +68,7 @@ const ThemeSchemaSwitch: FC<Props> = memo(({ tooltipPlacement = 'bottom', showTo
6868
{...props}
6969
tooltipPlacement={tooltipPlacement}
7070
onClick={toggleDark}
71-
></ButtonIcon>
71+
/>
7272
);
7373
});
7474

File renamed without changes.

src/components/common/ExceptionBase.tsx renamed to src/components/stateless/common/ExceptionBase.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Button } from 'antd';
2+
import SvgIcon from '../custom/SvgIcon';
23

3-
import SvgIcon from '../custom/svg-icon';
44
type ExceptionType = '403' | '404' | '500';
5+
56
interface Props {
67
/**
78
* Exception type
@@ -18,6 +19,7 @@ const iconMap: Record<ExceptionType, string> = {
1819
'500': 'service-error'
1920
};
2021
const ExceptionBase: FC<Props> = memo(({ type }) => {
22+
2123
const { t } = useTranslation();
2224

2325
return (

0 commit comments

Comments
 (0)