Skip to content

Commit

Permalink
chore(client): only show node URI + IP if in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jan 16, 2024
1 parent 4c19e55 commit 985b4e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import Icon from "./Icon";

import {EPIVAR_NODES} from "../config";
import {SITE_SUBTITLE, SITE_TITLE} from "../constants/app";
import {useCurrentDataset, useDatasetsByNode, useNode} from "../hooks";
import {useCurrentDataset, useDatasetsByNode, useDevMode, useNode} from "../hooks";

export default function Header({children, onAbout, /*onDatasets, */onDatasetAbout, onOverview, onExplore, onFAQ,
/*, onContact*/}) {
const location = useLocation();
const navigate = useNavigate();

const devMode = useDevMode();
const node = useNode();
const dataset = useCurrentDataset();
const userData = useSelector(state => state.user);
Expand All @@ -28,7 +29,9 @@ export default function Header({children, onAbout, /*onDatasets, */onDatasetAbou
<div className="Header__auth">
{node && userData.data
? (
<span>Authenticated with <code>{node}</code> as {userData.data.ip}</span>
devMode
? <span>Authenticated with <code>{node}</code> as {userData.data.ip}</span>
: <span>Authenticated</span>
) : null
// <a href="/api/auth/logout">{userData.data?.displayName ?? userData.data?.id} (Log Out)</a>
// <a href={`${LOGIN_PATH}?redirect=${encodeURIComponent(window.location.pathname)}`}>Log In / Sign Up</a>
Expand Down
2 changes: 2 additions & 0 deletions client/src/hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {useSelector} from "react-redux";

export const useDevMode = () => useSelector((state) => state.ui.devMode);

export const useNode = () => useSelector((state) => state.ui.node);
export const useDatasetsByNode = () => useSelector((state) => state.datasets.datasetsByNode);

Expand Down

0 comments on commit 985b4e9

Please sign in to comment.