Skip to content

Commit b82ac61

Browse files
committed
refactor: moved to Debug component, simpler env variables
1 parent b95079c commit b82ac61

File tree

5 files changed

+24
-59
lines changed

5 files changed

+24
-59
lines changed

web/.env.devnet.public

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
export REACT_APP_DEPLOYMENT=devnet
33
export REACT_APP_KLEROS_CORE_SUBGRAPH_DEVNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-core-devnet
44
export REACT_APP_DISPUTE_TEMPLATE_ARBGOERLI_SUBGRAPH_DEVNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-dr-devnet
5-
export REACT_APP_DEVNET_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
5+
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge

web/.env.testnet.public

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
export REACT_APP_DEPLOYMENT=testnet
33
export REACT_APP_KLEROS_CORE_SUBGRAPH_TESTNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-core-testnet-2
44
export REACT_APP_DISPUTE_TEMPLATE_ARBGOERLI_SUBGRAPH_TESTNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-dr-testnet-2
5-
export REACT_APP_TESTNET_STATUS_URL=https://kleros-v2.betteruptime.com/badge
5+
export REACT_APP_STATUS_URL=https://kleros-v2.betteruptime.com/badge

web/src/layout/Header/navbar/Debug.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import styled from "styled-components";
33
import { useSortitionModulePhase } from "hooks/contracts/generated";
4+
import { useToggleTheme } from "hooks/useToggleThemeContext";
45
import { GIT_BRANCH, GIT_DIRTY, GIT_HASH, GIT_TAGS, GIT_URL, RELEASE_VERSION } from "consts/index";
56

67
const Container = styled.div`
8+
display: flex;
9+
flex-direction: column;
10+
gap: 12px;
11+
712
label,
813
a {
914
font-family: "Roboto Mono", monospace;
@@ -13,6 +18,13 @@ const Container = styled.div`
1318
}
1419
`;
1520

21+
const StyledIframe = styled.iframe`
22+
border: none;
23+
width: 100%;
24+
height: 30px;
25+
border-radius: 300px;
26+
`;
27+
1628
const Version = () => (
1729
<label>
1830
v{RELEASE_VERSION}{" "}
@@ -25,6 +37,13 @@ const Version = () => (
2537
</label>
2638
);
2739

40+
const ServicesStatus = () => {
41+
const [theme] = useToggleTheme();
42+
const statusUrlParameters = useMemo(() => (theme === "light" ? "?theme=light" : "?theme=dark"), [theme]);
43+
const statusUrl = process.env.REACT_APP_STATUS_URL;
44+
return <label>{statusUrl && <StyledIframe src={`${statusUrl + statusUrlParameters}`} />}</label>;
45+
};
46+
2847
enum Phases {
2948
staking,
3049
generating,
@@ -35,21 +54,13 @@ const Phase = () => {
3554
const { data: phase } = useSortitionModulePhase({
3655
watch: true,
3756
});
38-
return (
39-
<>
40-
{phase !== undefined && (
41-
<label>
42-
<br />
43-
phase: {Phases[phase]}
44-
</label>
45-
)}
46-
</>
47-
);
57+
return <>{phase !== undefined && <label>Phase: {Phases[phase]}</label>}</>;
4858
};
4959

5060
const Debug: React.FC = () => {
5161
return (
5262
<Container>
63+
<ServicesStatus />
5364
<Version />
5465
<Phase />
5566
</Container>

web/src/layout/Header/navbar/Menu/Help.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Telegram from "svgs/socialmedia/telegram.svg";
1212
import { IHelp } from "..";
1313
import Debug from "../Debug";
1414
import Onboarding from "components/Popup/MiniGuides/Onboarding";
15-
import { StatusBadge } from "./StatusBadge";
1615

1716
const Container = styled.div`
1817
display: flex;
@@ -123,7 +122,6 @@ const Help: React.FC<IHelp> = ({ toggleIsHelpOpen }) => {
123122
<small>{item.text}</small>
124123
</ListItem>
125124
))}
126-
<StatusBadge />
127125
<Debug />
128126
</Container>
129127
{isOnboardingMiniGuidesOpen && <Onboarding toggleMiniGuide={toggleIsOnboardingMiniGuidesOpen} />}

web/src/layout/Header/navbar/Menu/StatusBadge.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)