project: organize ui modules exports

This commit is contained in:
vchikalkin 2023-04-12 12:40:37 +03:00
parent aabc61842a
commit 4215310adf
39 changed files with 54 additions and 72 deletions

View File

@ -3,9 +3,8 @@ import { useStore } from '@/stores/hooks';
import { toJS } from 'mobx';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import { Flex } from 'ui';
import Alert from 'ui/elements/Alert';
import Table from 'ui/elements/Table';
import { Alert, Table } from 'ui/elements';
import { Flex } from 'ui/grid';
const Grid = styled(Flex)`
flex-direction: column;

View File

@ -4,8 +4,8 @@ import type * as Insurance from './types';
import { MAX_INSURANCE } from '@/constants/values';
import type { ColumnsType } from 'antd/lib/table';
import { parser } from 'tools/number';
import InputNumber, { createFormatter } from 'ui/elements/InputNumber';
import Select from 'ui/elements/Select';
import { InputNumber, Select } from 'ui/elements';
import { createFormatter } from 'ui/elements/InputNumber';
export const columns: ColumnsType<Insurance.RowValues> = [
{

View File

@ -2,9 +2,8 @@ import { columns } from './config';
import { useStore } from '@/stores/hooks';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import { Flex } from 'ui';
import Alert from 'ui/elements/Alert';
import Table from 'ui/elements/Table';
import { Alert, Table } from 'ui/elements';
import { Flex } from 'ui/grid';
const Grid = styled(Flex)`
flex-direction: column;

View File

@ -2,7 +2,7 @@ import renderFormRows from '../../lib/render-rows';
import { id, rows, title } from './config';
import FinGAPTable from './FinGAPTable';
import InsuranceTable from './InsuranceTable';
import { Flex } from 'ui';
import { Flex } from 'ui/elements';
function Insurance() {
const renderedRows = renderFormRows(rows);

View File

@ -2,7 +2,7 @@ import elementsRender from '../../config/elements-render';
import { elements } from './config';
import { useStore } from '@/stores/hooks';
import { observer } from 'mobx-react-lite';
import { Flex } from 'ui';
import { Flex } from 'ui/elements';
function PaymentsParams() {
const renderedElements = elements.map((elementName) => {

View File

@ -1,7 +1,7 @@
/* eslint-disable canonical/sort-keys */
import { buildValueComponent } from './builders';
import type { ColumnsType } from 'antd/lib/table';
import InputNumber from 'ui/elements/InputNumber';
import { InputNumber } from 'ui/elements';
type Payment = {
key: number;

View File

@ -4,8 +4,7 @@ import { min } from '@/styles/mq';
import { computed } from 'mobx';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import Alert from 'ui/elements/Alert';
import Table from 'ui/elements/Table';
import { Alert, Table } from 'ui/elements';
import { Box, Flex } from 'ui/grid';
const Grid = styled(Flex)`

View File

@ -9,7 +9,7 @@ import Unlimited from './Unlimited';
import Background from '@/Components/Layout/Background';
import { min } from '@/styles/mq';
import styled from 'styled-components';
import Tabs from 'ui/elements/layout/Tabs';
import { Tabs } from 'ui/elements';
const formTabs = [
Leasing,

View File

@ -10,9 +10,8 @@ import { useStore } from '@/stores/hooks';
import { useIsFetching } from '@tanstack/react-query';
import { observer } from 'mobx-react-lite';
import type { ComponentProps } from 'react';
import { Link, Tooltip } from 'ui/elements';
import { LoadingOutlined } from 'ui/elements/icons';
import Link from 'ui/elements/Link';
import Tooltip from 'ui/elements/Tooltip';
const defaultLinkProps: ComponentProps<typeof Link> = {
text: 'Открыть в CRM',

View File

@ -1,9 +1,8 @@
/* eslint-disable react/no-array-index-key */
import elementsRender from '../config/elements-render';
import type { Elements as ActionElements } from '../config/map/actions';
import type { Elements as ValuesElements } from '../config/map/values';
import Divider from 'ui/elements/layout/Divider';
import { Divider } from 'ui/elements';
import type { BoxProps } from 'ui/grid';
import { Box } from 'ui/grid';

View File

@ -1,6 +1,5 @@
/* eslint-disable sonarjs/no-small-switch */
import Button from 'ui/elements/Button';
import Result from 'ui/elements/Result';
import { Button, Result } from 'ui/elements';
function handleRetry() {
window.location.reload();

View File

@ -3,7 +3,7 @@ import { STALE_TIME } from '@/constants/request';
import { min } from '@/styles/mq';
import { useQuery } from '@tanstack/react-query';
import styled from 'styled-components';
import { Flex } from 'ui';
import { Flex } from 'ui/grid';
const UserText = styled.span`
margin: 0;

View File

@ -2,7 +2,7 @@
import { min } from '@/styles/mq';
import type { ReactNode } from 'react';
import styled from 'styled-components';
import { Flex } from 'ui';
import { Flex } from 'ui/grid';
const ElementTitle = styled.label`
color: rgba(0, 0, 0, 0.75);

View File

@ -2,7 +2,7 @@ import Auth from './Auth';
import Logo from './Logo';
import { min } from '@/styles/mq';
import styled from 'styled-components';
import { Flex } from 'ui';
import { Flex } from 'ui/grid';
const HeaderContent = styled(Flex)`
flex-direction: row;

View File

@ -7,7 +7,8 @@ import { observer } from 'mobx-react-lite';
import Image from 'next/image';
import logo from 'public/assets/images/logo-primary.svg';
import styled from 'styled-components';
import { Flex, Tag } from 'ui';
import { Tag } from 'ui/elements';
import { Flex } from 'ui/grid';
const ImageWrapper = styled.div`
width: 100px;

View File

@ -1,5 +1,5 @@
import Header from './Header';
import { Flex } from 'ui';
import { Flex } from 'ui/grid';
export default function Layout({ children }) {
return (

View File

@ -3,7 +3,7 @@ import { MAX_LEASING_PERIOD } from '@/constants/values';
import { useStore } from '@/stores/hooks';
import { toJS } from 'mobx';
import { observer } from 'mobx-react-lite';
import Table from 'ui/elements/Table';
import { Table } from 'ui/elements';
const PaymentsTable = observer(() => {
const { $results } = useStore();

View File

@ -5,7 +5,7 @@ import { min } from '@/styles/mq';
import { toJS } from 'mobx';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import Text from 'ui/elements/Text';
import { Text } from 'ui/elements';
import { Box } from 'ui/grid';
const Grid = styled(Box)`

View File

@ -2,7 +2,7 @@
import { useStore } from '@/stores/hooks';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import Alert from 'ui/elements/Alert';
import { Alert } from 'ui/elements';
import { Box, Flex } from 'ui/grid';
const Bold = styled.span`

View File

@ -6,7 +6,7 @@ import { useStore } from '@/stores/hooks';
import { min } from '@/styles/mq';
import { observer } from 'mobx-react-lite';
import styled from 'styled-components';
import { Badge, Tabs } from 'ui';
import { Badge, Tabs } from 'ui/elements';
const outputTabs = [PaymentsTable, Results, Validation];
const items = outputTabs.map(({ Component, id, title }) => {

View File

@ -1,4 +1,5 @@
import Result from 'ui/elements/Result';
/* eslint-disable canonical/filename-match-regex */
import { Result } from 'ui/elements';
export default function NotFound() {
return <Result status="404" title="404" subTitle="Тут ничего нет" />;

View File

@ -1,6 +1,6 @@
import type { ProcessContext } from '../types';
import { toJS } from 'mobx';
import notification from 'ui/elements/notification';
import { notification } from 'ui/elements';
const key = 'ACTION_CALCULATE';
const errorMessage = 'Ошибка во время расчета графика!';

View File

@ -1,7 +1,7 @@
import { updateSelectQuote } from '../lead-opportunity/reactions/common';
import type { ProcessContext } from '../types';
import { toJS } from 'mobx';
import notification from 'ui/elements/notification';
import { notification } from 'ui/elements';
const key = 'ACTION_CREATEKP';
const errorMessage = 'Ошибка во время создания КП!';

View File

@ -7,7 +7,7 @@ import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
import { uid } from 'radash';
import { normalizeOptions } from 'tools';
import notification from 'ui/elements/notification';
import { notification } from 'ui/elements';
dayjs.extend(utc);

View File

@ -1,7 +1,7 @@
import type { ProcessContext } from '@/process/types';
import { reaction } from 'mobx';
import { omit } from 'radash';
import message from 'ui/elements/message';
import { message } from 'ui/elements';
const key = 'KP_LOADING_INFO';

View File

@ -1,7 +1,7 @@
import type RootStore from '../root';
import type { RemoveError, ValidationConfig, ValidationError, ValidationParams } from './types';
import { makeAutoObservable } from 'mobx';
import notification from 'ui/elements/notification';
import { notification } from 'ui/elements';
export default class Validation {
private root: RootStore;

View File

@ -1 +0,0 @@
export { Alert as default } from 'antd';

View File

@ -1 +0,0 @@
export { Result as default } from 'antd';

View File

@ -1 +0,0 @@
export { Table as default } from 'antd';

View File

@ -1 +0,0 @@
export { Tooltip as default } from 'antd';

View File

@ -1 +0,0 @@
export { Badge } from 'antd';

View File

@ -1,19 +1,34 @@
export * from './badge';
import { message, notification } from 'antd';
message.config({
maxCount: 3,
top: 70,
});
notification.config({
placement: 'bottomRight',
});
export { default as Button } from './Button';
export { default as Checkbox } from './Checkbox';
export { default as AntdConfig } from './Config';
export { default as Input } from './Input';
export { default as InputNumber } from './InputNumber';
export * from './layout';
export { default as Link } from './Link';
export { default as message } from './message';
export { default as notification } from './notification';
export { default as Radio } from './Radio';
export { default as Result } from './Result';
export { default as Segmented } from './Segmented';
export { default as Select } from './Select';
export { default as Switch } from './Switch';
export { default as Table } from './Table';
export * from './tag';
export { default as Text } from './Text';
export { default as Tooltip } from './Tooltip';
export {
Alert,
Badge,
Divider,
message,
notification,
Result,
Table,
Tabs,
Tag,
Tooltip,
} from 'antd';

View File

@ -1 +0,0 @@
export { Divider as default } from 'antd';

View File

@ -1 +0,0 @@
export { Tabs as default } from 'antd';

View File

@ -1,2 +0,0 @@
export { default as Divider } from './Divider';
export { default as Tabs } from './Tabs';

View File

@ -1,9 +0,0 @@
/* eslint-disable unicorn/prefer-export-from */
import { message } from 'antd';
message.config({
maxCount: 3,
top: 70,
});
export default message;

View File

@ -1,8 +0,0 @@
/* eslint-disable unicorn/prefer-export-from */
import { notification } from 'antd';
notification.config({
placement: 'bottomRight',
});
export default notification;

View File

@ -1 +0,0 @@
export { Tag } from 'antd';

View File

@ -1,2 +0,0 @@
export * from './elements';
export * from './grid';