Skip to content

Commit 1699758

Browse files
committed
feat(web): explainer-info-at-sign-in-and-connect-resolver
1 parent ad34281 commit 1699758

File tree

2 files changed

+56
-9
lines changed

2 files changed

+56
-9
lines changed

web/src/components/EnsureAuth.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
import React, { useCallback } from "react";
2+
import styled from "styled-components";
23

34
import { useAccount } from "wagmi";
5+
46
import { useAtlasProvider } from "@kleros/kleros-app";
57
import { Button } from "@kleros/ui-components-library";
8+
69
import { errorToast, infoToast, successToast } from "utils/wrapWithToast";
710

11+
const Container = styled.div`
12+
display: flex;
13+
flex-direction: column;
14+
gap: 16px;
15+
justify-content: center;
16+
align-items: center;
17+
`;
18+
19+
const StyledInfo = styled.p`
20+
margin: 0;
21+
padding: 0;
22+
`;
23+
824
interface IEnsureAuth {
925
children: React.ReactElement;
26+
message?: string;
27+
buttonText?: string;
1028
className?: string;
1129
}
1230

13-
const EnsureAuth: React.FC<IEnsureAuth> = ({ children, className }) => {
31+
const EnsureAuth: React.FC<IEnsureAuth> = ({ children, message, buttonText, className }) => {
1432
const { address } = useAccount();
1533
const { isVerified, isSigningIn, authoriseUser } = useAtlasProvider();
34+
1635
const handleClick = useCallback(() => {
1736
infoToast(`Signing in User...`);
1837

@@ -26,13 +45,16 @@ const EnsureAuth: React.FC<IEnsureAuth> = ({ children, className }) => {
2645
return isVerified ? (
2746
children
2847
) : (
29-
<Button
30-
text="Sign In"
31-
onClick={handleClick}
32-
disabled={isSigningIn || !address}
33-
isLoading={isSigningIn}
34-
{...{ className }}
35-
/>
48+
<Container>
49+
{message ? <StyledInfo>{message}</StyledInfo> : null}
50+
<Button
51+
text={buttonText ?? "Sign In"}
52+
onClick={handleClick}
53+
disabled={isSigningIn || !address}
54+
isLoading={isSigningIn}
55+
{...{ className }}
56+
/>
57+
</Container>
3658
);
3759
};
3860

web/src/pages/Resolver/index.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Navigate, Route, Routes, useLocation } from "react-router-dom";
55
import { useToggle } from "react-use";
66
import { useAccount } from "wagmi";
77

8+
import { useAtlasProvider } from "@kleros/kleros-app";
9+
810
import { MAX_WIDTH_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
911
import { responsiveSize } from "styles/responsiveSize";
1012

@@ -75,9 +77,26 @@ const MiddleContentContainer = styled.div`
7577
position: relative;
7678
`;
7779

80+
const Heading = styled.h1`
81+
margin: 0 0 0 32px;
82+
font-size: 24px;
83+
font-weight: 600;
84+
color: ${({ theme }) => theme.primaryText};
85+
text-align: center;
86+
`;
87+
88+
const Paragraph = styled.p`
89+
padding: 0;
90+
margin-bottom: 32px;
91+
font-size: 16px;
92+
text-align: center;
93+
color: ${({ theme }) => theme.secondaryText};
94+
`;
95+
7896
const DisputeResolver: React.FC = () => {
7997
const location = useLocation();
8098
const [isDisputeResolverMiniGuideOpen, toggleDisputeResolverMiniGuide] = useToggle(false);
99+
const { isVerified } = useAtlasProvider();
81100
const { isConnected } = useAccount();
82101
const isPreviewPage = location.pathname.includes("/preview");
83102
const isLandingPage = location.pathname.includes("/create");
@@ -86,8 +105,14 @@ const DisputeResolver: React.FC = () => {
86105
<Wrapper>
87106
<HeroImage />
88107
<Container>
108+
{!isConnected || !isVerified ? (
109+
<>
110+
<Heading>Justise as a Service</Heading>
111+
<Paragraph>You send your disputes. Kleros sends back decisions.</Paragraph>
112+
</>
113+
) : null}
89114
{isConnected ? (
90-
<StyledEnsureAuth>
115+
<StyledEnsureAuth buttonText="Sign in to start">
91116
<MiddleContentContainer>
92117
{isConnected && !isPreviewPage && !isLandingPage ? (
93118
<HowItWorksAndTimeline>

0 commit comments

Comments
 (0)