upgrade antd@5.6.3

This commit is contained in:
vchikalkin 2023-06-26 11:39:02 +03:00
parent 84de7a84e8
commit b23ccbed57
13 changed files with 414 additions and 407 deletions

View File

@ -20,7 +20,7 @@ export function buildLink<T>(
return (
<Component
href={value || undefined}
href={status === 'Disabled' ? undefined : value || undefined}
disabled={!value || status === 'Disabled'}
loading={status === 'Loading'}
{...props}

View File

@ -10,6 +10,7 @@ import { useErrors, useStore } from '@/stores/hooks';
import { useIsFetching } from '@tanstack/react-query';
import { observer } from 'mobx-react-lite';
import type { ComponentProps } from 'react';
import styled from 'styled-components';
import { Link, Tooltip } from 'ui/elements';
import { LoadingOutlined } from 'ui/elements/icons';
@ -24,6 +25,10 @@ const formatter = Intl.NumberFormat('ru', {
minimumFractionDigits: 2,
}).format;
const TextAddon = styled.span`
font-size: 14px;
`;
const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
btnCalculate: {
render: () => {
@ -305,13 +310,11 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const { $calculation } = useStore();
const { min, max } = $calculation.$values.getValue('irrInfo');
const addon = <TextAddon>{`${formatter(min)}% - ${formatter(max)}%`}</TextAddon>;
return (
<Container>
<Head
htmlFor={elementName}
title={title}
addon={`${formatter(min)}% - ${formatter(max)}%`}
/>
<Head htmlFor={elementName} title={title} addon={addon} />
<Element {...props} min={min > 0 ? min : undefined} max={max > 0 ? max : undefined} />
</Container>
);

View File

@ -35,6 +35,7 @@ const Logout = styled.a`
font-size: 0.45rem;
font-family: 'Montserrat';
font-weight: 500;
margin-top: 2px;
${min('laptop')} {
font-size: 0.55rem;

View File

@ -17,7 +17,7 @@ const HeaderContent = styled(Flex)`
padding: 10px 12px;
${min('laptop')} {
padding: 10px 12px;
padding: 12px 12px;
padding-left: 20px;
}
`;

View File

@ -1,8 +1,5 @@
const { withPlugins } = require('next-composed-plugins');
const withLess = require('next-with-less');
const fs = require('fs');
const path = require('path');
const { COLORS_DEV, COLORS_PROD } = require('./constants/colors');
const envSchema = require('./config/schema/env');
const urls = require('./constants/urls');
const { devices } = require('./config/ui');
@ -21,7 +18,7 @@ function buildFaviconRewrite(source) {
}
/** @type {import('next').NextConfig} */
const nextConfig = {
module.exports = {
basePath: env.BASE_PATH,
compiler: {
styledComponents: true,
@ -75,20 +72,3 @@ const nextConfig = {
swcMinify: true,
transpilePackages: ['ui', 'tools'],
};
const plugins = [withLess];
const colorPrimary = env.USE_DEV_COLORS ? COLORS_DEV.COLOR_PRIMARY : COLORS_PROD.COLOR_PRIMARY;
const config = {
...nextConfig,
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'primary-color': colorPrimary,
},
},
},
};
module.exports = withPlugins(config, plugins);

View File

@ -22,13 +22,9 @@
"@trpc/server": "^10.13.0",
"axios": "^1.3.4",
"dayjs": "^1.11.7",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mobx": "^6.8.0",
"mobx-react-lite": "^3.4.0",
"next": "^13.2.1",
"next-composed-plugins": "^1.0.1",
"next-with-less": "^2.0.5",
"normalize.css": "^8.0.1",
"radash": "^10.7.0",
"react": "^18.2.0",

View File

@ -1,5 +1,4 @@
import 'normalize.css';
import 'ui/elements/styles/antd.less';
import '../styles/fonts.css';
import '../styles/globals.css';
import initializeQueryClient from '@/api/client';
@ -7,6 +6,7 @@ import initializeApollo from '@/apollo/client';
import Layout from '@/Components/Layout';
import { theme } from '@/config/ui';
import StoreProvider from '@/stores/Provider';
import getColors from '@/styles/colors';
import { GlobalStyle } from '@/styles/global-style';
import { trpcClient } from '@/trpc/client';
import { ApolloProvider } from '@apollo/client';
@ -14,13 +14,15 @@ import { QueryClientProvider } from '@tanstack/react-query';
import Head from 'next/head';
import { useMemo } from 'react';
import { ThemeProvider } from 'styled-components';
import { Config as AntdConfig } from 'ui/elements/Config';
import AntdConfig from 'ui/elements/Config';
// eslint-disable-next-line turbo/no-undeclared-env-vars
if (process.env.NODE_ENV === 'development') {
require('../mocks');
}
const colorPrimary = getColors().COLOR_PRIMARY;
function App({ Component, pageProps }) {
const { initialApolloState, initialQueryState } = pageProps;
const apolloClient = useMemo(() => initializeApollo(initialApolloState), [initialApolloState]);
@ -36,15 +38,24 @@ function App({ Component, pageProps }) {
</Head>
<GlobalStyle />
<StoreProvider {...pageProps}>
<AntdConfig>
<ApolloProvider client={apolloClient}>
<QueryClientProvider client={queryClient}>
<ApolloProvider client={apolloClient}>
<QueryClientProvider client={queryClient}>
<AntdConfig
theme={{
token: {
borderRadius: 2,
borderRadiusLG: 2,
colorLink: colorPrimary,
colorPrimary,
},
}}
>
<Layout>
<Component {...pageProps} />
</Layout>
</QueryClientProvider>
</ApolloProvider>
</AntdConfig>
</AntdConfig>
</QueryClientProvider>
</ApolloProvider>
</StoreProvider>
</ThemeProvider>
);

View File

@ -27,7 +27,7 @@ export default class Validation {
public removeError = ({ key }: Pick<ValidationError, 'key'>) => {
const error = [...this.errors].find((x) => x.key === key);
if (error) this.errors.delete(error);
if (this.errors.size === 0) notification.close(this.params.err_key);
if (this.errors.size === 0) notification.destroy(this.params.err_key);
};
public setError = ({ key, message, silent }: ValidationParams) => {
@ -49,6 +49,6 @@ export default class Validation {
public clearErrors = () => {
this.errors.clear();
notification.close(this.params.err_key);
notification.destroy(this.params.err_key);
};
}

View File

@ -1,6 +0,0 @@
import { ConfigProvider } from 'antd';
import ru_RU from 'antd/lib/locale/ru_RU';
export function Config({ children }) {
return <ConfigProvider locale={ru_RU}>{children}</ConfigProvider>;
}

View File

@ -0,0 +1,14 @@
import { ConfigProvider } from 'antd';
import type { ConfigProviderProps } from 'antd/es/config-provider';
import ru_RU from 'antd/lib/locale/ru_RU';
import type { ReactNode } from 'react';
function AntdConfig({ children, ...config }: ConfigProviderProps & { children: ReactNode }) {
return (
<ConfigProvider {...config} locale={ru_RU}>
{children}
</ConfigProvider>
);
}
export default AntdConfig;

View File

@ -1 +0,0 @@
@import 'antd/dist/antd.less';

View File

@ -19,8 +19,8 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@ant-design/icons": "4.8.0",
"antd": "4.24.7",
"@ant-design/icons": "^5.1.4",
"antd": "^5.6.3",
"rebass": "^4.0.7",
"styled-components": "^5.3.6",
"use-debounce": "^9.0.3"

721
yarn.lock

File diff suppressed because it is too large Load Diff