Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
0d1b538
chore: commit all changes (automated)
RandithaK Nov 11, 2025
f29671f
style: improve NotificationBell component layout and styling
RandithaK Nov 11, 2025
83a5ea0
feat: implement RoleSwitcher component and integrate role management …
RandithaK Nov 11, 2025
ce2237f
feat: enhance ServiceTypesPage with create, edit, delete, and toggle …
RandithaK Nov 11, 2025
b4df449
feat: add user activation/deactivation functionality with confirmatio…
RandithaK Nov 11, 2025
cd75020
feat: update service type fetching to retrieve only active service types
RandithaK Nov 11, 2025
d96438e
feat: implement time tracking functionality with clock in/out feature…
RandithaK Nov 11, 2025
838e6fd
feat: Add role-based access control for user role management and upda…
Akith-002 Nov 11, 2025
7b79b1c
refactor: Change service type deletion from soft delete to hard delet…
Akith-002 Nov 11, 2025
ba9415a
feat: Add customer confirmation for appointment completion and update…
Akith-002 Nov 11, 2025
c7a9fea
refactor: Remove unused imports and clean up appointment service code
Akith-002 Nov 11, 2025
722ae77
feat: Add clock-in functionality to appointment service and update ap…
RandithaK Nov 11, 2025
5c3f926
refactor: Update notification callback type to unknown and improve We…
RandithaK Nov 11, 2025
f02ffc0
feat: Add git hooks for linting and build checks; include setup scrip…
RandithaK Nov 11, 2025
2258fe0
refactor: Remove unused state variables and improve vehicle loading l…
RandithaK Nov 11, 2025
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
19 changes: 19 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Git pre-commit hook to run ESLint
# This hook runs on every commit to ensure code quality

echo "🔍 Running ESLint check..."

# Run lint check
npm run lint

# Check the exit status
if [ $? -ne 0 ]; then
echo "❌ ESLint failed. Please fix the linting errors before committing."
echo "💡 Run 'npm run lint' to see the issues"
exit 1
fi

echo "✅ ESLint passed! Commit is proceeding..."
exit 0
19 changes: 19 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Git pre-push hook to run build check
# This hook runs before pushing to ensure the project builds successfully

echo "🏗️ Running build check before push..."

# Run build check
npm run build

# Check the exit status
if [ $? -ne 0 ]; then
echo "❌ Build failed. Please fix the build errors before pushing."
echo "💡 Run 'npm run build' to see the issues"
exit 1
fi

echo "✅ Build passed! Push is proceeding..."
exit 0
61 changes: 61 additions & 0 deletions GIT_HOOKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Git Hooks

This project uses git hooks to maintain code quality and ensure builds pass before commits and pushes.

## Hooks Installed

- **pre-commit**: Runs `npm run lint` before each commit
- Prevents commits if ESLint errors are found
- Ensures code follows the project's linting standards

- **pre-push**: Runs `npm run build` before each push
- Prevents pushes if the build fails
- Ensures the project compiles successfully before sharing changes

## Setup

Run the setup script to configure git hooks:

```bash
./setup-hooks.sh
```

Or manually configure:

```bash
chmod +x .githooks/pre-commit .githooks/pre-push
git config core.hooksPath .githooks
```

## Bypassing Hooks

Sometimes you may need to bypass hooks (use sparingly):

```bash
# Skip pre-commit hook
git commit --no-verify -m "your message"

# Skip pre-push hook
git push --no-verify
```

## Hook Details

### Pre-commit Hook
- Runs automatically on `git commit`
- Executes `npm run lint`
- Exits with error code if linting fails
- Shows helpful error messages

### Pre-push Hook
- Runs automatically on `git push`
- Executes `npm run build`
- Exits with error code if build fails
- Prevents pushing broken code to remote repository

## Benefits

✅ **Code Quality**: Ensures all committed code passes linting standards
✅ **Build Safety**: Prevents pushing code that doesn't compile
✅ **Team Consistency**: All developers follow the same quality checks
✅ **CI/CD Friendly**: Reduces failed builds in CI/CD pipelines
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ This repository contains the source code for the TechTorque 2025 customer and em

3. **Access Application:**
Open [http://localhost:3000](http://localhost:3000) in your browser.

4. **Setup Git Hooks (Recommended):**
```bash
npm run setup-hooks
```
This configures automatic linting on commit and build checking on push. See [GIT_HOOKS.md](GIT_HOOKS.md) for details.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev --turbopack",
"build": "next build --turbopack",
"start": "next start",
"lint": "eslint"
"lint": "eslint",
"setup-hooks": "chmod +x .githooks/pre-commit .githooks/pre-push && git config core.hooksPath .githooks && echo '✅ Git hooks configured successfully!'"
},
"dependencies": {
"@stomp/stompjs": "^7.2.1",
Expand Down
13 changes: 13 additions & 0 deletions public/runtime-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// runtime-config.js
// This file is intentionally simple and is loaded before the app hydrates.
// In production you may overwrite this file at container startup with real
// environment values. Example generation (Linux entrypoint):
// cat > /usr/share/app/public/runtime-config.js <<EOF
// window.__RUNTIME_CONFIG__ = { NEXT_PUBLIC_API_BASE_URL: "$NEXT_PUBLIC_API_BASE_URL" }
// EOF

window.__RUNTIME_CONFIG__ = {
// Default values used for local development. Replace at runtime in containers.
// Point to the API Gateway service (update host/port as needed for your environment)
NEXT_PUBLIC_API_BASE_URL: "http://localhost:8080",
};
22 changes: 22 additions & 0 deletions setup-hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Setup script for git hooks
# Run this script to configure git hooks for the project

echo "🔧 Setting up git hooks..."

# Make hooks executable
chmod +x .githooks/pre-commit .githooks/pre-push

# Configure git to use our hooks directory
git config core.hooksPath .githooks

echo "✅ Git hooks configured successfully!"
echo ""
echo "Hooks installed:"
echo " 📋 pre-commit: Runs 'npm run lint' before each commit"
echo " 🏗️ pre-push: Runs 'npm run build' before each push"
echo ""
echo "To disable hooks temporarily, use:"
echo " git commit --no-verify (skip pre-commit hook)"
echo " git push --no-verify (skip pre-push hook)"
30 changes: 24 additions & 6 deletions src/app/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ export default function LoginPage() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [warning, setWarning] = useState<string | null>(null);
const [unverifiedEmail, setUnverifiedEmail] = useState<string | null>(null);

const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setError(null);
setWarning(null);
setUnverifiedEmail(null);
setLoading(true);
const form = e.currentTarget;
const formData = new FormData(form);
const email = (formData.get('username') as string) || '';
const payload: LoginRequest = {
username: (formData.get('username') as string) || '',
username: email,
password: (formData.get('password') as string) || '',
};
try {
Expand All @@ -51,7 +54,14 @@ export default function LoginPage() {
}
} catch (err: unknown) {
const errorMessage = err instanceof Error ? err.message : 'Login failed';
setError(errorMessage);

// Check if error is about email verification
if (errorMessage.includes('verify your email') || errorMessage.includes('email address')) {
setUnverifiedEmail(email);
setError(errorMessage);
} else {
setError(errorMessage);
}
} finally {
setLoading(false);
}
Expand Down Expand Up @@ -149,13 +159,21 @@ export default function LoginPage() {
</div>
</form>
{error && (
<div role="alert" className="mt-4 text-sm text-red-600">
{error}
<div role="alert" className="mt-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">
<p className="text-sm text-red-600 dark:text-red-400 mb-2">{error}</p>
{unverifiedEmail && (
<Link
href={`/auth/resend-verification?email=${encodeURIComponent(unverifiedEmail)}`}
className="text-sm text-blue-600 dark:text-blue-400 hover:underline font-semibold"
>
Resend Verification Email →
</Link>
)}
</div>
)}
{warning && (
<div role="alert" className="mt-4 text-sm text-yellow-600">
{warning}
<div role="alert" className="mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg">
<p className="text-sm text-yellow-600 dark:text-yellow-400">{warning}</p>
</div>
)}
</div>
Expand Down
40 changes: 26 additions & 14 deletions src/app/auth/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import React from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import authService from "../../../services/authService";
import ThemeToggle from "../../components/ThemeToggle";
Expand Down Expand Up @@ -70,8 +69,6 @@ const EyeOffIcon = () => (

// --- Register Page Component ---
export default function RegisterPage() {
const router = useRouter();

const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState(false);
Expand Down Expand Up @@ -118,10 +115,7 @@ export default function RegisterPage() {
try {
await authService.register(payload);
setSuccess(true);
// Redirect to login after 3 seconds
setTimeout(() => {
router.push("/auth/login");
}, 3000);
// Don't automatically redirect - let user see the success message
} catch (err: unknown) {
const errorMessage =
err instanceof Error ? err.message : "Registration failed";
Expand Down Expand Up @@ -186,13 +180,31 @@ export default function RegisterPage() {
<p className="text-base theme-text-secondary mb-2">
Welcome to TechTorque Auto, {formData.fullName}!
</p>
<p className="text-sm theme-text-muted">
A verification email has been sent to {formData.email}. Please
verify your email to log in.
</p>
<p className="mt-6 text-sm theme-text-muted animate-pulse">
Redirecting to login...
</p>
<div className="mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800">
<p className="text-sm font-semibold theme-text-primary mb-2">
📧 Verify Your Email
</p>
<p className="text-sm theme-text-muted mb-3">
A verification email has been sent to <strong>{formData.email}</strong>.
<br />
<strong>You must verify your email before you can log in.</strong>
</p>
<p className="text-xs theme-text-muted">
Didn&apos;t receive the email?{' '}
<Link
href={`/auth/resend-verification?email=${encodeURIComponent(formData.email)}`}
className="text-blue-600 dark:text-blue-400 hover:underline font-semibold"
>
Resend verification email
</Link>
</p>
</div>
<Link
href="/auth/login"
className="theme-button-primary inline-block px-8 py-3"
>
Go to Login
</Link>
</div>
) : (
<>
Expand Down
Loading