- {(!isProviderStatusFetched || isLoading) ? (
+ {(!isProviderStatusFetched || isLoading) && isWalletConnected ? (
{loadingMessage}
diff --git a/apps/provider-console/src/components/layout/Sidebar.tsx b/apps/provider-console/src/components/layout/Sidebar.tsx
index 9934c9a8d..2d0224dfc 100644
--- a/apps/provider-console/src/components/layout/Sidebar.tsx
+++ b/apps/provider-console/src/components/layout/Sidebar.tsx
@@ -4,7 +4,7 @@ import { Button, buttonVariants } from "@akashnetwork/ui/components";
import Drawer from "@mui/material/Drawer";
import { useTheme as useMuiTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery";
-import { Discord, Github, Menu, MenuScale, Rocket, X as TwitterX, Youtube } from "iconoir-react";
+import { Discord, Github, Menu, MenuScale, Rocket, X as TwitterX, Youtube, Cloud, Settings, ClipboardCheck, Calculator, ListSelect } from "iconoir-react";
import { Home, OpenInWindow } from "iconoir-react";
import getConfig from "next/config";
import Image from "next/image";
@@ -43,6 +43,41 @@ export const Sidebar: React.FunctionComponent
= ({ isMobileOpen, handleDr
icon: props => ,
url: UrlService.home(),
activeRoutes: [UrlService.home()]
+ },
+ {
+ title: "Leases",
+ icon: props => ,
+ url: "#",
+ activeRoutes: ["#"],
+ disabled: true
+ },
+ {
+ title: "Actions",
+ icon: props => ,
+ url: "#",
+ activeRoutes: ["#"],
+ disabled: true
+ },
+ {
+ title: "Pricing",
+ icon: props => ,
+ url: "#",
+ activeRoutes: ["#"],
+ disabled: true
+ },
+ {
+ title: "Attributes",
+ icon: props => ,
+ url: "#",
+ activeRoutes: ["#"],
+ disabled: true
+ },
+ {
+ title: "Settings",
+ icon: props => ,
+ url: "#",
+ activeRoutes: ["#"],
+ disabled: true
}
]
},
@@ -238,4 +273,3 @@ export const Sidebar: React.FunctionComponent = ({ isMobileOpen, handleDr
);
};
-
diff --git a/apps/provider-console/src/components/layout/SidebarRouteButton.tsx b/apps/provider-console/src/components/layout/SidebarRouteButton.tsx
index 681be8099..319a59714 100644
--- a/apps/provider-console/src/components/layout/SidebarRouteButton.tsx
+++ b/apps/provider-console/src/components/layout/SidebarRouteButton.tsx
@@ -31,7 +31,8 @@ export const SidebarRouteButton: React.FunctionComponent = ({ route, clas
{
["font-bold"]: isSelected,
["min-w-[initial] px-4 py-1"]: isNavOpen,
- ["w-[45px] min-w-0 p-2"]: !isNavOpen
+ ["w-[45px] min-w-0 p-2"]: !isNavOpen,
+ ["pointer-events-none opacity-50"]: route.disabled // Add this line
}
)}
>
diff --git a/apps/provider-console/src/pages/dashboard/index.tsx b/apps/provider-console/src/pages/dashboard/index.tsx
index 19cd15d6b..0327d1179 100644
--- a/apps/provider-console/src/pages/dashboard/index.tsx
+++ b/apps/provider-console/src/pages/dashboard/index.tsx
@@ -16,6 +16,9 @@ import { StatPieChart } from "@src/components/dashboard/stat-pie-charts";
import { useSelectedChain } from "@src/context/CustomChainProvider";
import { formatBytes } from "@src/utils/formatBytes";
import withAuth from "@src/components/shared/withAuth";
+import { formatUUsd } from "@src/utils/formatUsd";
+import DashboardCardSkeleton from "@src/components/dashboard/DashboardCardSkeleton";
+import { useWallet } from "@src/context/WalletProvider";
// Moved outside component to avoid recreation on each render
const fetchAktPrice = async () => {
@@ -30,15 +33,33 @@ const fetchAktPrice = async () => {
}
};
+const calculatePercentageChange = (currentPrice: number | null, previousPrice: number | null) => {
+ if (currentPrice === null || previousPrice === null || previousPrice === 0) {
+ return 0%;
+ }
+
+ const percentageChange = ((currentPrice - previousPrice) / previousPrice) * 100;
+ const formattedChange = Math.abs(percentageChange).toFixed(2);
+
+ if (percentageChange > 0) {
+ return +{formattedChange}%;
+ } else if (percentageChange < 0) {
+ return -{formattedChange}%;
+ } else {
+ return 0%;
+ }
+};
+
const Dashboard: React.FC = () => {
const [providerActions, setProviderActions] = useState([]);
const [aktPrice, setAktPrice] = useState(null);
const { address } = useSelectedChain();
+ const { isOnline } = useWallet();
// Add this query to fetch provider details
const { data: providerDetails, isLoading: isLoadingProviderDetails }: { data: any; isLoading: boolean } = useQuery(
"providerDetails",
- () => consoleClient.get(`/providers/${address}`),
+ () => consoleClient.get(`/v1/providers/${address}`),
{
// You might want to adjust these options based on your needs
refetchOnWindowFocus: false,
@@ -46,6 +67,16 @@ const Dashboard: React.FC = () => {
}
);
+ // Add this new query to fetch provider dashboard details
+ const { data: providerDashboard, isLoading: isLoadingProviderDashboard }: { data: any; isLoading: boolean } = useQuery(
+ "providerDashboard",
+ () => consoleClient.get(`/internal/provider-dashboard/${address}`),
+ {
+ refetchOnWindowFocus: false,
+ retry: 3
+ }
+ );
+
useEffect(() => {
const fetchData = async () => {
const [price, actions]: [string, any] = await Promise.all([fetchAktPrice(), restClient.get("/actions")]);
@@ -108,94 +139,156 @@ const Dashboard: React.FC = () => {