Skip to content

Commit 983d374

Browse files
committed
Added UserChoiceComponent to give user an option to contnue without login added its link in HomeComponent
1 parent 7763e9c commit 983d374

File tree

4 files changed

+73
-9
lines changed

4 files changed

+73
-9
lines changed

frontend/src/App.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import Dashboard from "./components/Admin/AdminDashboard";
6060
import OPDDashboard from "./components/Admin/AdminData";
6161
import Disclaimer from "./components/Disclaimer";
6262
import Home from "./pages/Home/Home";
63+
import UserChoice from "./pages/UserChoice/UserChoice";
6364
setupIonicReact();
6465

6566
const App: React.FC = () => {
@@ -68,10 +69,11 @@ const App: React.FC = () => {
6869
<Disclaimer />
6970
<IonReactRouter>
7071
<IonRouterOutlet id="main">
71-
<Route exact path="/home" component={Home} />
72+
<Route exact path="/home" component={Home} />
7273
<Route exact path="/login" component={LoginForm} />
7374
<Route exact path="/signup" component={Signup} />
7475
<Route exact path="/landing" component={Landing} />
76+
<Route exact path="/userchoice" component={UserChoice} />
7577
<Route path="/" exact={true}>
7678
<Redirect to="/home" />
7779
</Route>

frontend/src/components/HomeComponent.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import React from 'react';
22
import { IonIcon } from '@ionic/react'; // For Ionic icons
33
import { personCircleOutline, shieldOutline } from 'ionicons/icons'; // Admin/User Icons
4-
import { Link } from 'react-router-dom'; // For navigation
5-
4+
import { useHistory } from 'react-router-dom'; // For navigation
65
const HomeComponent = () => {
6+
const history = useHistory();
7+
8+
const handleAdminClick = () => {
9+
history.push('/admindash');
10+
};
11+
12+
const handleUserClick = () => {
13+
history.push('/userchoice');
14+
};
715
return (
816
<div className="min-h-screen flex flex-col justify-center items-center bg-gradient-to-b from-blue-100 via-white to-green-100">
917
{/* Header Section */}
@@ -20,25 +28,21 @@ const HomeComponent = () => {
2028
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 w-full max-w-4xl px-6">
2129
{/* Admin Option */}
2230
<div className="flex justify-center">
23-
<Link to="/admindash" className="w-full">
24-
<button className="w-full md:w-80 py-12 bg-blue-500 text-white rounded-lg shadow-lg hover:bg-blue-600 focus:outline-none transition-all duration-300 transform hover:scale-105">
31+
<button onClick= {handleAdminClick} className="w-full md:w-80 py-12 bg-blue-500 text-white rounded-lg shadow-lg hover:bg-blue-600 focus:outline-none transition-all duration-300 transform hover:scale-105">
2532
<div className="flex items-center justify-center space-x-2">
2633
<IonIcon icon={shieldOutline} className="text-3xl" />
2734
<span className="text-2xl">Admin</span>
2835
</div>
2936
</button>
30-
</Link>
3137
</div>
3238
{/* User Option */}
3339
<div className="flex justify-center">
34-
<Link to="/login" className="w-full">
35-
<button className="w-full md:w-80 py-12 bg-green-500 text-white rounded-lg shadow-lg hover:bg-green-600 focus:outline-none transition-all duration-300 transform hover:scale-105">
40+
<button onClick={handleUserClick} className="w-full md:w-80 py-12 bg-green-500 text-white rounded-lg shadow-lg hover:bg-green-600 focus:outline-none transition-all duration-300 transform hover:scale-105">
3641
<div className="flex items-center justify-center space-x-2">
3742
<IonIcon icon={personCircleOutline} className="text-3xl" />
3843
<span className="text-2xl">User</span>
3944
</div>
4045
</button>
41-
</Link>
4246
</div>
4347
</div>
4448
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from "react";
2+
import { IonContent, IonPage } from "@ionic/react";
3+
import { useHistory } from "react-router-dom";
4+
5+
const UserChoiceComponent: React.FC = () => {
6+
const history = useHistory();
7+
8+
const handleLoginClick = () => {
9+
history.push('/login');
10+
};
11+
12+
const handleWithoutLoginClick = () => {
13+
history.push('/landing');
14+
};
15+
16+
return (
17+
<IonPage>
18+
<div className="form-wrapper flex justify-center items-center h-full bg-gradient-to-r from-blue-50 via-blue-100 to-green-50"> {/* Background gradient */}
19+
<div className="w-11/12 max-w-lg shadow-lg p-6 bg-white rounded-lg">
20+
<div className="text-center mb-6">
21+
<h1 className="text-4xl md:text-4xl font-extrabold text-blue-600 tracking-wide">
22+
Welcome <span className="text-green-500">USER</span>
23+
</h1>
24+
<p className="text-gray-600 mt-2 text-lg md:text-xl font-light italic">
25+
How would you like to continue?
26+
</p>
27+
</div>
28+
<div className="w-full space-y-4">
29+
<button
30+
onClick={handleLoginClick}
31+
className="w-full py-3 text-lg bg-blue-600 hover:bg-blue-700 text-white rounded-lg shadow-md transition-transform transform hover:scale-105"
32+
>
33+
Continue with Login
34+
</button>
35+
36+
<button
37+
onClick={handleWithoutLoginClick}
38+
className="w-full py-3 text-lg bg-gray-200 hover:bg-gray-300 text-gray-700 rounded-lg shadow-md transition-transform transform hover:scale-105"
39+
>
40+
Continue without Login
41+
</button>
42+
</div>
43+
</div>
44+
</div>
45+
</IonPage>
46+
);
47+
};
48+
49+
export default UserChoiceComponent;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import UserChoiceComponent from "../../components/UserChoiceComponent";
2+
3+
function UserChoice() {
4+
return (
5+
<UserChoiceComponent/>
6+
)
7+
}
8+
9+
export default UserChoice;

0 commit comments

Comments
 (0)