Skip to content

Commit fcaf249

Browse files
committed
feat(web): status-badge
1 parent 2912f25 commit fcaf249

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

web/.env.devnet.public

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +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

web/.env.testnet.public

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ 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";
1516

1617
const Container = styled.div`
1718
display: flex;
@@ -122,6 +123,7 @@ const Help: React.FC<IHelp> = ({ toggleIsHelpOpen }) => {
122123
<small>{item.text}</small>
123124
</ListItem>
124125
))}
126+
<StatusBadge />
125127
<Debug />
126128
</Container>
127129
{isOnboardingMiniGuidesOpen && <Onboarding toggleMiniGuide={toggleIsOnboardingMiniGuidesOpen} />}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React, { useMemo } from "react";
2+
import styled from "styled-components";
3+
import { useToggleTheme } from "hooks/useToggleThemeContext";
4+
5+
const Container = styled.div`
6+
padding: 0px 3px;
7+
max-width: 220px;
8+
`;
9+
10+
const StyledIframe = styled.iframe`
11+
border: none;
12+
width: 100%;
13+
height: 30px;
14+
background-color: ${({ theme }) => theme.mediumPurple};
15+
border-radius: 300px;
16+
`;
17+
18+
export const StatusBadge: React.FC = () => {
19+
const [theme] = useToggleTheme();
20+
21+
const deployment = process.env.REACT_APP_DEPLOYMENT ?? "testnet";
22+
23+
let statusUrl: string;
24+
25+
switch (deployment) {
26+
case "devnet":
27+
statusUrl = process.env.REACT_APP_DEVNET_STATUS_URL!;
28+
break;
29+
case "testnet":
30+
statusUrl = process.env.REACT_APP_TESTNET_STATUS_URL!;
31+
break;
32+
default:
33+
statusUrl = process.env.REACT_APP_TESTNET_STATUS_URL!;
34+
}
35+
36+
//update url on theme toggle
37+
statusUrl = useMemo(() => (theme == "light" ? statusUrl + "?theme=light" : statusUrl + "?theme=dark"), [theme]);
38+
39+
return (
40+
<Container>
41+
<StyledIframe src={statusUrl} />
42+
</Container>
43+
);
44+
};

0 commit comments

Comments
 (0)