Skip to content

Commit

Permalink
fix navigation experience
Browse files Browse the repository at this point in the history
  • Loading branch information
pratyush1712 committed May 10, 2024
1 parent afb5ee5 commit df589c9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
6 changes: 3 additions & 3 deletions CleverHug-Frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ const router = createBrowserRouter([
Component: Landing
},
{
path: "/",
errorElement: <ErrorBoundary />,
element: <Layout />,
children: [
{
index: true,
path: "affirmations",
Component: AffirmationForm
}
]
Expand All @@ -51,8 +51,8 @@ function App() {
const mounted = useRef<boolean>(false);

const authFailRedirect = async () => {
if (window.location.pathname === "/login" || window.location.pathname === "/") return;
window.location.href = "/login";
if (window.location.pathname === "/login" || window.location.pathname === "/landing") return;
window.location.href = "/landing";
};

useEffect(() => {
Expand Down
35 changes: 23 additions & 12 deletions CleverHug-Frontend/src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,29 @@ export default function Landing() {
self. It’s a tool designed to keep you motivated and organized, making it easier for you to manage your time
and maintain a positive mindset.
</p>
<div className="flex min-w-[100%] max-w-md">
<input
type="email"
value={email}
onKeyDown={e => e.key === "Enter" && handleSignUp()}
onChange={e => setEmail(e.target.value)}
placeholder="Email Address"
className="flex-1 p-2 border text-black border-gray-300 rounded-l-lg focus:outline-none"
/>
<button className="bg-purple-button text-white rounded-r-lg px-4 font-medium" onClick={handleSignUp}>
{loading ? <Loading /> : "Sign Up"}
</button>
<div className="flex flex-col min-w-[100%] max-w-md">
<div className="flex min-w-[100%] max-w-md">
<input
type="email"
value={email}
onKeyDown={e => e.key === "Enter" && handleSignUp()}
onChange={e => setEmail(e.target.value)}
placeholder="Email Address"
className="flex-1 p-2 border text-black border-gray-300 rounded-l-lg focus:outline-none"
/>
<button
className="bg-purple-button hover:bg-purple-600 text-white rounded-r-md mr-2 px-4 font-medium"
onClick={handleSignUp}
>
{loading ? <Loading /> : "Sign Up"}
</button>
<button
className="hover:bg-purple-button bg-purple-600 text-white rounded-md px-4 font-medium"
onClick={() => (window.location.href = "/login")}
>
{loading ? <Loading /> : "Check it out"}
</button>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion CleverHug-Frontend/src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Login() {
} else {
localStorage.removeItem("token");
localStorage.setItem("token", data.token);
window.location.href = "/affirmations";
window.location.href = "/";
}
};

Expand Down

0 comments on commit df589c9

Please sign in to comment.