Skip to content
Merged
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
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ Register and log in with a username and password. Authenticated users have priva

<!-- ### Expense Report Printer Page

![Expense Report Printer Page](./images/<your-image-here>)

### Google Maps Feature

![Google Maps Feature](./images/<your-image-here>) -->
![Expense Report Printer Page](./images/<your-image-here>)-->

---

Expand Down
162 changes: 78 additions & 84 deletions client/src/components/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,100 +76,94 @@ const AuthForm: React.FC = () => {
</h2>

{/* Form */}
<form onSubmit={handleSubmit}
className="flex flex-col space-y-4 w-full max-w-md">
<form
onSubmit={handleSubmit}
className="flex flex-col space-y-4 w-full max-w-md"
>
<input
className="rounded-lg border border-gray-300 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-[color:var(--teal)] bg-white text-black"
type="text"
value={username}
placeholder="Username"
onChange={(e) => setUsername(e.target.value)}
/>
<div className="relative">
<input
className="rounded-lg border border-gray-300 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-[color:var(--teal)] bg-white text-black"
type={showPassword ? "text" : "password"}
value={password}
placeholder="Password"
onChange={(e) => setPassword(e.target.value)}
/>
{/* <input
className="rounded-lg border border-gray-300 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-[color:var(--teal)] bg-white text-black"
type="password"
value={password}
placeholder="Password"
onChange={(e) => setPassword(e.target.value)}
/> */}
<button
type="button"
onClick={() => setShowPassword(!showPassword)} className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-600 hover:text-[color:var(--teal)]"
tabIndex={-1}
aria-label={showPassword ? "Hide password" : "Show password"}
>
{showPassword ? (

<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
/>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
/>
</svg>
) : (

<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.542-7a9.992 9.992 0 012.518-4.037m1.682-1.683A9.953 9.953 0 0112 5c4.477 0 8.268 2.943 9.542 7a9.956 9.956 0 01-1.533 3.25M15 12a3 3 0 11-6 0 3 3 0 016 0z"
/>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M3 3l18 18"
/>
</svg>
)}
</button>
</div>
<Button type="submit" className="w-full">
{isLogin ? "Login" : "Register"}
</Button>
<div className="flex items-center relative w-full">
<input
className="w-full pr-10 rounded-lg border border-gray-300 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-[color:var(--teal)] bg-white text-black"
type={showPassword ? "text" : "password"}
value={password}
placeholder="Password"
onChange={(e) => setPassword(e.target.value)}
/>
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-600 hover:text-[color:var(--teal)]"
tabIndex={-1}
aria-label={showPassword ? "Hide password" : "Show password"}
>
{showPassword ? (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
/>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
/>
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.542-7a9.992 9.992 0 012.518-4.037m1.682-1.683A9.953 9.953 0 0112 5c4.477 0 8.268 2.943 9.542 7a9.956 9.956 0 01-1.533 3.25M15 12a3 3 0 11-6 0 3 3 0 016 0z"
/>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M3 3l18 18"
/>
</svg>
)}
</button>
</div>
<Button type="submit" className="w-full">
{isLogin ? "Login" : "Register"}
</Button>
</form>

{/* Toggle Login/Register */}
<button
onClick={() => setIsLogin(!isLogin)}
className="mt-4 text-sm text-[color:var(--prussian)] hover:underline"
>
{isLogin
? "Need an account? Register"
: "Already have an account? Login"}
</button>
{/* Toggle Login/Register */}
<button
onClick={() => setIsLogin(!isLogin)}
className="mt-4 text-sm text-[color:var(--prussian)] hover:underline"
>
{isLogin
? "Need an account? Register"
: "Already have an account? Login"}
</button>
</div>
</Card>
</div>
</Card >
</div >
);
};

Expand Down
57 changes: 29 additions & 28 deletions client/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,40 @@ const Navbar: React.FC = () => {
setToken(null);
};

const username = localStorage.getItem("username") || "Anonymous";
const username = localStorage.getItem("username") || "Anonymous";

return (
<nav className="navbar">
<div className="navbar-container">
<div className="nav-header">
<img
src="/MileTrackerLogo-favicon.png"
alt="MileTracker Logo"
className="logo-icon"
/>
<h2 className="nav-title">MileTracker</h2>
<h3 className="nav-user">Hello {username}</h3>
</div>
<div className="navbar-container">
<h3 className="nav-user">Hello, {username}</h3>
<div className="logo-title">
<img
src="/MileTrackerLogo-favicon.png"
alt="MileTracker Logo"
className="logo-icon"
/>
<h2 className="nav-title">MileTracker</h2>
</div>

{token && (
<div className="nav-content">
<div className="nav-links">
<Link to="/dashboard">Dashboard</Link>
<Link to="/vehicles">Vehicles</Link>
<Link to="/add-trip">Add Trip</Link>
<Link to="/trips">Your Trips</Link>
<Link to="/alerts">Service Alerts</Link>
<Link to="/pdf">PDF Generator</Link>
<Link to="/expenses">Expense Manager</Link>
</div>
<div className="logout-container">
<button onClick={handleLogout}>Logout</button>
</div>
</div>
)}
{token && (
<div className="nav-content">
<div className="nav-links">
<Link to="/dashboard">Dashboard</Link>
<Link to="/vehicles">Vehicles</Link>
<Link to="/add-trip">Add Trip</Link>
<Link to="/trips">Your Trips</Link>
<Link to="/alerts">Service Alerts</Link>
<Link to="/pdf">PDF Generator</Link>
<Link to="/expenses">Expense Manager</Link>
</div>
<div className="logout-container">
<button onClick={handleLogout}>Logout</button>
</div>
</div>
</nav>
)}
</div>
</nav>

);

// return (
Expand Down
Loading