Skip to content

Commit

Permalink
refactor: use import type instead of import
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid committed Jan 14, 2025
1 parent a6879e3 commit 758b0f6
Show file tree
Hide file tree
Showing 145 changed files with 259 additions and 505 deletions.
2 changes: 1 addition & 1 deletion client/src/components/DataListView/DataListView.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Typography, Chip } from '@mui/material';
import { CollectionFullObject } from '@server/types';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material';
import { formatFieldType } from '@/utils';
import DataView from '@/components/DataView/DataView';
import { DYNAMIC_FIELD } from '@/consts';
import CopyButton from '@/components/advancedSearch/CopyButton';
import type { CollectionFullObject } from '@server/types';

interface DataListViewProps {
collection: CollectionFullObject;
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/advancedSearch/Condition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React, { useState, useEffect, FC, useMemo } from 'react';
import { Theme, IconButton, TextField, SelectChangeEvent } from '@mui/material';
import { makeStyles } from '@mui/styles';
import CloseIcon from '@mui/icons-material/Close';
import { ConditionProps } from './Types';
import CustomSelector from '../customSelector/CustomSelector';
import { LOGICAL_OPERATORS, DataTypeStringEnum } from '@/consts';
import { formatValue, checkValue } from './utils';
import { FieldObject } from '@server/types';
import type { ConditionProps } from './Types';
import type { FieldObject } from '@server/types';

const Condition: FC<ConditionProps> = props => {
const {
Expand Down Expand Up @@ -161,7 +161,7 @@ const useStyles = makeStyles((theme: Theme) => ({
wrapper: {
minWidth: '466px',
minHeight: '62px',
background: theme.palette.background.paper,
background: theme.palette.background.paper,
padding: theme.spacing(1.5, 2),
display: 'flex',
flexDirection: 'row',
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/advancedSearch/ConditionGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ToggleButton, ToggleButtonGroup } from '@mui/lab';
import ConditionItem from './Condition';
import icons from '../icons/Icons';
import CustomButton from '../customButton/CustomButton';
import {
import type {
ConditionGroupProps,
BinaryLogicalOpProps,
AddConditionProps,
Expand Down Expand Up @@ -219,11 +219,11 @@ const useStyles = makeStyles((theme: Theme) => ({
},
'& button.Mui-selected': {
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary
color: theme.palette.text.primary,
},
'& button.Mui-selected:hover': {
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary
color: theme.palette.text.primary,
},
},
}));
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/advancedSearch/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, FC } from 'react';
import { Theme } from '@mui/material';
import { makeStyles } from '@mui/styles';
import { CopyButtonProps } from './Types';
import icons from '../icons/Icons';
import CustomIconButton from '../customButton/CustomIconButton';
import { useTranslation } from 'react-i18next';
import type { CopyButtonProps } from './Types';

const CopyIcon = icons.copyExpression;

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/advancedSearch/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ConditionGroup from './ConditionGroup';
import icons from '../icons/Icons';
import CopyBtn from './CopyButton';
// import DialogTemplate from '../customDialog/DialogTemplate';
import { DialogProps } from './Types';
import type { DialogProps } from './Types';

const AdvancedDialog = (props: DialogProps) => {
// i18n
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/advancedSearch/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next';
import icons from '@/components/icons/Icons';
import { generateIdByHash } from '@/utils/Common';
import AdvancedDialog from './Dialog';
import { FilterProps, ConditionData } from './Types';
import CustomButton from '../customButton/CustomButton';
import type { FilterProps, ConditionData } from './Types';

const Filter = forwardRef((props: FilterProps, ref) => {
const {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/advancedSearch/Types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FieldObject } from '@server/types';
import type { FieldObject } from '@server/types';

export interface ConditionProps {
others?: object;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/cards/EmptyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react';
import { Theme, Typography, CardContent } from '@mui/material';
import { makeStyles } from '@mui/styles';
import StatusIcon, { LoadingType } from '@/components/status/StatusIcon';
import { EmptyCardProps } from './Types';
import type { EmptyCardProps } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/code/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import CopyButton from '../advancedSearch/CopyButton';
import SyntaxHighlighter from 'react-syntax-highlighter';
import { vs2015, github } from 'react-syntax-highlighter/dist/esm/styles/hljs';
import { FC } from 'react';
import { CodeBlockProps } from './Types';
import { makeStyles } from '@mui/styles';
import type { CodeBlockProps } from './Types';

const getStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/code/CodeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Theme, Typography } from '@mui/material';
import { FC } from 'react';
import { useTranslation } from 'react-i18next';
import CustomTabList from '../customTabList/CustomTabList';
import { ITab } from '../customTabList/Types';
import CodeBlock from './CodeBlock';
import { CodeViewProps } from './Types';
import { makeStyles } from '@mui/styles';
import type { ITab } from '../customTabList/Types';

const getStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customDialog/CustomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
Theme,
Typography,
} from '@mui/material';
import { CustomDialogType } from './Types';
import { useTranslation } from 'react-i18next';
import CustomButton from '../customButton/CustomButton';
import CustomDialogTitle from './CustomDialogTitle';
import { makeStyles } from '@mui/styles';
import type { CustomDialogType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
paper: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customDialog/DialogTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
Theme,
CircularProgress,
} from '@mui/material';
import { DialogContainerProps } from './Types';
import CustomDialogTitle from './CustomDialogTitle';
import CustomButton from '../customButton/CustomButton';
import CodeView from '../code/CodeView';
import { makeStyles } from '@mui/styles';
import type { DialogContainerProps } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/customDrawer/CustomDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// CustomDrawer.tsx
import React, { useContext } from 'react';
import { Drawer, Box, Typography, Button } from '@mui/material';
import { useContext } from 'react';
import { Drawer, Box, Button } from '@mui/material';
import { rootContext } from '@/context';

const CustomDrawer = () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customInput/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { makeStyles } from '@mui/styles';
import Icons from '../icons/Icons';
import { ReactElement } from 'react';
import {
import type {
IAdornmentConfig,
IIconConfig,
ITextfieldConfig,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeStyles } from '@mui/styles';
import { useRef, FC, useState, useEffect, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import Icons from '../icons/Icons';
import { SearchType } from './Types';
import type { SearchType } from './Types';

const useSearchStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@mui/material';
import { makeStyles } from '@mui/styles';
import { FC } from 'react';
import { GroupOption, ICustomGroupSelect } from './Types';
import type { GroupOption, ICustomGroupSelect } from './Types';

const getStyles = makeStyles((theme: Theme) => ({
wrapper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Checkbox,
} from '@mui/material';
import { withStyles } from '@mui/styles';
import { CustomMultiSelectorType } from './Types';
import { generateId } from '../../utils/Common';
import type { CustomMultiSelectorType } from './Types';

const CustomMenuItem = withStyles({
root: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customSelector/CustomSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react';
import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
import { CustomSelectorType } from './Types';
import { generateId } from '../../utils/Common';
import type { CustomSelectorType } from './Types';

const CustomSelector: FC<CustomSelectorType> = props => {
const {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customSnackBar/CustomSnackBar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { forwardRef, FC } from 'react';
import { CustomSnackBarType } from './Types';
import MuiAlert from '@mui/material/Alert';
import { Snackbar, Theme, AlertProps } from '@mui/material';
import Slide, { SlideProps } from '@mui/material/Slide';
import { makeStyles } from '@mui/styles';
import type { CustomSnackBarType } from './Types';

// if we need to use slide component
// snackbar content must use forwardRef to wrapper it
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customSwitch/CustomSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FormControlLabel, Switch, Theme } from '@mui/material';
import { FC } from 'react';
import { useTranslation } from 'react-i18next';
import { CustomSwitchProps } from './Types';
import { makeStyles } from '@mui/styles';
import type { CustomSwitchProps } from './Types';

const getStyles = makeStyles((theme: Theme) => ({
label: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customTabList/CustomTabList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box, Tab, Tabs } from '@mui/material';
import { FC, useState } from 'react';
import { ITabListProps, ITabPanel } from './Types';
import { useStyles } from './style';
import type { ITabListProps, ITabPanel } from './Types';

const TabPanel = (props: ITabPanel) => {
const { children, value, index, className = '', ...other } = props;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customTabList/RouteTabList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box, Tab, Tabs } from '@mui/material';
import { FC } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { ITabListProps, ITabPanel } from './Types';
import { useStyles } from './style';
import type { ITabListProps, ITabPanel } from './Types';

const TabPanel = (props: ITabPanel) => {
const { children, value, index, className = '', ...other } = props;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/customToolTip/CustomToolTip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Tooltip from '@mui/material/Tooltip';
import { CustomToolTipType } from './Types';
import { FC } from 'react';
import { Theme } from '@mui/material';
import { makeStyles } from '@mui/styles';
import type { CustomToolTipType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
tooltip: {},
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react';
import { IconButton, Theme, Button, Typography } from '@mui/material';
import { makeStyles } from '@mui/styles';
import Icons from '../icons/Icons';
import { ActionBarType } from './Types';
import type { ActionBarType } from './Types';
import CustomToolTip from '../customToolTip/CustomToolTip';

const useStyles = makeStyles((theme: Theme) => ({
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/grid/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, MouseEvent, useRef, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Typography from '@mui/material/Typography';
import { Theme } from '@mui/material/styles/createTheme';
import Grid from '@mui/material/Grid';
Expand All @@ -7,9 +8,8 @@ import TablePagination from '@mui/material/TablePagination';
import { makeStyles } from '@mui/styles';
import CustomToolbar from './ToolBar';
import Table from './Table';
import { AttuGridType } from './Types';
import { useTranslation } from 'react-i18next';
import TablePaginationActions from './TablePaginationActions';
import type { AttuGridType } from './Types';

const userStyle = makeStyles((theme: Theme) => ({
loading: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TableContainer from '@mui/material/TableContainer';
import TableRow from '@mui/material/TableRow';
import Checkbox from '@mui/material/Checkbox';
import { makeStyles } from '@mui/styles';
import { TableType } from './Types';
import type { TableType } from './Types';
import { Box, Button, Typography, Theme } from '@mui/material';
import EnhancedTableHead from './TableHead';
import EditableTableHead from './TableEditableHead';
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/TableEditableHead.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react';
import { TableEditableHeadType } from './Types';
import { TableHead, TableRow, TableCell, Theme } from '@mui/material';
import { makeStyles } from '@mui/styles';
import type { TableEditableHeadType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
tableCell: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/TableHead.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FC } from 'react';
import React from 'react';
import { TableHeadType } from './Types';
import {
TableHead,
TableRow,
Expand All @@ -11,6 +10,7 @@ import {
Theme,
} from '@mui/material';
import { makeStyles } from '@mui/styles';
import type { TableHeadType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
visuallyHidden: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/TablePaginationActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import CustomButton from '../customButton/CustomButton';
import icons from '../icons/Icons';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { TablePaginationActionsProps } from './Types';
import { makeStyles } from '@mui/styles';
import type { TablePaginationActionsProps } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
root: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/TableSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Theme } from '@mui/material';
import { FC, useState } from 'react';
import Icons from '../icons/Icons';
import { TableSwitchType } from './Types';
import { makeStyles } from '@mui/styles';
import type { TableSwitchType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
root: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/grid/ToolBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { FC, useMemo } from 'react';
import { Grid, Typography, Theme, IconButton } from '@mui/material';
import CustomButton from '../customButton/CustomButton';
import Icons from '../icons/Icons';
import { ToolBarConfig, ToolBarType } from './Types';
import SearchInput from '../customInput/SearchInput';
import TableSwitch from './TableSwitch';
import { throwErrorForDev } from '../../utils/Common';
import CustomIconButton from '../customButton/CustomIconButton';
import { makeStyles } from '@mui/styles';
import type { ToolBarConfig, ToolBarType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
countLabel: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/icons/Icons.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { IconsType } from './Types';
import { SvgIcon } from '@mui/material';
import AppsIcon from '@mui/icons-material/Apps';
import CancelIcon from '@mui/icons-material/Cancel';
import ConsoleIcon from '@/assets/icons/console.svg?react';
import KeyIcon from '@/assets/icons/key.svg?react';
import SearchEmptyIcon from '@/assets/icons/search.svg?react';
import Compact from '@/assets/icons/compact.svg?react';
import type { IconsType } from './Types';

const icons: { [x in IconsType]: (props?: any) => React.ReactElement } = {
search: (props = {}) => (
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/menu/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Tooltip from '@mui/material/Tooltip';
import ListItemIcon from '@mui/material/ListItemIcon';
import { NavMenuItem, NavMenuType } from './Types';
import Typography from '@mui/material/Typography';
import { makeStyles } from '@mui/styles';
import icons from '@/components/icons/Icons';
import type { NavMenuItem, NavMenuType } from './Types';

const useStyles = makeStyles((theme: Theme) => ({
root: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/menu/SimpleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React from 'react';
import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import { generateId } from '../../utils/Common';
import { SimpleMenuType } from './Types';
import CustomButton from '../customButton/CustomButton';
import { Theme } from '@mui/material';
import { makeStyles } from '@mui/styles';
import type { SimpleMenuType } from './Types';

const getStyles = makeStyles((theme: Theme) => ({
menuPaper: {
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/status/Types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { LOADING_STATE } from '@/consts';
import { CollectionObject } from '@server/types';
import React from 'react';
import type { CollectionObject } from '@server/types';

export type StatusActionType = {
status: LOADING_STATE;
Expand Down
Loading

0 comments on commit 758b0f6

Please sign in to comment.