Add dark mode on error cards

This commit is contained in:
Yana
2025-04-17 17:28:08 +03:00
parent 0723542c39
commit e4ecd099cc
2 changed files with 14 additions and 4 deletions
@@ -2,7 +2,7 @@
import { fetchNSApiNodes } from "@/app/api";
import type { NS_NODE } from "@/app/api/types";
import { Skeleton, Typography } from "@mui/material";
import { Skeleton, Typography, useTheme } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import ExplorerCard from "../cards/ExplorerCard";
import DelegationsTable from "./DelegationsTable";
@@ -12,6 +12,8 @@ type Props = {
};
const NodeDelegationsCard = ({ paramId }: Props) => {
const theme = useTheme();
const isDarkMode = theme.palette.mode === "dark";
let nodeInfo: NS_NODE | undefined;
const {
@@ -55,7 +57,10 @@ const NodeDelegationsCard = ({ paramId }: Props) => {
if (isNSApiNodesError) {
return (
<ExplorerCard label="Delegations" sx={{ height: "100%" }}>
<Typography variant="h3" sx={{ color: "pine.950" }}>
<Typography
variant="h3"
sx={{ color: isDarkMode ? "base.white" : "pine.950" }}
>
Failed to load delegations. Please try again later.
</Typography>
</ExplorerCard>
@@ -1,7 +1,7 @@
"use client";
import { formatBigNum } from "@/utils/formatBigNumbers";
import { Skeleton, Typography } from "@mui/material";
import { Skeleton, Typography, useTheme } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import { fetchEpochRewards, fetchNSApiNodes } from "../../app/api";
import type { NS_NODE } from "../../app/api/types";
@@ -13,6 +13,8 @@ type Props = {
};
export const NodeParametersCard = ({ paramId }: Props) => {
const theme = useTheme();
const isDarkMode = theme.palette.mode === "dark";
let nodeInfo: NS_NODE | undefined;
// Fetch epoch rewards
@@ -57,7 +59,10 @@ export const NodeParametersCard = ({ paramId }: Props) => {
if (isEpochError || isNSApiNodesError || !nsApiNodes || !epochRewardsData) {
return (
<ExplorerCard label="Node parameters" sx={{ height: "100%" }}>
<Typography variant="h3" sx={{ color: "pine.950" }}>
<Typography
variant="h3"
sx={{ color: isDarkMode ? "base.white" : "pine.950" }}
>
Failed to load node data.
</Typography>
</ExplorerCard>