Skip to content

Commit

Permalink
move useSelectedNetwork to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Sep 8, 2023
1 parent 00dd2c3 commit ecf4f04
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion deploy-web/public/sw.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy-web/public/sw.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy-web/src/components/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useTheme } from "@mui/material";
import { uaktToAKT } from "@src/utils/priceUtils";
import { BlockRow } from "../blockchain/BlockRow";
import { TransactionRow } from "../blockchain/TransactionRow";
import { useSelectedNetwork } from "@src/utils/networks";
import { useSelectedNetwork } from "@src/hooks/useSelectedNetwork";

interface IDashboardProps {
dashboardData: DashboardData;
Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/components/layout/NodeStatusBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useSettings } from "../../context/SettingsProvider";
import { makeStyles } from "tss-react/mui";
import { useSelectedNetwork } from "@src/utils/networks";
import { Box, Typography, useTheme } from "@mui/material";
import { NodeStatus } from "../shared/NodeStatus";
import { LinkTo } from "../shared/LinkTo";
import { useRouter } from "next/router";
import { UrlService } from "@src/utils/urlUtils";
import { getSplitText } from "@src/hooks/useShortText";
import { LinearLoadingSkeleton } from "../shared/LinearLoadingSkeleton";
import { useSelectedNetwork } from "@src/hooks/useSelectedNetwork";

const useStyles = makeStyles()(theme => ({
link: {
Expand Down
1 change: 0 additions & 1 deletion deploy-web/src/components/providers/NetworkCapacity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box, Typography, useTheme } from "@mui/material";
import { bytesToShrink } from "@src/utils/unitUtils";
import { roundDecimal } from "@src/utils/mathHelpers";
import { useRouter } from "next/router";
import { useSelectedNetwork } from "@src/utils/networks";

type Props = {
activeCPU: number;
Expand Down
8 changes: 0 additions & 8 deletions deploy-web/src/components/providers/ProviderList.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { makeStyles } from "tss-react/mui";
import { Table, TableBody, TableCell, TableContainer, TableRow, useTheme } from "@mui/material";
import { MergedProvider } from "@src/types/provider";
import { CustomTableHeader } from "../shared/CustomTable";
import { ProviderListRow } from "./ProviderListRow";
import { useSelectedNetwork } from "@src/utils/networks";

const useStyles = makeStyles()(theme => ({}));

type Props = {
providers: Array<MergedProvider>;
};

export const ProviderList: React.FunctionComponent<Props> = ({ providers }) => {
const { classes } = useStyles();
const theme = useTheme();
const selectedNetwork = useSelectedNetwork();

return (
<TableContainer>
<Table size="small">
Expand Down
1 change: 0 additions & 1 deletion deploy-web/src/components/providers/ProviderListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useRouter } from "next/router";
import { UrlService } from "@src/utils/urlUtils";
import { FormattedNumber } from "react-intl";
import { Uptime } from "./Uptime";
import { useSelectedNetwork } from "@src/utils/networks";

const useStyles = makeStyles()(theme => ({
root: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { useRouter } from "next/router";
import { UrlService } from "@src/utils/urlUtils";
import { useSettings } from "../SettingsProvider";
import axios from "axios";
import { getSelectedNetwork } from "@src/utils/networks";
import { LinkTo } from "@src/components/shared/LinkTo";
import { useUsdcDenom } from "@src/hooks/useDenom";
import { getSelectedNetwork } from "@src/hooks/useSelectedNetwork";

type Balances = {
uakt: number;
Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/hooks/useDenom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usdcIbcDenoms } from "@src/utils/constants";
import { getSelectedNetwork, useSelectedNetwork } from "@src/utils/networks";
import { getSelectedNetwork, useSelectedNetwork } from "./useSelectedNetwork";

export const useUsdcDenom = () => {
const selectedNetwork = useSelectedNetwork();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffectOnce } from "usehooks-ts";
import { mainnetId } from "./constants";
import { useAtom } from "jotai";
import networkStore, { networks } from "@src/store/networkStore";
import { mainnetId } from "@src/utils/constants";

export const getSelectedNetwork = () => {
const selectedNetworkId = localStorage.getItem("selectedNetworkId") ?? mainnetId;
Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/pages/analytics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { FormattedDate, FormattedTime } from "react-intl";
import CircularProgress from "@mui/material/CircularProgress";
import { useTheme } from "@mui/material";
import Layout from "@src/components/layout/Layout";
import { useSelectedNetwork } from "@src/utils/networks";
import { GradientText } from "@src/components/shared/GradientText";
import { CustomNextSeo } from "@src/components/shared/CustomNextSeo";
import { UrlService } from "@src/utils/urlUtils";
import { useSelectedNetwork } from "@src/hooks/useSelectedNetwork";

type Props = {
children?: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/pages/providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import { useNetworkCapacity } from "@src/queries/useProvidersQuery";
import PageContainer from "@src/components/shared/PageContainer";
import { ProviderMap } from "@src/components/providers/ProviderMap";
import { ProviderList } from "@src/components/providers/ProviderList";
import { useSelectedNetwork } from "@src/utils/networks";
import dynamic from "next/dynamic";
import LaunchIcon from "@mui/icons-material/Launch";
import { CustomNextSeo } from "@src/components/shared/CustomNextSeo";
import { UrlService } from "@src/utils/urlUtils";
import { useSelectedNetwork } from "@src/hooks/useSelectedNetwork";

const NetworkCapacity = dynamic(() => import("../../components/providers/NetworkCapacity"), {
ssr: false
Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/pages/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import SettingsLayout, { SettingsTabs } from "@src/components/settings/SettingsL
import { Fieldset } from "@src/components/shared/Fieldset";
import { useState } from "react";
import { SelectNetworkModal } from "@src/components/shared/SelectNetworkModal";
import { useSelectedNetwork } from "@src/utils/networks";
import EditIcon from "@mui/icons-material/Edit";
import { CertificateList } from "@src/components/certificates/CertificateList";
import { useSelectedNetwork } from "@src/hooks/useSelectedNetwork";

type Props = {};

Expand Down

0 comments on commit ecf4f04

Please sign in to comment.