Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/.env.devnet.public
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
export REACT_APP_DEPLOYMENT=devnet
export REACT_APP_KLEROS_CORE_SUBGRAPH_DEVNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-core-devnet
export REACT_APP_DISPUTE_TEMPLATE_ARBGOERLI_SUBGRAPH_DEVNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-dr-devnet
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
1 change: 1 addition & 0 deletions web/.env.testnet.public
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
export REACT_APP_DEPLOYMENT=testnet
export REACT_APP_KLEROS_CORE_SUBGRAPH_TESTNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-core-testnet-2
export REACT_APP_DISPUTE_TEMPLATE_ARBGOERLI_SUBGRAPH_TESTNET=https://api.thegraph.com/subgraphs/name/kleros/kleros-v2-dr-testnet-2
export REACT_APP_STATUS_URL=https://kleros-v2.betteruptime.com/badge
33 changes: 22 additions & 11 deletions web/src/layout/Header/navbar/Debug.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from "react";
import React, { useMemo } from "react";
import styled from "styled-components";
import { useSortitionModulePhase } from "hooks/contracts/generated";
import { useToggleTheme } from "hooks/useToggleThemeContext";
import { GIT_BRANCH, GIT_DIRTY, GIT_HASH, GIT_TAGS, GIT_URL, RELEASE_VERSION } from "consts/index";

const Container = styled.div`
display: flex;
flex-direction: column;
gap: 12px;

label,
a {
font-family: "Roboto Mono", monospace;
Expand All @@ -13,6 +18,13 @@ const Container = styled.div`
}
`;

const StyledIframe = styled.iframe`
border: none;
width: 100%;
height: 30px;
border-radius: 300px;
`;

const Version = () => (
<label>
v{RELEASE_VERSION}{" "}
Expand All @@ -25,6 +37,13 @@ const Version = () => (
</label>
);

const ServicesStatus = () => {
const [theme] = useToggleTheme();
const statusUrlParameters = useMemo(() => (theme === "light" ? "?theme=light" : "?theme=dark"), [theme]);
const statusUrl = process.env.REACT_APP_STATUS_URL;
return <label>{statusUrl && <StyledIframe src={`${statusUrl + statusUrlParameters}`} />}</label>;
};

enum Phases {
staking,
generating,
Expand All @@ -35,21 +54,13 @@ const Phase = () => {
const { data: phase } = useSortitionModulePhase({
watch: true,
});
return (
<>
{phase !== undefined && (
<label>
<br />
phase: {Phases[phase]}
</label>
)}
</>
);
return <>{phase !== undefined && <label>Phase: {Phases[phase]}</label>}</>;
};

const Debug: React.FC = () => {
return (
<Container>
<ServicesStatus />
<Version />
<Phase />
</Container>
Expand Down