feat(antd-imports): establish centralized import rules for Ant Design components

- Introduced a new rules file for Ant Design component imports, enforcing the use of centralized imports from `@antd-imports` to enhance tree-shaking, maintainability, and performance.
- Updated various components to replace direct imports from 'antd' and '@ant-design/icons' with the centralized import path.
- Refactored existing components to utilize memoization and callbacks for improved performance and readability.
- Enhanced the billing and configuration components with updated styles and improved user experience.
This commit is contained in:
chamikaJ
2025-07-23 10:33:55 +05:30
parent a6286eb2b8
commit 80f5febb51
8 changed files with 639 additions and 278 deletions

View File

@@ -1,32 +1,39 @@
import { PageHeader } from '@ant-design/pro-components';
import { Tabs, TabsProps } from 'antd';
import React from 'react';
import { Tabs, TabsProps } from '@/shared/antd-imports';
import React, { useMemo } from 'react';
import CurrentBill from '@/components/admin-center/billing/current-bill';
import Configuration from '@/components/admin-center/configuration/configuration';
import { useTranslation } from 'react-i18next';
const Billing: React.FC = () => {
const Billing: React.FC = React.memo(() => {
const { t } = useTranslation('admin-center/current-bill');
const items: TabsProps['items'] = [
{
key: '1',
label: t('currentBill'),
children: <CurrentBill />,
},
{
key: '2',
label: t('configuration'),
children: <Configuration />,
},
];
const items: TabsProps['items'] = useMemo(
() => [
{
key: '1',
label: t('currentBill'),
children: <CurrentBill />,
},
{
key: '2',
label: t('configuration'),
children: <Configuration />,
},
],
[t]
);
const pageHeaderStyle = useMemo(() => ({ padding: '16px 0' }), []);
return (
<div style={{ width: '100%' }}>
<PageHeader title={<span>{t('title')}</span>} style={{ padding: '16px 0' }} />
<Tabs defaultActiveKey="1" items={items} destroyInactiveTabPane />
<PageHeader title={<span>{t('title')}</span>} style={pageHeaderStyle} />
<Tabs defaultActiveKey="1" items={items} destroyOnHidden />
</div>
);
};
});
Billing.displayName = 'Billing';
export default Billing;