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: added welcome page #384

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
39 changes: 39 additions & 0 deletions apps/web/cypress/component/WelcomePage.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference types="cypress" />
import React from "react";
import WelcomePage from "../../src/components/WelcomePage";
import { ThemeProvider } from "@mui/material/styles";
import theme from "../../src/theme";
import { CssBaseline } from "@mui/material";

describe("WelcomePage", () => {
beforeEach(() => {
cy.mount(
<ThemeProvider theme={theme}>
<CssBaseline />
<WelcomePage onContinue={cy.stub().as("continueHandler")} />
</ThemeProvider>,
);
});

it("should display the correct heading", () => {
cy.contains("Account created!").should("be.visible");
});

it("should display the welcome text", () => {
cy.contains("Welcome and thank you for joining").should("be.visible");
cy.contains("automatically receive your wallet").should("be.visible");
});

it("should have a continue button", () => {
cy.contains("button", "Continue").should("be.visible");
});

it("should call onContinue when button is clicked", () => {
cy.contains("button", "Continue").click();
cy.get("@continueHandler").should("have.been.called");
});

it("should have the check circle icon", () => {
cy.get("svg").should("be.visible");
});
});
15 changes: 15 additions & 0 deletions apps/web/src/app/welcome/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";

import React from "react";
import { useRouter } from "next/navigation";
import WelcomePage from "@/components/WelcomePage";

export default function Welcome() {
const router = useRouter();

const handleContinue = () => {
router.push("/home");
};

return <WelcomePage onContinue={handleContinue} />;
}
72 changes: 72 additions & 0 deletions apps/web/src/components/WelcomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"use client";

import { Box, Button, Container, Typography, useTheme } from "@mui/material";
import { CheckCircle } from "@mui/icons-material";

interface WelcomePageProps {
onContinue?: () => void;
}

export default function WelcomePage({ onContinue }: WelcomePageProps) {
const theme = useTheme();

const handleContinue = () => {
if (onContinue) {
onContinue();
}
};

return (
<Container maxWidth="sm">
<Box
sx={{
backgroundColor: "white",
textAlign: "center",
minHeight: "100vh",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
gap: 3,
py: 4,
}}>
<Typography variant="h5">Account created!</Typography>

<CheckCircle
sx={{
fontSize: 40,
color: theme.palette.header.main,
my: 0,
}}
/>

<Typography variant="body1" sx={{ mb: 1, width: "95%" }}>
Welcome and thank you for joining our reforestation mission and
becoming part of our global community dedicated to positive
environmental impact.
</Typography>

<Typography variant="body1" sx={{ mb: 3, width: "95%" }}>
Upon creating your account, you will automatically receive your
wallet, which you can rename later.
</Typography>

<Button
variant="contained"
color="primary"
size="large"
onClick={handleContinue}
sx={{
width: "95%",
px: 4,
py: 1.5,
borderRadius: 2,
textTransform: "none",
fontSize: "1rem",
}}>
Continue
</Button>
</Box>
</Container>
);
}