diff --git a/src/App.tsx b/src/App.tsx index 7f7112a2d..ed5230b4f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,28 +1,29 @@ -import React, {Suspense, useContext, useEffect, useMemo, useState} from 'react'; +import {FC, Suspense, useContext, useEffect, useMemo, useState} from 'react'; import {Navigate, Route, Routes, useLocation} from 'react-router-dom'; import {useUpdate} from 'react-use'; import {config} from '@constants/config'; -import {DashboardContext, MainContext} from '@contexts'; +import {DashboardContext} from '@contexts/DashboardContext'; +import {MainContext} from '@contexts/MainContext'; -import {EndpointModal, MessagePanel, notificationCall} from '@molecules'; +import {EndpointModal} from '@molecules/EndpointModal'; +import {MessagePanel} from '@molecules/MessagePanel'; +import {notificationCall} from '@molecules/Notification'; -import { - EndpointProcessing, - Executors, - GlobalSettings, - Loading, - NotFound, - Sources, - TestSuites, - Tests, - Triggers, -} from '@pages'; +import {EndpointProcessing} from '@pages/EndpointProcessing'; +import {Executors} from '@pages/Executors'; +import {GlobalSettings} from '@pages/GlobalSettings'; +import {Loading} from '@pages/Loading'; +import {NotFound} from '@pages/NotFound'; +import {Sources} from '@pages/Sources'; +import {TestSuites} from '@pages/TestSuites'; +import {Tests} from '@pages/Tests'; +import {Triggers} from '@pages/Triggers'; -import PluginsContext from '@plugins/context'; -import createPluginManager from '@plugins/manager'; -import {Plugin} from '@plugins/types'; +import {PluginsContext} from '@plugins/context'; +import {createPluginManager} from '@plugins/manager'; +import type {Plugin} from '@plugins/types'; import {useAppDispatch} from '@redux/hooks'; import {setExecutors} from '@redux/reducers/executorsSlice'; @@ -46,7 +47,7 @@ export interface AppProps { plugins: Plugin[]; } -const App: React.FC = ({plugins}) => { +export const App: FC = ({plugins}) => { const [TriggersProvider] = initializeTriggersStore(); const dispatch = useAppDispatch(); @@ -190,5 +191,3 @@ const App: React.FC = ({plugins}) => { ); }; - -export default App; diff --git a/src/AppRoot.tsx b/src/AppRoot.tsx index d66c52d88..e09aa3c2e 100644 --- a/src/AppRoot.tsx +++ b/src/AppRoot.tsx @@ -1,4 +1,4 @@ -import {useEffect, useMemo} from 'react'; +import {FC, useEffect, useMemo} from 'react'; import {useLocation, useNavigate} from 'react-router-dom'; import {useAsync} from 'react-use'; @@ -7,21 +7,23 @@ import {Content} from 'antd/lib/layout/layout'; import FingerprintJS from '@fingerprintjs/fingerprintjs'; -import {ConfigContext, DashboardContext, MainContext} from '@contexts'; +import {ConfigContext} from '@contexts/ConfigContext'; +import {DashboardContext} from '@contexts/DashboardContext'; +import {MainContext} from '@contexts/MainContext'; import {ModalHandler, ModalOutletProvider} from '@contexts/ModalContext'; -import {FeatureFlagsProvider} from '@feature-flags'; +import {FeatureFlagsProvider} from '@feature-flags/context'; import {useAxiosInterceptors} from '@hooks/useAxiosInterceptors'; import {useLastCallback} from '@hooks/useLastCallback'; -import {Sider} from '@organisms'; +import {Sider} from '@organisms/Sider'; -import {ErrorBoundary} from '@pages'; +import {ErrorBoundary} from '@pages/ErrorBoundary'; import {BasePermissionsResolver, PermissionsProvider} from '@permissions/base'; -import {Plugin} from '@plugins/types'; +import type {Plugin} from '@plugins/types'; import {useAppDispatch} from '@redux/hooks'; @@ -33,15 +35,15 @@ import {initializeTestsStore} from '@store/tests'; import {useTelemetry, useTelemetryValue} from '@telemetry/hooks'; -import anonymizeQueryString from '@utils/anonymizeQueryString'; +import {anonymizeQueryString} from '@utils/anonymizeQueryString'; import {composeProviders} from '@utils/composeProviders'; import {externalLinks} from '@utils/externalLinks'; import {safeRefetch} from '@utils/fetchUtils'; -import App from './App'; +import {App} from './App'; import {StyledLayoutContentWrapper} from './App.styled'; -const AppRoot: React.FC = () => { +export const AppRoot: FC = () => { useAxiosInterceptors(); const dispatch = useAppDispatch(); @@ -141,5 +143,3 @@ const AppRoot: React.FC = () => { ); }; - -export default AppRoot; diff --git a/src/DashboardRewrite.tsx b/src/DashboardRewrite.tsx index c868da6e6..a0fb707cd 100644 --- a/src/DashboardRewrite.tsx +++ b/src/DashboardRewrite.tsx @@ -1,7 +1,7 @@ import {FC, useContext, useLayoutEffect} from 'react'; import {useParams} from 'react-router-dom'; -import {DashboardContext} from '@contexts'; +import {DashboardContext} from '@contexts/DashboardContext'; import {useDashboardNavigate} from '@hooks/useDashboardNavigate'; @@ -10,7 +10,7 @@ interface DashboardRewriteProps { keepQuery?: boolean; } -const DashboardRewrite: FC = ({pattern, keepQuery = false}) => { +export const DashboardRewrite: FC = ({pattern, keepQuery = false}) => { const {location} = useContext(DashboardContext); const params = useParams(); const pathname = pattern.replace(/:([^/]+)/g, (_, key) => `${params[key]}`); @@ -20,5 +20,3 @@ const DashboardRewrite: FC = ({pattern, keepQuery = false return null; }; - -export default DashboardRewrite; diff --git a/src/components/atoms/Asterisk/Asterisk.ts b/src/components/atoms/Asterisk.ts similarity index 57% rename from src/components/atoms/Asterisk/Asterisk.ts rename to src/components/atoms/Asterisk.ts index 3ed5d4f0b..7cd11aafd 100644 --- a/src/components/atoms/Asterisk/Asterisk.ts +++ b/src/components/atoms/Asterisk.ts @@ -1,8 +1,8 @@ import styled from 'styled-components'; -import Colors from '@styles/Colors'; +import {Colors} from '@styles/Colors'; -const Asterisk = styled.span` +export const Asterisk = styled.span` &::after { content: '*'; margin: 0 4px; @@ -10,5 +10,3 @@ const Asterisk = styled.span` color: ${Colors.rose500}; `; - -export default Asterisk; diff --git a/src/components/atoms/Asterisk/index.ts b/src/components/atoms/Asterisk/index.ts deleted file mode 100644 index 07a6daf39..000000000 --- a/src/components/atoms/Asterisk/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {default} from './Asterisk'; diff --git a/src/components/atoms/CommandInput/CommandInput.tsx b/src/components/atoms/CommandInput.tsx similarity index 59% rename from src/components/atoms/CommandInput/CommandInput.tsx rename to src/components/atoms/CommandInput.tsx index 898ef9a3a..e0d24aed3 100644 --- a/src/components/atoms/CommandInput/CommandInput.tsx +++ b/src/components/atoms/CommandInput.tsx @@ -1,10 +1,12 @@ +import {FC} from 'react'; + import {Input, InputProps} from 'antd'; -import {Text} from '@custom-antd'; +import {Text} from '@custom-antd/Typography/Text'; -import Colors from '@styles/Colors'; +import {Colors} from '@styles/Colors'; -const CommandInput: React.FC = props => { +export const CommandInput: FC = props => { return ( = props => { /> ); }; - -export default CommandInput; diff --git a/src/components/atoms/CommandInput/index.ts b/src/components/atoms/CommandInput/index.ts deleted file mode 100644 index b2031e1fe..000000000 --- a/src/components/atoms/CommandInput/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {default} from './CommandInput'; diff --git a/src/components/atoms/CopyButton/CopyButton.styled.tsx b/src/components/atoms/CopyButton.styled.tsx similarity index 93% rename from src/components/atoms/CopyButton/CopyButton.styled.tsx rename to src/components/atoms/CopyButton.styled.tsx index c0d07969b..e70bffc85 100644 --- a/src/components/atoms/CopyButton/CopyButton.styled.tsx +++ b/src/components/atoms/CopyButton.styled.tsx @@ -2,7 +2,7 @@ import {CheckOutlined, CopyOutlined} from '@ant-design/icons'; import styled from 'styled-components'; -import Colors from '@styles/Colors'; +import {Colors} from '@styles/Colors'; const CopyIconBaseStyles = ` position: absolute; diff --git a/src/components/atoms/CopyButton/CopyButton.tsx b/src/components/atoms/CopyButton.tsx similarity index 79% rename from src/components/atoms/CopyButton/CopyButton.tsx rename to src/components/atoms/CopyButton.tsx index ffc79771b..1a96cc240 100644 --- a/src/components/atoms/CopyButton/CopyButton.tsx +++ b/src/components/atoms/CopyButton.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import {FC} from 'react'; import {Tooltip} from 'antd'; @@ -6,7 +6,7 @@ import {useCopyToClipboard} from '@hooks/useCopyToClipboard'; import {StyledCheckOutlined, StyledCopyOutlined} from './CopyButton.styled'; -const CopyButton: React.FC<{content: string | (() => string); onClick?: () => void}> = props => { +export const CopyButton: FC<{content: string | (() => string); onClick?: () => void}> = props => { const {content, onClick} = props; const {isCopied, setCopyToClipboardState} = useCopyToClipboard(content); @@ -21,5 +21,3 @@ const CopyButton: React.FC<{content: string | (() => string); onClick?: () => vo ); }; - -export default CopyButton; diff --git a/src/components/atoms/CopyButton/index.ts b/src/components/atoms/CopyButton/index.ts deleted file mode 100644 index fe98b9a50..000000000 --- a/src/components/atoms/CopyButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {default} from './CopyButton'; diff --git a/src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.styled.tsx b/src/components/atoms/CreatableMultiSelect.styled.tsx similarity index 96% rename from src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.styled.tsx rename to src/components/atoms/CreatableMultiSelect.styled.tsx index 1b050873c..889961012 100644 --- a/src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.styled.tsx +++ b/src/components/atoms/CreatableMultiSelect.styled.tsx @@ -2,9 +2,9 @@ import {GroupBase, StylesConfig, ThemeConfig} from 'react-select'; import styled from 'styled-components'; -import {Option} from '@models/form'; +import type {Option} from '@models/form'; -import Colors from '@styles/Colors'; +import {Colors} from '@styles/Colors'; export const StyledOption = styled.div` padding: 6px 12px; diff --git a/src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.tsx b/src/components/atoms/CreatableMultiSelect.tsx similarity index 76% rename from src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.tsx rename to src/components/atoms/CreatableMultiSelect.tsx index 89a3275f8..c09340584 100644 --- a/src/components/atoms/CreatableMultiSelect/CreatableMultiSelect.tsx +++ b/src/components/atoms/CreatableMultiSelect.tsx @@ -1,18 +1,16 @@ -import React, {KeyboardEvent, useRef} from 'react'; +import {FC, KeyboardEvent, useRef} from 'react'; import {MultiValueGenericProps, OptionProps} from 'react-select'; import CreatableSelect from 'react-select/creatable'; -import usePressEnter from '@hooks/usePressEnter'; +import {usePressEnter} from '@hooks/usePressEnter'; -import {Option} from '@models/form'; +import type {Option} from '@models/form'; import {customStyles, customTheme} from './CreatableMultiSelect.styled'; -import { - DefaultDropdownIndicator, - DefaultMultiValueLabel, - DefaultMultiValueRemove, - DefaultOptionComponent, -} from './DefaultComponents'; +import {DropdownIndicator as DefaultDropdownIndicator} from './CreatableMultiSelect/DefaultComponents/DropdownIndicator'; +import {MultiValueLabel as DefaultMultiValueLabel} from './CreatableMultiSelect/DefaultComponents/MultiValueLabel'; +import {MultiValueRemove as DefaultMultiValueRemove} from './CreatableMultiSelect/DefaultComponents/MultiValueRemove'; +import {MultiValueLabel as DefaultOptionComponent} from './CreatableMultiSelect/DefaultComponents/Option'; type MultiSelectProps = { options?: Option[]; @@ -30,7 +28,7 @@ type MultiSelectProps = { menuPlacement?: 'auto' | 'bottom' | 'top'; }; -const CreatableMultiSelect: React.FC = props => { +export const CreatableMultiSelect: FC = props => { const { options, placeholder, @@ -92,4 +90,3 @@ const CreatableMultiSelect: React.FC = props => { /> ); }; -export default CreatableMultiSelect; diff --git a/src/components/atoms/CreatableMultiSelect/CustomComponents/LabelsMultiValueLabel.tsx b/src/components/atoms/CreatableMultiSelect/CustomComponents/LabelsMultiValueLabel.tsx index 244771977..d6b36cbce 100644 --- a/src/components/atoms/CreatableMultiSelect/CustomComponents/LabelsMultiValueLabel.tsx +++ b/src/components/atoms/CreatableMultiSelect/CustomComponents/LabelsMultiValueLabel.tsx @@ -1,12 +1,11 @@ import {MultiValueGenericProps} from 'react-select'; -import {SplitLabelText} from '@atoms'; +import {StyledMultiLabel} from '@atoms/CreatableMultiSelect.styled'; +import {SplitLabelText} from '@atoms/SplitLabelText'; -import {Option} from '@models/form'; +import type {Option} from '@models/form'; -import {StyledMultiLabel} from '../CreatableMultiSelect.styled'; - -const LabelsMultiValueLabel = (props: MultiValueGenericProps