fix incorrect usage of useCustomTheme

This commit is contained in:
huzibaca 2024-10-29 09:07:08 +08:00
parent 014829e69a
commit 9d476d7add
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302
5 changed files with 10 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import { BaseErrorBoundary } from "./base-error-boundary"; import { BaseErrorBoundary } from "./base-error-boundary";
import { useCustomTheme } from "@/components/layout/use-custom-theme"; import { useTheme } from "@mui/material/styles";
interface Props { interface Props {
title?: React.ReactNode; // the page title title?: React.ReactNode; // the page title
@ -13,7 +13,7 @@ interface Props {
export const BasePage: React.FC<Props> = (props) => { export const BasePage: React.FC<Props> = (props) => {
const { title, header, contentStyle, full, children } = props; const { title, header, contentStyle, full, children } = props;
const { theme } = useCustomTheme(); const theme = useTheme();
const isDark = theme.palette.mode === "dark"; const isDark = theme.palette.mode === "dark";

View File

@ -4,6 +4,7 @@ import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
import { useSetThemeMode, useThemeMode } from "@/services/states"; import { useSetThemeMode, useThemeMode } from "@/services/states";
import { defaultTheme, defaultDarkTheme } from "@/pages/_theme"; import { defaultTheme, defaultDarkTheme } from "@/pages/_theme";
import { useVerge } from "@/hooks/use-verge"; import { useVerge } from "@/hooks/use-verge";
import { useTheme } from "@mui/material/styles";
const appWindow = getCurrentWebviewWindow(); const appWindow = getCurrentWebviewWindow();
/** /**

View File

@ -15,11 +15,11 @@ import {
ConnectionDetailRef, ConnectionDetailRef,
} from "@/components/connection/connection-detail"; } from "@/components/connection/connection-detail";
import parseTraffic from "@/utils/parse-traffic"; import parseTraffic from "@/utils/parse-traffic";
import { useCustomTheme } from "@/components/layout/use-custom-theme";
import { BaseSearchBox } from "@/components/base/base-search-box"; import { BaseSearchBox } from "@/components/base/base-search-box";
import { BaseStyledSelect } from "@/components/base/base-styled-select"; import { BaseStyledSelect } from "@/components/base/base-styled-select";
import useSWRSubscription from "swr/subscription"; import useSWRSubscription from "swr/subscription";
import { createSockette } from "@/utils/websocket"; import { createSockette } from "@/utils/websocket";
import { useTheme } from "@mui/material/styles";
const initConn: IConnections = { const initConn: IConnections = {
uploadTotal: 0, uploadTotal: 0,
@ -32,7 +32,8 @@ type OrderFunc = (list: IConnectionsItem[]) => IConnectionsItem[];
const ConnectionsPage = () => { const ConnectionsPage = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { clashInfo } = useClashInfo(); const { clashInfo } = useClashInfo();
const { theme } = useCustomTheme();
const theme = useTheme();
const isDark = theme.palette.mode === "dark"; const isDark = theme.palette.mode === "dark";
const [match, setMatch] = useState(() => (_: string) => true); const [match, setMatch] = useState(() => (_: string) => true);
const [curOrderOpt, setOrderOpt] = useState("Default"); const [curOrderOpt, setOrderOpt] = useState("Default");

View File

@ -10,7 +10,7 @@ import { useLogData } from "@/hooks/use-log-data";
import { useEnableLog } from "@/services/states"; import { useEnableLog } from "@/services/states";
import { BaseEmpty, BasePage } from "@/components/base"; import { BaseEmpty, BasePage } from "@/components/base";
import LogItem from "@/components/log/log-item"; import LogItem from "@/components/log/log-item";
import { useCustomTheme } from "@/components/layout/use-custom-theme"; import { useTheme } from "@mui/material/styles";
import { BaseSearchBox } from "@/components/base/base-search-box"; import { BaseSearchBox } from "@/components/base/base-search-box";
import { BaseStyledSelect } from "@/components/base/base-styled-select"; import { BaseStyledSelect } from "@/components/base/base-styled-select";
import { mutate } from "swr"; import { mutate } from "swr";
@ -19,7 +19,7 @@ const LogPage = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { data: logData = [] } = useLogData(); const { data: logData = [] } = useLogData();
const [enableLog, setEnableLog] = useEnableLog(); const [enableLog, setEnableLog] = useEnableLog();
const { theme } = useCustomTheme(); const theme = useTheme();
const isDark = theme.palette.mode === "dark"; const isDark = theme.palette.mode === "dark";
const [logState, setLogState] = useState("all"); const [logState, setLogState] = useState("all");
const [match, setMatch] = useState(() => (_: string) => true); const [match, setMatch] = useState(() => (_: string) => true);

View File

@ -7,13 +7,13 @@ import { getRules } from "@/services/api";
import { BaseEmpty, BasePage } from "@/components/base"; import { BaseEmpty, BasePage } from "@/components/base";
import RuleItem from "@/components/rule/rule-item"; import RuleItem from "@/components/rule/rule-item";
import { ProviderButton } from "@/components/rule/provider-button"; import { ProviderButton } from "@/components/rule/provider-button";
import { useCustomTheme } from "@/components/layout/use-custom-theme";
import { BaseSearchBox } from "@/components/base/base-search-box"; import { BaseSearchBox } from "@/components/base/base-search-box";
import { useTheme } from "@mui/material/styles";
const RulesPage = () => { const RulesPage = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { data = [] } = useSWR("getRules", getRules); const { data = [] } = useSWR("getRules", getRules);
const { theme } = useCustomTheme(); const theme = useTheme();
const isDark = theme.palette.mode === "dark"; const isDark = theme.palette.mode === "dark";
const [match, setMatch] = useState(() => (_: string) => true); const [match, setMatch] = useState(() => (_: string) => true);