chore: adjust type

This commit is contained in:
GyDi
2022-11-19 17:22:29 +08:00
parent e19fe5ce1c
commit 6eafb15cf9
26 changed files with 274 additions and 283 deletions

View File

@@ -23,7 +23,7 @@ const Tag = styled("span")(({ theme }) => ({
}));
interface Props {
value: ApiType.ConnectionsItem;
value: IConnectionsItem;
}
const ConnectionItem = (props: Props) => {

View File

@@ -4,7 +4,7 @@ import { DataGrid, GridColDef } from "@mui/x-data-grid";
import parseTraffic from "@/utils/parse-traffic";
interface Props {
connections: ApiType.ConnectionsItem[];
connections: IConnectionsItem[];
}
const ConnectionTable = (props: Props) => {

View File

@@ -45,7 +45,7 @@ const LayoutTraffic = () => {
ws = new WebSocket(`ws://${server}/traffic?token=${secret}`);
ws.addEventListener("message", (event) => {
const data = JSON.parse(event.data) as ApiType.TrafficItem;
const data = JSON.parse(event.data) as ITrafficItem;
trafficRef.current?.appendData(data);
setTraffic(data);
});

View File

@@ -21,7 +21,7 @@ export default function useLogSetup() {
getClashLogs().then(setLogData);
const handler = (event: MessageEvent<any>) => {
const data = JSON.parse(event.data) as ApiType.LogItem;
const data = JSON.parse(event.data) as ILogItem;
const time = dayjs().format("MM-DD HH:mm:ss");
setLogData((l) => {
if (l.length >= MAX_LOG_NUM) l.shift();

View File

@@ -20,7 +20,7 @@ const Item = styled(Box)(({ theme }) => ({
}));
interface Props {
value: ApiType.LogItem;
value: ILogItem;
}
const LogItem = (props: Props) => {

View File

@@ -14,7 +14,7 @@ import ProfileMore from "./profile-more";
import Notice from "../base/base-notice";
interface Props {
items: CmdType.ProfileItem[];
items: IProfileItem[];
chain: string[];
}

View File

@@ -21,7 +21,7 @@ import Notice from "../base/base-notice";
interface Props {
open: boolean;
itemData: CmdType.ProfileItem;
itemData: IProfileItem;
onClose: () => void;
}

View File

@@ -29,7 +29,7 @@ const round = keyframes`
interface Props {
selected: boolean;
itemData: CmdType.ProfileItem;
itemData: IProfileItem;
onSelect: (force: boolean) => void;
}
@@ -117,7 +117,7 @@ const ProfileItem = (props: Props) => {
setAnchorEl(null);
setLoadingCache((cache) => ({ ...cache, [itemData.uid]: true }));
const option: Partial<CmdType.ProfileOption> = {};
const option: Partial<IProfileOption> = {};
if (type === 0) {
option.with_proxy = false;

View File

@@ -21,7 +21,7 @@ import Notice from "../base/base-notice";
interface Props {
selected: boolean;
itemData: CmdType.ProfileItem;
itemData: IProfileItem;
enableNum: number;
logInfo?: [string, string][];
onEnable: () => void;

View File

@@ -13,7 +13,7 @@ import ProxyItem from "./proxy-item";
interface Props {
groupName: string;
curProxy?: string;
proxies: ApiType.ProxyItem[];
proxies: IProxyItem[];
}
// this component will be used for DIRECT/GLOBAL

View File

@@ -30,7 +30,7 @@ import ProxyHead from "./proxy-head";
import ProxyItem from "./proxy-item";
interface Props {
group: ApiType.ProxyGroupItem;
group: IProxyGroupItem;
}
const ProxyGroup = ({ group }: Props) => {

View File

@@ -17,7 +17,7 @@ import BaseLoading from "../base/base-loading";
interface Props {
groupName: string;
proxy: ApiType.ProxyItem;
proxy: IProxyItem;
selected: boolean;
showType?: boolean;
sx?: SxProps<Theme>;

View File

@@ -5,7 +5,7 @@ import delayManager from "@/services/delay";
export type ProxySortType = 0 | 1 | 2;
export default function useFilterSort(
proxies: ApiType.ProxyItem[],
proxies: IProxyItem[],
groupName: string,
filterText: string,
sortType: ProxySortType
@@ -47,7 +47,7 @@ const regex2 = /type=(.*)/i;
* according to the regular conditions
*/
function filterProxies(
proxies: ApiType.ProxyItem[],
proxies: IProxyItem[],
groupName: string,
filterText: string
) {
@@ -87,7 +87,7 @@ function filterProxies(
* sort the proxy
*/
function sortProxies(
proxies: ApiType.ProxyItem[],
proxies: IProxyItem[],
groupName: string,
sortType: ProxySortType
) {

View File

@@ -19,7 +19,7 @@ const COLOR = [
interface Props {
index: number;
value: ApiType.RuleItem;
value: IRuleItem;
}
const parseColor = (text: string) => {

View File

@@ -89,7 +89,7 @@ const SysproxyViewer = ({ handler }: Props) => {
return;
}
const patch: Partial<CmdType.VergeConfig> = {};
const patch: Partial<IVergeConfig> = {};
if (value.guard !== enable_proxy_guard) {
patch.enable_proxy_guard = value.guard;

View File

@@ -1,7 +1,7 @@
import { useTranslation } from "react-i18next";
import { Button, ButtonGroup } from "@mui/material";
type ThemeValue = CmdType.VergeConfig["theme_mode"];
type ThemeValue = IVergeConfig["theme_mode"];
interface Props {
value?: ThemeValue;

View File

@@ -46,10 +46,10 @@ const SettingClash = ({ onError }: Props) => {
const controllerHandler = useModalHandler();
const onSwitchFormat = (_e: any, value: boolean) => value;
const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
const onChangeData = (patch: Partial<IConfigData>) => {
mutateClash((old) => ({ ...(old! || {}), ...patch }), false);
};
const onUpdateData = async (patch: Partial<ApiType.ConfigData>) => {
const onUpdateData = async (patch: Partial<IConfigData>) => {
await updateConfigs(patch);
await patchClashConfig(patch);
};

View File

@@ -46,7 +46,7 @@ const SettingSystem = ({ onError }: Props) => {
} = vergeConfig ?? {};
const onSwitchFormat = (_e: any, value: boolean) => value;
const onChangeData = (patch: Partial<CmdType.VergeConfig>) => {
const onChangeData = (patch: Partial<IVergeConfig>) => {
mutateVerge({ ...vergeConfig, ...patch }, false);
};

View File

@@ -42,7 +42,7 @@ const SettingVerge = ({ onError }: Props) => {
const [configOpen, setConfigOpen] = useState(false);
const onSwitchFormat = (_e: any, value: boolean) => value;
const onChangeData = (patch: Partial<CmdType.VergeConfig>) => {
const onChangeData = (patch: Partial<IVergeConfig>) => {
mutateVerge({ ...vergeConfig, ...patch }, false);
};