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

Added welcome page #9

Open
wants to merge 2 commits into
base: master
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
7 changes: 4 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ function App() {
<div id="navigator-container">
<BrowserRouter>
<Routes>
<Route path="/" element={<DashboardPage />} />
<Route path="/" element={<WelcomePage />} />
<Route path="/dashboard" element={<DashboardPage />} />
<Route path="/main" element={<MainPage />} />
<Route path="/fund" element={<FundPage />} />
<Route path="/defund" element={<DefundPage />} />
<Route path="/transfer" element={<TransferPage />} />
<Route path="/lock" element={<LockPage />} />
<Route path="/lock-request" element={<LockRequestPage />} />
<Route path="/lock" element={<LockPage />} />
<Route path="/lock-request" element={<LockRequestPage />} />
<Route path="/lock/:id" element={<LockDetailsPage id />} />
<Route path="/addressbook" element={"address book"} />
<Route path="/wallet" element={"wallet"} />
Expand Down
12 changes: 12 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ flex-grow: 0;
.gap-16 {
gap: 16px;
}
.margin-bottom-24 {
margin-bottom: 24px;
}
.padding-16 {
padding: 16px;
}
Expand Down Expand Up @@ -190,6 +193,15 @@ flex-grow: 0;
border: 1px solid var(--main-color);
}

.button[appereance=darkOutlined] {
background-color: transparent;
border: 1px solid var(--secondary-color);
}

.button[appereance=darkOutlined] .btn{
color: var(--secondary-color);
}

.data-panel{
border-radius: var(--border-radius);
display: flex;
Expand Down
81 changes: 32 additions & 49 deletions src/pages/welcome/welcomePage.jsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
import React, { useState } from "react";
import ScreenTitle from "../../components/texts/screenTitle.jsx";
import Subtitle from "../../components/texts/subtitle.jsx";
import DynamicButton from "../../components/buttons/dynamicButton.jsx";
import MainContainer from "../../components/containers/mainContainer.jsx";
import DynamicInput from "../../components/inputs/dynamicInput.jsx";
import React from "react";
import MainBodyContainer from "../../components/containers/main-body-container.jsx";
import { Button } from "../../components/index.js";
import styled from "styled-components";

const WelcomePage = () => {
const [walletId, setWalletId] = useState("");
const [walletIdError, setWalletIdError] = useState("");

const validateWalletId = () => {
const parsedWalletId = walletId.replace(/\D/g, ""); // Remove non-numeric characters
const ButtonContainer = styled.div`
display: flex;
flex-direction: column;
gap: 24px;
`;

if (parsedWalletId.trim() === "") {
setWalletIdError("Wallet ID cannot be empty");
} else if (parsedWalletId.length < 6 || parsedWalletId.length > 12) {
setWalletIdError("Wallet ID must be between 6 and 12 digits");
} else {
setWalletIdError(""); // Clear error if valid
}
};

const handleWalletIdChange = (e) => {
setWalletId(e.target.value);
setWalletIdError(""); // Clear error on change
};
const CenteredContainer = styled.div`
margin-top: 100px;
max-height: 100%;
`;

const WelcomePage = () => {
return (
<>
<MainContainer>
<ScreenTitle text="Welcome" />
<Subtitle text="Digital Shekel Wallet" />
<DynamicInput
type="text"
placeholder="Enter your wallet ID"
value={walletId}
onChange={handleWalletIdChange}
onBlur={validateWalletId}
error={!!walletIdError}
errorMessage={walletIdError}
/>
<CenteredContainer>
<MainBodyContainer>
<div className="padding-top-16">
<section className="gap-4 flex-column padding-top-16">
<ButtonContainer>
<h1 className="text-secondary">Let's Start</h1>

<DynamicButton
text={"Open Existing Wallet"}
bg={"#50924E"}
hoverbg={"#396d37"}
to={"/main"}
/>
<DynamicButton
text={"Create New Wallet"}
hoverbg={"#2358DC"}
bg={"#4F7AE3"}
/>
</MainContainer>
<Button text="Open existing" />
<Button appereance={"darkOutlined"} text="Enter wallet ID" />
<Button
to={"/dashboard"}
appereance={"darkOutlined"}
text="Create new wallet"
/>
</ButtonContainer>
</section>
</div>
</MainBodyContainer>
</CenteredContainer>
</>
);
};
Expand Down