Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): court-badges #1558

Merged
merged 7 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -4,3 +4,4 @@ export REACT_APP_CORE_SUBGRAPH=https://api.studio.thegraph.com/query/61738/klero
export REACT_APP_DRT_ARBSEPOLIA_SUBGRAPH=https://api.studio.thegraph.com/query/61738/kleros-v2-drt-arbisep-devnet/version/latest
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
export REACT_APP_GENESIS_BLOCK_ARBSEPOLIA=3084598
export REACT_APP_ARBITRATOR_TYPE="neo"
23 changes: 5 additions & 18 deletions web/src/layout/Header/DesktopHeader.tsx
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import React from "react";
import styled, { css } from "styled-components";

import { Link } from "react-router-dom";
import { landscapeStyle } from "styles/landscapeStyle";
import { useToggle } from "react-use";

import KlerosCourtUniversityLogo from "svgs/header/kleros-court-university.svg";
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";

import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";

import { isKlerosUniversity } from "src/consts";

import { landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";

import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
import ConnectWallet from "components/ConnectWallet";
import LightButton from "components/LightButton";
import { Overlay } from "components/Overlay";
Expand All @@ -26,6 +15,8 @@ import Help from "./navbar/Menu/Help";
import Settings from "./navbar/Menu/Settings";

import { PopupContainer } from ".";
import { responsiveSize } from "styles/responsiveSize";
import Logo from "./Logo";

const Container = styled.div`
display: none;
Expand Down Expand Up @@ -73,10 +64,6 @@ const LightButtonContainer = styled.div`
margin-right: ${responsiveSize(12, 16)};
`;

const StyledLink = styled(Link)`
min-height: 48px;
`;

const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
fill: ${({ theme }) => theme.white} !important;
`;
Expand Down Expand Up @@ -106,7 +93,7 @@ const DesktopHeader = () => {
Icon={StyledKlerosSolutionsIcon}
/>
</LightButtonContainer>
<StyledLink to={"/"}>{isKlerosUniversity() ? <KlerosCourtUniversityLogo /> : <KlerosCourtLogo />}</StyledLink>
<Logo />
</LeftSide>

<MiddleSide>
Expand Down
64 changes: 64 additions & 0 deletions web/src/layout/Header/Logo.tsx
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from "react";
import { Link } from "react-router-dom";
import styled, { Theme, useTheme } from "styled-components";
import KlerosCourtLogo from "svgs/header/kleros-court.svg";

const arbitratorType = process.env.REACT_APP_ARBITRATOR_TYPE;
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved

const Container = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 16px;
`;

const StyledLink = styled(Link)`
min-height: 48px;
`;

const BadgeContainer = styled.div<{ backgroundColor: string }>`
transform: skewX(-15deg);
background-color: ${({ backgroundColor }) => backgroundColor};
border-radius: 3px;
padding: 1px 8px;
height: fit-content;
`;

const BadgeText = styled.label`
color: #220050;
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved
`;

const Badge: React.FC<{ text: string; color: keyof Theme }> = ({ text, color }) => {
const theme = useTheme();
return (
<BadgeContainer {...{ backgroundColor: theme[color] }}>
<BadgeText>{text}</BadgeText>
</BadgeContainer>
);
};

const Logo: React.FC = () => {
let CourtBadge: JSX.Element | null = null;
switch (arbitratorType) {
case "neo":
CourtBadge = <Badge text="Neo" color="paleCyan" />;
break;
case "university":
CourtBadge = <Badge text="Uni" color="limeGreen" />;
break;
default:
break;
}
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved

return (
<Container>
{" "}
<StyledLink to={"/"}>
<KlerosCourtLogo />
</StyledLink>
{CourtBadge}
</Container>
);
};

export default Logo;
18 changes: 3 additions & 15 deletions web/src/layout/Header/MobileHeader.tsx
Harman-singh-waraich marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import React, { useContext, useMemo, useRef } from "react";
import styled, { css } from "styled-components";

import { Link } from "react-router-dom";
import { useClickAway, useToggle } from "react-use";

import HamburgerIcon from "svgs/header/hamburger.svg";
import KlerosCourtUniversityLogo from "svgs/header/kleros-court-university.svg";
import KlerosCourtLogo from "svgs/header/kleros-court.svg";

import { isKlerosUniversity } from "src/consts";

import { landscapeStyle } from "styles/landscapeStyle";

import HamburgerIcon from "svgs/header/hamburger.svg";
import LightButton from "components/LightButton";

import NavBar from "./navbar";
import Logo from "./Logo";

const Container = styled.div`
display: flex;
Expand All @@ -41,10 +33,6 @@ const StyledLightButton = styled(LightButton)`
}
`;

const StyledLink = styled(Link)`
min-height: 48px;
`;

const OpenContext = React.createContext({
isOpen: false,
toggleIsOpen: () => {
Expand All @@ -64,7 +52,7 @@ const MobileHeader = () => {
return (
<Container ref={containerRef}>
<OpenContext.Provider value={memoizedContext}>
<StyledLink to={"/"}>{isKlerosUniversity() ? <KlerosCourtUniversityLogo /> : <KlerosCourtLogo />}</StyledLink>
<Logo />
<NavBar />
<StyledLightButton text="" Icon={HamburgerIcon} onClick={toggleIsOpen} />
</OpenContext.Provider>
Expand Down
6 changes: 6 additions & 0 deletions web/src/styles/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export const lightTheme = {

skeletonBackground: "#EBEBEB",
skeletonHighlight: "#F5F5F5",

paleCyan: "#ACFFFF",
limeGreen: "#F3FFD9",
};

export const darkTheme = {
Expand Down Expand Up @@ -84,4 +87,7 @@ export const darkTheme = {

skeletonBackground: "#3A2270",
skeletonHighlight: "#3E307C",

paleCyan: "#ACFFFF",
limeGreen: "#F3FFD9",
};
Loading