chore: fix connection table bg
Some checks failed
Alpha Build / alpha (macos-latest, aarch64-apple-darwin) (push) Has been cancelled
Alpha Build / alpha (macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Alpha Build / alpha (windows-latest, aarch64-pc-windows-msvc) (push) Has been cancelled
Alpha Build / alpha (windows-latest, i686-pc-windows-msvc) (push) Has been cancelled
Alpha Build / alpha (windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Alpha Build / alpha-for-linux (ubuntu-latest, aarch64-unknown-linux-gnu) (push) Has been cancelled
Alpha Build / alpha-for-linux (ubuntu-latest, armv7-unknown-linux-gnueabihf) (push) Has been cancelled
Alpha Build / alpha-for-linux (ubuntu-latest, i686-unknown-linux-gnu) (push) Has been cancelled
Alpha Build / alpha-for-linux (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Has been cancelled
Alpha Build / alpha-for-fixed-webview2 (arm64, windows-latest, aarch64-pc-windows-msvc) (push) Has been cancelled
Alpha Build / alpha-for-fixed-webview2 (x64, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Alpha Build / alpha-for-fixed-webview2 (x86, windows-latest, i686-pc-windows-msvc) (push) Has been cancelled
Alpha Build / Update tag (push) Has been cancelled

This commit is contained in:
dongchengjie 2024-06-23 20:40:09 +08:00
parent bfa3fa293f
commit 709a23cf09

View File

@ -1,6 +1,7 @@
import dayjs from "dayjs";
import { useMemo, useState } from "react";
import { DataGrid, GridColDef } from "@mui/x-data-grid";
import { useThemeMode } from "@/services/states";
import { truncateStr } from "@/utils/truncate-str";
import parseTraffic from "@/utils/parse-traffic";
import { t } from "i18next";
@ -12,6 +13,9 @@ interface Props {
export const ConnectionTable = (props: Props) => {
const { connections, onShowDetail } = props;
const mode = useThemeMode();
const isDark = mode === "light" ? false : true;
const backgroundColor = isDark ? "#282A36" : "#ffffff";
const [columnVisible, setColumnVisible] = useState<
Partial<Record<keyof IConnectionsItem, boolean>>
@ -96,7 +100,6 @@ export const ConnectionTable = (props: Props) => {
source: `${metadata.sourceIP}:${metadata.sourcePort}`,
destinationIP: metadata.destinationIP,
type: `${metadata.type}(${metadata.network})`,
connectionData: each,
};
});
@ -112,8 +115,8 @@ export const ConnectionTable = (props: Props) => {
sx={{
border: "none",
"div:focus": { outline: "none !important" },
"& div[aria-rowindex='1']": {
backgroundColor: "inherit !important",
"& div[aria-rowindex]": {
backgroundColor: `${backgroundColor} !important`,
},
}}
columnVisibilityModel={columnVisible}