Skin onboarding app #33
@ -16,7 +16,7 @@ import Email from "./pages/Email";
|
|||||||
import Thanks from "./pages/Thanks";
|
import Thanks from "./pages/Thanks";
|
||||||
import Validator from "./pages/Validator";
|
import Validator from "./pages/Validator";
|
||||||
import ValidatorSuccess from "./pages/ValidatorSuccess";
|
import ValidatorSuccess from "./pages/ValidatorSuccess";
|
||||||
import { createTheme, Box, ThemeProvider } from "@mui/material";
|
import { createTheme, Box, ThemeProvider, CssBaseline } from "@mui/material";
|
||||||
|
|
||||||
const darkTheme = createTheme({
|
const darkTheme = createTheme({
|
||||||
components: {
|
components: {
|
||||||
@ -94,6 +94,7 @@ function App() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Header />
|
<Header />
|
||||||
|
<CssBaseline />
|
||||||
<WalletConnectProvider>
|
<WalletConnectProvider>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<LandingPage />} />
|
<Route path="/" element={<LandingPage />} />
|
||||||
|
@ -9,7 +9,7 @@ export const Container: React.FC<
|
|||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
maxWidth: "752px",
|
maxWidth: "752px",
|
||||||
marginX: "auto",
|
mx: "auto",
|
||||||
backgroundColor: "background.paper",
|
backgroundColor: "background.paper",
|
||||||
padding: 3,
|
padding: 3,
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
|
@ -1,36 +1,38 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
|
|
||||||
import {
|
import { AppBar, SvgIcon, Stack, Divider, Typography } from "@mui/material";
|
||||||
AppBar,
|
|
||||||
Toolbar,
|
|
||||||
SvgIcon,
|
|
||||||
Stack,
|
|
||||||
Divider,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
|
|
||||||
const Header: React.FC = () => {
|
const Header: React.FC = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar position="static" color="inherit" sx={{ boxShadow: "none", mb: 4 }}>
|
<AppBar
|
||||||
<Toolbar>
|
position="static"
|
||||||
|
color="inherit"
|
||||||
|
sx={{ boxShadow: "none", mb: 4, height: 48 }}
|
||||||
|
>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "background.paper",
|
backgroundColor: "background.paper",
|
||||||
pl: 4,
|
pl: 2,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
py: 2,
|
py: 1,
|
||||||
}}
|
}}
|
||||||
spacing={2}
|
spacing={1}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
to={location.pathname === "/" ? "/" : "/connect-wallet"}
|
to={location.pathname === "/" ? "/" : "/connect-wallet"}
|
||||||
style={{ color: "inherit", textDecoration: "none" }}
|
style={{
|
||||||
|
color: "inherit",
|
||||||
|
textDecoration: "none",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
marginRight: 4,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<SvgIcon sx={{ height: 20, width: 115 }}>
|
<SvgIcon sx={{ height: 20, width: 100 }}>
|
||||||
<svg
|
<svg
|
||||||
width="115"
|
width="115"
|
||||||
height="20"
|
height="20"
|
||||||
@ -81,9 +83,8 @@ const Header: React.FC = () => {
|
|||||||
color="#FBFBFB"
|
color="#FBFBFB"
|
||||||
sx={{ height: "1.2rem", alignSelf: "center", width: "1px" }}
|
sx={{ height: "1.2rem", alignSelf: "center", width: "1px" }}
|
||||||
/>
|
/>
|
||||||
<Typography variant="h5">Testnet Onboarding</Typography>
|
<Typography fontSize="1.25rem">Testnet Onboarding</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Toolbar>
|
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
import { Button, Typography } from "@mui/material";
|
|
||||||
import React, { PropsWithChildren } from "react";
|
|
||||||
import { Container } from "./Container";
|
|
||||||
import { ArrowBack } from "@mui/icons-material";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
export const Layout: React.FC<
|
|
||||||
PropsWithChildren<{ title: string; backLinkTitle?: string }>
|
|
||||||
> = ({ children, title, backLinkTitle = "Home" }) => {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Container boxProps={{ sx: { backgroundColor: "inherit" } }}>
|
|
||||||
<Button
|
|
||||||
startIcon={<ArrowBack />}
|
|
||||||
color="info"
|
|
||||||
sx={{ mb: 4 }}
|
|
||||||
onClick={() => navigate("/")}
|
|
||||||
>
|
|
||||||
{backLinkTitle}
|
|
||||||
</Button>
|
|
||||||
<Typography variant="h4" sx={{ mb: 4 }}>
|
|
||||||
{title}
|
|
||||||
</Typography>
|
|
||||||
<Container>{children}</Container>
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
};
|
|
34
src/layout/Layout.tsx
Normal file
34
src/layout/Layout.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { Button, Typography } from "@mui/material";
|
||||||
|
import React, { PropsWithChildren } from "react";
|
||||||
|
import { Container } from "../components/Container";
|
||||||
|
import { ArrowBack } from "@mui/icons-material";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
export const Layout: React.FC<
|
||||||
|
PropsWithChildren<{
|
||||||
|
title: string;
|
||||||
|
backLinkTitle?: string;
|
||||||
|
noBackButton?: boolean;
|
||||||
|
}>
|
||||||
|
> = ({ children, title, backLinkTitle = "Home", noBackButton = false }) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container boxProps={{ sx: { backgroundColor: "inherit", padding: 0 } }}>
|
||||||
|
{noBackButton ? null : (
|
||||||
|
<Button
|
||||||
|
startIcon={<ArrowBack />}
|
||||||
|
color="info"
|
||||||
|
sx={{ mb: 4 }}
|
||||||
|
onClick={() => navigate("/")}
|
||||||
|
>
|
||||||
|
{backLinkTitle}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Typography variant="h4" sx={{ mb: 4 }}>
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
<Container>{children}</Container>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
@ -1,15 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import {
|
import { Avatar, Button, Stack, Typography } from "@mui/material";
|
||||||
Toolbar,
|
|
||||||
Avatar,
|
|
||||||
Button,
|
|
||||||
Typography,
|
|
||||||
Container
|
|
||||||
} from "@mui/material";
|
|
||||||
|
|
||||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||||
|
import { Container } from "../components/Container";
|
||||||
|
|
||||||
const SignPageLayout = () => {
|
const SignPageLayout = () => {
|
||||||
const { disconnect, session } = useWalletConnectContext();
|
const { disconnect, session } = useWalletConnectContext();
|
||||||
@ -25,24 +20,19 @@ const SignPageLayout = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Stack justifyContent="center" alignItems="center">
|
||||||
<Toolbar variant="dense">
|
<Container
|
||||||
|
boxProps={{
|
||||||
<Button
|
sx: {
|
||||||
variant="outlined"
|
display: "flex",
|
||||||
style={{
|
flexDirection: "row",
|
||||||
marginLeft: "auto",
|
justifyContent: "space-between",
|
||||||
|
mb: 4,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
color="error"
|
|
||||||
onClick={disconnectHandler}
|
|
||||||
>
|
>
|
||||||
Disconnect
|
|
||||||
</Button>
|
|
||||||
</Toolbar>
|
|
||||||
|
|
||||||
<Container maxWidth="md">
|
|
||||||
{session && (
|
{session && (
|
||||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
<Stack spacing={0.5}>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -51,7 +41,7 @@ const SignPageLayout = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
Connected to: <b> {session.peer.metadata.name}</b>{" "}
|
<b>Connected to:</b> {session.peer.metadata.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Avatar
|
<Avatar
|
||||||
variant="square"
|
variant="square"
|
||||||
@ -66,13 +56,21 @@ const SignPageLayout = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
Session ID: <b>{session.topic} </b>
|
<b>Session ID:</b> {session.topic}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
<Outlet />
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
color="error"
|
||||||
|
onClick={disconnectHandler}
|
||||||
|
sx={{ color: "text.primary" }}
|
||||||
|
>
|
||||||
|
Disconnect
|
||||||
|
</Button>
|
||||||
</Container>
|
</Container>
|
||||||
</>
|
<Outlet />
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,12 +3,13 @@ import { useLocation, useNavigate } from "react-router-dom";
|
|||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import canonicalStringify from "canonical-json";
|
import canonicalStringify from "canonical-json";
|
||||||
|
|
||||||
import { Select, MenuItem, Box, Typography } from "@mui/material";
|
import { Select, MenuItem, Box, Typography, Stack } from "@mui/material";
|
||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import { utf8ToHex } from "@walletconnect/encoding";
|
import { utf8ToHex } from "@walletconnect/encoding";
|
||||||
|
|
||||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||||
import { ENABLE_KYC, HASHED_SUBSCRIBER_ID_KEY } from "../constants";
|
import { ENABLE_KYC, HASHED_SUBSCRIBER_ID_KEY } from "../constants";
|
||||||
|
import { Layout } from "../layout/Layout";
|
||||||
|
|
||||||
const SignWithNitroKey = () => {
|
const SignWithNitroKey = () => {
|
||||||
const { session, signClient, isSessionLoading } = useWalletConnectContext();
|
const { session, signClient, isSessionLoading } = useWalletConnectContext();
|
||||||
@ -104,17 +105,9 @@ const SignWithNitroKey = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Layout title="New Session" noBackButton>
|
||||||
{session ? (
|
{session ? (
|
||||||
<Box
|
<Stack spacing={2}>
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
marginTop: 6,
|
|
||||||
gap: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography variant="h5">Sign with Nitro key</Typography>
|
|
||||||
<Typography variant="body1">Select Laconic account:</Typography>
|
<Typography variant="body1">Select Laconic account:</Typography>
|
||||||
<Select
|
<Select
|
||||||
labelId="demo-simple-select-label"
|
labelId="demo-simple-select-label"
|
||||||
@ -151,12 +144,21 @@ const SignWithNitroKey = () => {
|
|||||||
{Boolean(ethAddress) && Boolean(cosmosAddress) && (
|
{Boolean(ethAddress) && Boolean(cosmosAddress) && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "lightgray",
|
backgroundColor: "#48474F",
|
||||||
padding: 3,
|
padding: 3,
|
||||||
wordWrap: "break-word",
|
wordWrap: "break-word",
|
||||||
|
mt: 1,
|
||||||
|
borderRadius: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<pre
|
||||||
|
style={{
|
||||||
|
whiteSpace: "pre-wrap",
|
||||||
|
margin: 0,
|
||||||
|
backgroundColor: "#48474F",
|
||||||
|
color: "#FBFBFB",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<pre style={{ whiteSpace: "pre-wrap", margin: 0 }}>
|
|
||||||
{canonicalStringify(message, null, 2)}{" "}
|
{canonicalStringify(message, null, 2)}{" "}
|
||||||
</pre>
|
</pre>
|
||||||
</Box>
|
</Box>
|
||||||
@ -172,11 +174,11 @@ const SignWithNitroKey = () => {
|
|||||||
Sign using Nitro key
|
Sign using Nitro key
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Stack>
|
||||||
) : (
|
) : (
|
||||||
<>Loading...</>
|
<>Loading...</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Layout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user