Refactor imports and improve code organization across multiple components and hooks
- Consolidated and reordered imports in various files for better readability and maintainability. - Removed unused imports and ensured consistent import styles. - Enhanced the structure of components by grouping related imports together. - Updated the layout and organization of hooks to streamline functionality. - Improved the overall code quality by following best practices in import management.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { useLockFn } from "ahooks";
|
||||
import useSWR, { mutate } from "swr";
|
||||
|
||||
import { getVersion } from "@/services/cmds";
|
||||
import {
|
||||
getClashInfo,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { useAppData } from "@/providers/app-data-provider";
|
||||
|
||||
// 定义代理组类型
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { useState, useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { changeLanguage, supportedLanguages } from "@/services/i18n";
|
||||
|
||||
import { useVerge } from "./use-verge";
|
||||
|
||||
import { changeLanguage, supportedLanguages } from "@/services/i18n";
|
||||
|
||||
export const useI18n = () => {
|
||||
const { i18n, t } = useTranslation();
|
||||
const { patchVerge } = useVerge();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { listen, UnlistenFn, EventCallback } from "@tauri-apps/api/event";
|
||||
import { event } from "@tauri-apps/api";
|
||||
import { listen, UnlistenFn, EventCallback } from "@tauri-apps/api/event";
|
||||
import { useRef } from "react";
|
||||
|
||||
export const useListen = () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import useSWR, { mutate } from "swr";
|
||||
|
||||
import {
|
||||
getProfiles,
|
||||
patchProfile,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useLockFn } from "ahooks";
|
||||
import { useCallback, useMemo } from "react";
|
||||
|
||||
import { useProfiles } from "@/hooks/use-profiles";
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
import {
|
||||
updateProxy,
|
||||
updateProxyAndSync,
|
||||
@@ -8,8 +11,6 @@ import {
|
||||
getConnections,
|
||||
deleteConnection,
|
||||
} from "@/services/cmds";
|
||||
import { useProfiles } from "@/hooks/use-profiles";
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
|
||||
// 缓存连接清理
|
||||
const cleanupConnections = async (previousProxy: string) => {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import useSWR, { mutate } from "swr";
|
||||
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
import { getAutotemProxy } from "@/services/cmds";
|
||||
import { useAppData } from "@/providers/app-data-provider";
|
||||
import { getAutotemProxy } from "@/services/cmds";
|
||||
import { closeAllConnections } from "@/services/cmds";
|
||||
|
||||
// 系统代理状态检测统一逻辑
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import useSWR from "swr";
|
||||
|
||||
import { getRunningMode, isAdmin, isServiceAvailable } from "@/services/cmds";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect, useRef, useCallback } from "react";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useClashInfo } from "@/hooks/use-clash";
|
||||
import { useVisibility } from "@/hooks/use-visibility";
|
||||
import { getSystemMonitorOverviewSafe } from "@/services/cmds";
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import useSWR from "swr";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getVergeConfig, patchVergeConfig } from "@/services/cmds";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useSystemState } from "@/hooks/use-system-state";
|
||||
import { getVergeConfig, patchVergeConfig } from "@/services/cmds";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
|
||||
export const useVerge = () => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { installService, restartCore } from "@/services/cmds";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { t } from "i18next";
|
||||
import { useCallback } from "react";
|
||||
|
||||
import { installService, restartCore } from "@/services/cmds";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
|
||||
const executeWithErrorHandling = async (
|
||||
operation: () => Promise<void>,
|
||||
loadingMessage: string,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { t } from "i18next";
|
||||
import { useCallback } from "react";
|
||||
|
||||
import { useSystemState } from "./use-system-state";
|
||||
|
||||
import { restartCore, stopCore, uninstallService } from "@/services/cmds";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { t } from "i18next";
|
||||
import { useSystemState } from "./use-system-state";
|
||||
import { useCallback } from "react";
|
||||
|
||||
const executeWithErrorHandling = async (
|
||||
operation: () => Promise<void>,
|
||||
|
||||
Reference in New Issue
Block a user