Repository: unelmacoin/unelma-code-translate
Pull request #81: Sign up with google
Author: login: bishnu-suyel
Labels: name: enhancement
description: New feature or request
name: modification
Created: 2025-03-10T08:42:04Z | Merged: 2025-03-12T09:24:31Z

Related Ticket: UP-255
In this PR:
- Refactor `Nav.tsx` to use toggleDarkMode directly & removed unnecessary isLoading state.
- Update `RestrictedModelModal` component to handle sign up or switch model.
- Added signInWithEmail & signInWithGoogle methods to `AuthContext.tsx`.
- Create `ThemeContext.tsx` to ensure consistent theme across the app.
- Wrap the app with ThemeProvider in `_app.tsx` to manage theme state globally.
- Add useTheme hook from `ThemeContext.tsx` to manage dark/light mode in `index.tsx`.
- Add `login.tsx` to handle user login with email & password.
- Add `signup.tsx` to handle user registration with options for google & email sign-up.
- Add `signupwithemail.tsx` to handle user registration with name, email & password.

**Modified :**
- Move signInWithGoogle function from  `Nav.ts` & related state to `signup.tsx`to improve component separation and usage.
- Added error handling for sign-in and sign-out methods in `AuthContext.tsx` to re-throw errors for better error management.
- Initialize isDark state with the stored value from localStorage and ensured consistent handling of localStorage values in `ThemeContext.tsx`.
- Added form validation and error handling for invalid email and password in `login.tsx` to improve user feedback during login attempts.
- Added form validation for email format and password length in `signupwithemail` to improve user input validation.
- Moved signInWithGoogle to `Signup.tsx` from `Nav.tsx` and ensured direct redirection to the homepage after signing up using Google.
- Upload google logo to local folder `public`.

TO TEST:
- Enable email/password authentication in firebase console.
- Pull the latest changes.
- Test & run the code.
- Review it & if works well then finally merge.


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a global dark mode with persistent theme preferences.
  - Launched new login and sign-up pages, including an email registration option, with enhanced authentication flows.
  - Updated modal messaging to inform users when translation limits are reached, offering alternative access options.
  - Added a new context for managing theme state.

- **UI Enhancements**
  - Improved navigation for a smoother sign-in/out experience with refined loading and conditional authentication options.
  - Adjusted layout spacing to enhance visual consistency across the app.
  - Enhanced user interface for the login and sign-up components with responsive design and theme support.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/components/Nav.tsx b/components/Nav.tsx
index 639bb81..e1576f8 100644
--- a/components/Nav.tsx
+++ b/components/Nav.tsx
@@ -1,36 +1,19 @@
-import React, { MouseEventHandler } from 'react';
+import React from 'react';
 import ThemeButton from './ThemeButton';
 import { useAuth } from '../contexts/AuthContext';
 import Link from 'next/link';
-import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
-import Image from 'next/image';
-import { auth } from '../config/firebase';
-import { toast } from 'react-toastify';
 
-interface themeBtn {
+interface NavProps {
   isDark: boolean;
-  toggleDarkMode: MouseEventHandler<HTMLButtonElement>;
-  handleSignInSuccess?: () => void;
+  toggleDarkMode: () => void; // Changed this type
+  showAuthButtons?: boolean;
 }
 
-export const signInWithGoogle = async (handleSignInSuccess?: () => void) => {
-  try {
-    const provider = new GoogleAuthProvider();
-    const result = await signInWithPopup(auth, provider);
-    if (result.user) {
-      toast.success('Successfully signed in using google!\nYou now have unlimited access.', {
-        autoClose: 2000 // Show for 2 seconds
-      });
-      if (handleSignInSuccess) {
-        setTimeout(handleSignInSuccess, 1500); // Call handler after 1.5 seconds
-      }
-    }
-  } catch (error) {
-    console.error('Error signing in with Google:', error);
-  }
-};
-
-const Nav: React.FC<themeBtn> = ({isDark, toggleDarkMode, handleSignInSuccess}) => {
+const Nav: React.FC<NavProps> = ({
+  isDark,
+  toggleDarkMode,
+  showAuthButtons = true,
+}) => {
   const { user, signOut } = useAuth();
 
   const handleSignOut = async () => {
@@ -41,47 +24,75 @@ const Nav: React.FC<themeBtn> = ({isDark, toggleDarkMode, handleSignInSuccess})
     }
   };
 
+  const handleDarkModeToggle = () => {
+    toggleDarkMode(); // Just call the function directly
+  };
+
   return (
-    <nav className="mb-0">
-      <div className="sm:px-10 flex w-full flex-wrap items-center justify-between py-0 px-4">
-        <div className="flex items-center">
+    <nav
+      className={`fixed left-0 right-0 top-0 z-50 h-24 ${
+        isDark ? 'bg-[#333333] text-white' : 'bg-[#E8EBF5] text-black'
+      } transition-all duration-300`}
+    >
+      <div className="flex h-full w-full flex-wrap items-center justify-between px-4 sm:px-10">
+        <div className="flex h-full items-center">
           <Link href="https://translate.u16p.com/">
-            <h1 className='text-2xl font-medium -mt-1 leading-none'>Unelma-Code Translator</h1>
+            <h1 className="text-2xl font-medium leading-none">
+              Unelma-Code Translator
+            </h1>
           </Link>
         </div>
-        <div className='flex flex-col items-end space-y-0.5'>
-          <div className='flex items-center space-x-4'>
-            <Link href="https://u16p.com/" className={isDark ? 'text-[#FFFFFF]' : 'text-[#000000]'}>
+        <div className="flex h-full flex-col items-end">
+          <div className="mt-6 flex h-full items-center space-x-4">
+            <Link
+              href="https://u16p.com/"
+              className={isDark ? 'text-[#FFFFFF]' : 'text-[#000000]'}
+            >
               Back to U16P
             </Link>
-            <ThemeButton isDark={isDark} toggleDarkMode={toggleDarkMode}/>
-          </div>
-          <div className={isDark ? 'text-[#FFFFFF] text-xs' : 'text-gray-600 text-xs'}>
-            {user ? (
-              `Signed in as ${user.displayName || user.email}`
-            ) : (
-              <button
-                onClick={() => signInWithGoogle(handleSignInSuccess)}
-                className={`flex items-center justify-center px-4 py-2 transform transition-transform duration-200 ${isDark ? 'text-[#FFFFFF] hover:scale-110' : 'text-[#000000] hover:scale-110'}`}
-              >
-                <Image
-                  src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg"
-                  alt="Google logo"
-                  width={24}
-                  height={24}
-                  className="w-6 h-6 mr-2"
-                />
-                Sign in with Google
-              </button>
-            )}
+            <ThemeButton
+              isDark={isDark}
+              toggleDarkMode={handleDarkModeToggle}
+            />
           </div>
-          {user && (
-            <button
-              onClick={handleSignOut}
-              className={`text-xs transform transition-transform duration-200 ${isDark ? 'text-[#FFFFFF] hover:scale-110' : 'text-[#000000] hover:scale-110'}`}
+          {showAuthButtons && (
+            <div
+              className={`${
+                isDark ? 'text-xs text-white' : 'text-xs text-gray-600'
+              } mb-4`}
             >
-              Sign out
-            </button>
+              {user ? (
+                <div className="flex items-center">
+                  <span className={isDark ? 'text-white' : 'text-black'}>
+                    Signed in as {user.displayName || user.email}
+                  </span>
+                  <button
+                    onClick={handleSignOut}
+                    className={`ml-4 transform px-4 py-2 transition-transform duration-200 ${
+                      isDark
+                        ? 'text-white hover:scale-110'
+                        : 'text-black hover:scale-110'
+                    }`}
+                  >
+                    Sign out
+                  </button>
+                </div>
+              ) : (
+                <div className="flex items-center">
+                  <span className={isDark ? 'text-white' : 'text-black'}></span>
+                  <Link
+                    href="/signup"
+                    className={`flex transform items-center justify-center px-4 py-2 transition-transform duration-200 ${
+                      isDark
+                        ? 'text-white hover:scale-110'
+                        : 'text-black hover:scale-110'
+                    }`}
+                  >
+                    Sign up
+                  </Link>
+                </div>
+              )}
+            </div>
           )}
         </div>
       </div>
@@ -89,4 +100,4 @@ const Nav: React.FC<themeBtn> = ({isDark, toggleDarkMode, handleSignInSuccess})
   );
 };
 
-export default Nav;
\ No newline at end of file
+export default Nav;
diff --git a/components/RestrictedModelModal.tsx b/components/RestrictedModelModal.tsx
index a4458e8..03a3262 100644
--- a/components/RestrictedModelModal.tsx
+++ b/components/RestrictedModelModal.tsx
@@ -1,7 +1,6 @@
 import { useEffect } from 'react';
-import { signInWithGoogle } from './Nav';
+import { useRouter } from 'next/router';
 import { useAuth } from '../contexts/AuthContext';
-import { toast } from 'react-hot-toast';
 
 interface RestrictedModelModalProps {
   isOpen: boolean;
@@ -10,6 +9,7 @@ interface RestrictedModelModalProps {
 
 export default function RestrictedModelModal({ isOpen, onClose }: RestrictedModelModalProps) {
   const { user } = useAuth();
+  const router = useRouter();
 
   useEffect(() => {
     if (user) {
@@ -19,38 +19,38 @@ export default function RestrictedModelModal({ isOpen, onClose }: RestrictedMode
 
   if (!isOpen) return null;
 
-  const handleSignInSuccess = () => {
-    toast.success('Successfully signed in using google!\nYou now have unlimited access.', {
-      duration: 2000 // Show for 2 seconds
-    });
-    setTimeout(onClose, 1500); // Close modal after 1.5 seconds
+  const handleSignUpClick = () => {
+    router.push('/signup');
   };
 
   return (
     <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
-      <div className="bg-white p-8 rounded-lg max-w-md w-full">
-        <h2 className="text-2xl font-bold mb-4">Advanced Model Limit</h2>
+      <div className="bg-white p-8 rounded-lg max-w-md w-full text-center">
+      <h2 className="text-2xl font-bold mb-4">Advanced Model Limit Reached</h2>
         <p className="mb-6">
-          You have used your free translation with this GPT-4 model.
-          To continue using advanced models:
-          </p>
-          <ul className="list-disc ml-6 mt-2">
-            <li>Sign in with Google for unlimited access</li>
-            <li>Switch to GPT-3.5 for unlimited free translations</li>
-          </ul>
-        <div className="flex justify-end gap-4">
-          <button
-            onClick={() => signInWithGoogle(handleSignInSuccess)}
-            className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transform transition-transform duration-200 hover:scale-110"
-          >
-            Sign in with Google
-          </button>
-          <button
-            onClick={onClose}
-            className="px-4 py-2 bg-gray-50 text-black rounded hover:bg-gray-100 transform transition-transform duration-200 hover:scale-110"
-          >
-            Switch Model
-          </button>
+          You have reached the limit for free translations using GPT-4.  
+          To continue using advanced AI models:
+        </p>
+        <div className="ml-6 mt-2 text-center font-bold">
+          <p>sign up for unlimited access</p>
+          <p className="my-1">or</p>
+          <p>switch to GPT-3.5 for unlimited free translations</p>
+        </div>
+        <div className="flex justify-end gap-4 mt-4">
+          <div className="flex w-full gap-4">
+            <button
+              onClick={handleSignUpClick}
+              className="flex-1 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transform transition-transform duration-200 hover:scale-110"
+            >
+              Sign Up
+            </button>
+            <button
+              onClick={onClose}
+              className="flex-1 px-4 py-2 bg-gray-50 text-black rounded hover:bg-gray-100 transform transition-transform duration-200 hover:scale-110"
+            >
+              Switch Model
+            </button>
+          </div>
         </div>
       </div>
     </div>
diff --git a/contexts/AuthContext.tsx b/contexts/AuthContext.tsx
index b3f3428..16bc3ee 100644
--- a/contexts/AuthContext.tsx
+++ b/contexts/AuthContext.tsx
@@ -1,16 +1,22 @@
 import { createContext, useContext, useEffect, useState } from 'react';
 import { auth } from '../config/firebase';
-import { User, signOut as firebaseSignOut } from 'firebase/auth';
+import { User, signOut as firebaseSignOut, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider } from 'firebase/auth';
 
 export interface AuthContextType {
   user: User | null;
   loading: boolean;
+
+  signInWithEmail: (email: string, password: string) => Promise<void>;
+  signInWithGoogle: () => Promise<void>;
   signOut: () => Promise<void>;
 }
 
 const AuthContext = createContext<AuthContextType>({
   user: null,
   loading: true,
+
+  signInWithEmail: async () => {},
+  signInWithGoogle: async () => {},
   signOut: async () => {},
 });
 
@@ -18,11 +24,31 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
   const [user, setUser] = useState<User | null>(null);
   const [loading, setLoading] = useState(true);
 
+  const signInWithEmail = async (email: string, password: string) => {
+    try {
+      await signInWithEmailAndPassword(auth, email, password);
+    } catch (error) {
+      console.error('Error signing in with email:', error);
+      throw error;
+    }
+  };
+
+  const signInWithGoogle = async () => {
+    try {
+      const provider = new GoogleAuthProvider();
+      await signInWithPopup(auth, provider);
+    } catch (error) {
+      console.error('Error signing in with Google:', error);
+      throw error; 
+    }
+  };
+
   const signOut = async () => {
     try {
       await firebaseSignOut(auth);
     } catch (error) {
       console.error('Error signing out:', error);
+      throw error; 
     }
   };
 
@@ -36,7 +62,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
   }, []);
 
   return (
-    <AuthContext.Provider value={{ user, loading, signOut }}>
+    <AuthContext.Provider value={{ user, loading, signInWithEmail, signInWithGoogle, signOut }}>
       {!loading && children}
     </AuthContext.Provider>
   );
diff --git a/contexts/ThemeContext.tsx b/contexts/ThemeContext.tsx
new file mode 100644
index 0000000..9a0b30e
--- /dev/null
+++ b/contexts/ThemeContext.tsx
@@ -0,0 +1,39 @@
+import React, { createContext, useContext, useState, useEffect } from 'react';
+
+interface ThemeContextType {
+  isDark: boolean;
+  toggleDarkMode: () => void;
+}
+
+const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
+
+export function ThemeProvider({ children }: { children: React.ReactNode }) {
+  const [isDark, setIsDark] = useState(() => 
+    typeof window !== 'undefined' && JSON.parse(localStorage.getItem('unelTheme') || 'false')
+  );
+
+  useEffect(() => {
+    document.body.style.backgroundColor = isDark ? '#131416' : '#fff';
+  }, [isDark]);
+
+  const toggleDarkMode = () => {
+    const newIsDark = !isDark;
+    setIsDark(newIsDark);
+    localStorage.setItem('unelTheme', JSON.stringify(newIsDark));
+    document.body.style.backgroundColor = newIsDark ? '#131416' : '#fff';
+  };
+
+  return (
+    <ThemeContext.Provider value={{ isDark, toggleDarkMode }}>
+      {children}
+    </ThemeContext.Provider>
+  );
+}
+
+export function useTheme() {
+  const context = useContext(ThemeContext);
+  if (context === undefined) {
+    throw new Error('useTheme must be used within a ThemeProvider');
+  }
+  return context;
+}
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 89b0dea..0278c10 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,20 +1,18 @@
-import "@/styles/globals.css";
-import type { AppProps } from "next/app";
-import { Inter } from "next/font/google";
+import '@/styles/globals.css';
+import type { AppProps } from 'next/app';
 import { AuthProvider } from '../contexts/AuthContext';
+import { ThemeProvider } from '../contexts/ThemeContext';
 import { Toaster } from 'react-hot-toast';
-import Nav from '../components/Nav';
 
-const inter = Inter({ subsets: ["latin"] });
-
-function App({ Component, pageProps }: AppProps<{}>) {
+function App({ Component, pageProps }: AppProps) {
   return (
     <AuthProvider>
-      <main className={inter.className}>
-        <Nav isDark={false} toggleDarkMode={() => {}} />
-        <Component {...pageProps} />
-      </main>
-      <Toaster position="top-center" />
+      <ThemeProvider>
+        <main>
+          <Component {...pageProps} />
+        </main>
+        <Toaster position="top-center" />
+      </ThemeProvider>
     </AuthProvider>
   );
 }
diff --git a/pages/index.tsx b/pages/index.tsx
index 56e263a..11aa915 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -19,6 +19,7 @@ import { Feedback } from '@/components/Feedback';
 import SweetAlert from '@/components/SweetAlert';
 import { useTranslationLimit } from '../hooks/useTranslationLimit';
 import RestrictedModelModal from '../components/RestrictedModelModal';
+import { useTheme } from '../contexts/ThemeContext';
 require('dotenv').config();
 
 type AnyFunction = (...args: any[]) => any;
@@ -55,7 +56,9 @@ function debounce<T extends AnyFunction>(fn: T, delay: number): DebouncedFunctio
   return debouncedWithCancel;
 }
 export default function Home() {
-  const [inputLanguage, setInputLanguage] = useState<string>('Natural Language');
+  const { isDark, toggleDarkMode } = useTheme();
+  const [inputLanguage, setInputLanguage] =
+    useState<string>('Natural Language');
   const [outputLanguage, setOutputLanguage] = useState<string>('');
   const [inputCode, setInputCode] = useState<string>('');
   const [outputCode, setOutputCode] = useState<string>('');
@@ -63,7 +66,6 @@ export default function Home() {
   const [loading, setLoading] = useState<boolean>(false);
   const [hasTranslated, setHasTranslated] = useState<boolean>(false);
   const [apiKey, setApiKey] = useState<string>('');
-  const [isDark, setIsDark] = useState<boolean>(true);
   const [history, setHistory] = useState<Set<string>>(new Set());
   const [historyExpand, setHistoryExpand] = useState<boolean>(false);
   const translateTimeoutRef = useRef<NodeJS.Timeout | null>(null);
@@ -73,13 +75,6 @@ export default function Home() {
     toast.info('Enter or upload some code in Input');
   }, []);
 
-  useEffect(() => {
-    const storedTheme = localStorage.getItem('unelTheme');
-    if (storedTheme !== null) {
-      setIsDark(JSON.parse(storedTheme));
-    }
-  }, []);
-
   const handleHistoryExpand = () => {
     setHistoryExpand(!historyExpand);
   };
@@ -307,12 +302,6 @@ export default function Home() {
     setHasTranslated(false); // Reset translation state when swapping languages
   };
 
-  const toggleDarkMode = () => {
-    const newIsDark = !isDark;
-    setIsDark(newIsDark);
-    localStorage.setItem('unelTheme', JSON.stringify(newIsDark));
-  };
-
   const handleHistorySelect = useCallback((value: string) => {
     const { inputCode, inputLanguage, outputLanguage, model } = JSON.parse(value);
     setInputCode(inputCode);
@@ -330,11 +319,6 @@ export default function Home() {
     document.body.style.backgroundColor = color;
   };
 
-  useEffect(() => {
-    const backgroundColor = isDark ? '#131416' : '#fff';
-    changeBodyBackgroundColor(backgroundColor);
-  }, [isDark]);
-
   useEffect(() => {
     const handleSwap = () => {
       setInputLanguage(outputLanguage);
@@ -407,7 +391,7 @@ export default function Home() {
           <div
             className={`flex flex-col ${
               historyExpand ? 'md:items-start' : ''
-            }justify-center mt-0 md:mt-0 lg:mt-0`}
+            }justify-center mt-16 md:mt-16 lg:mt-16`}
           >
             <div className="text-4xl font-bold">Code Translator</div>
           </div>
diff --git a/pages/login.tsx b/pages/login.tsx
new file mode 100644
index 0000000..0bd3b70
--- /dev/null
+++ b/pages/login.tsx
@@ -0,0 +1,130 @@
+import React, { useState } from 'react';
+import { toast } from 'react-hot-toast';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import Nav from '../components/Nav';
+import { useTheme } from '../contexts/ThemeContext';
+import { useAuth } from '../contexts/AuthContext';
+
+const Login: React.FC = () => {
+  const { isDark, toggleDarkMode } = useTheme();
+  const { signInWithEmail } = useAuth();
+  const [email, setEmail] = useState('');
+  const [password, setPassword] = useState('');
+  const [errors, setErrors] = useState({ email: '', password: '' });
+  const [isLoading, setIsLoading] = useState(false);
+  const router = useRouter();
+
+  const validateEmail = (email: string) => {
+    const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+    return re.test(String(email).toLowerCase());
+  };
+
+  const validatePassword = (password: string) => {
+    return password.length >= 6;
+  };
+
+  const handleLogin = async () => {
+    const emailError = !validateEmail(email) ? 'Invalid email format' : '';
+    const passwordError = !validatePassword(password)
+      ? 'Password must be at least 6 characters'
+      : '';
+
+    setErrors({ email: emailError, password: passwordError });
+
+    if (emailError || passwordError) {
+      return;
+    }
+
+    setIsLoading(true);
+    try {
+      await signInWithEmail(email, password);
+      toast.success('Successfully logged in!', {
+        duration: 2000, // Show for 2 seconds
+      });
+      router.push('/');
+    } catch (error) {
+      toast.error('Invalid email or password. Please try again.');
+    } finally {
+      setIsLoading(false);
+    }
+  };
+
+  const handleSubmit = (e: React.FormEvent) => {
+    e.preventDefault();
+    handleLogin();
+  };
+
+  return (
+    <div
+      className={`min-h-screen ${
+        isDark ? 'bg-[#000000] text-[#FFFFFF]' : 'bg-[#FFFFFF] text-[#000000]'
+      }`}
+    >
+      <div className="pt-4">
+        <Nav
+          isDark={isDark}
+          toggleDarkMode={toggleDarkMode}
+          showAuthButtons={false}
+        />
+      </div>
+      <div className="mt-24 flex flex-col items-center justify-center py-2">
+        <h1 className="mb-4 text-3xl font-bold">Log In</h1>
+        <form onSubmit={handleSubmit} className="flex w-full max-w-md flex-col space-y-4">
+          <input
+            type="email"
+            placeholder="Email"
+            value={email}
+            onChange={(e) => setEmail(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          {errors.email && (
+            <p className="text-red-500 text-sm">{errors.email}</p>
+          )}
+          <input
+            type="password"
+            placeholder="Password"
+            value={password}
+            onChange={(e) => setPassword(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          {errors.password && (
+            <p className="text-red-500 text-sm">{errors.password}</p>
+          )}
+          <button
+            type="submit"
+            disabled={isLoading}
+            className={`rounded px-4 py-2 ${
+              isDark
+                ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
+                : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
+            }`}
+          >
+            {isLoading ? 'Logging in...' : 'Log In'}
+          </button>
+          <div className={`${isDark ? 'text-white' : 'text-black'}`}>
+            Don&apos;t have an account?{' '}
+            <Link
+              href="/signup"
+              className={`hover:underline ${
+                isDark ? 'text-white' : 'text-black'
+              }`}
+            >
+              Sign Up
+            </Link>
+          </div>
+        </form>
+      </div>
+    </div>
+  );
+};
+
+export default Login;
\ No newline at end of file
diff --git a/pages/signup.tsx b/pages/signup.tsx
new file mode 100644
index 0000000..1bd3fe1
--- /dev/null
+++ b/pages/signup.tsx
@@ -0,0 +1,110 @@
+import React, { useState } from 'react';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import Image from 'next/image';
+import Nav from '../components/Nav';
+import { toast } from 'react-hot-toast';
+import { useTheme } from '../contexts/ThemeContext';
+import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
+import { auth } from '../config/firebase';
+
+const signInWithGoogle = async () => {
+  try {
+    const provider = new GoogleAuthProvider();
+    const result = await signInWithPopup(auth, provider);
+    return result.user;
+  } catch (error) {
+    console.error('Error signing in with Google:', error);
+    return null;
+  }
+};
+
+const SignUp: React.FC = () => {
+  const { isDark, toggleDarkMode } = useTheme();
+  const [isSigningIn, setIsSigningIn] = useState(false);
+  const router = useRouter();
+
+  const handleSignInWithGoogle = async () => {
+    setIsSigningIn(true);
+    const user = await signInWithGoogle();
+    setIsSigningIn(false);
+    if (user) {
+      toast.success('Successfully signed in using Google !', {
+        duration: 2000, // Show for 2 seconds
+      });
+      router.push('/');
+    }
+  };
+
+  return (
+    <div
+      className={`flex min-h-screen flex-col ${
+        isDark ? 'bg-[#000000] text-[#FFFFFF]' : 'bg-[#FFFFFF] text-[#000000]'
+      }`}
+    >
+      <div className="pt-4">
+        <Nav
+          isDark={isDark}
+          toggleDarkMode={toggleDarkMode}
+          showAuthButtons={false}
+        />
+      </div>
+      <div className="mt-24 flex flex-grow items-start justify-center">
+        <div className="flex flex-col items-center justify-center space-y-6 py-2">
+          <h1 className="mb-4 text-3xl font-bold">Sign Up</h1>
+          <h2 className="font mb-12 text-2xl">
+            Already a member?{' '}
+            <Link href="/login" legacyBehavior>
+              <a
+                className={`hover:underline ${
+                  isDark ? 'text-white' : 'text-black'
+                }`}
+              >
+                Log In
+              </a>
+            </Link>
+          </h2>
+          <button
+            onClick={handleSignInWithGoogle}
+            className={`mb-6 flex h-16 w-96 items-center justify-center rounded px-6 py-4 ${
+              isDark
+                ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
+                : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
+            }`}
+          >
+            <div className="flex w-full items-center justify-center">
+              <Image
+                src="/google.svg"
+                alt="Google logo"
+                width={36}
+                height={36}
+                className="mr-3 h-9 w-9"
+              />
+              <span className="-ml-8 flex-grow text-center text-xl">
+                Sign up with Google
+              </span>
+            </div>
+          </button>
+          <div className="mb-6 flex w-96 items-center">
+            <hr className="flex-grow border-t border-gray-300" />
+            <span className="mx-4 text-xl">or</span>
+            <hr className="flex-grow border-t border-gray-300" />
+          </div>
+          <Link href="/signupwithemail" legacyBehavior>
+            <a
+              className={`flex h-16 w-96 items-center justify-center rounded px-6 py-4 text-xl ${
+                isDark
+                  ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
+                  : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
+              }`}
+            >
+              Sign up with Email
+            </a>
+          </Link>
+        </div>
+      </div>
+    </div>
+  );
+};
+
+export default SignUp;
diff --git a/pages/signupwithemail.tsx b/pages/signupwithemail.tsx
new file mode 100644
index 0000000..806eac2
--- /dev/null
+++ b/pages/signupwithemail.tsx
@@ -0,0 +1,145 @@
+import React, { useState } from 'react';
+import { createUserWithEmailAndPassword, updateProfile } from 'firebase/auth';
+import { toast } from 'react-hot-toast';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import Nav from '../components/Nav';
+import { auth } from '../config/firebase';
+import { useTheme } from '../contexts/ThemeContext';
+
+const SignUpWithEmail: React.FC = () => {
+  const { isDark, toggleDarkMode } = useTheme();
+  const [firstName, setFirstName] = useState('');
+  const [lastName, setLastName] = useState('');
+  const [email, setEmail] = useState('');
+  const [password, setPassword] = useState('');
+  const router = useRouter();
+
+  const handleSignUp = async () => {
+    // Basic validation
+    if (!firstName || !lastName || !email || !password) {
+      toast.error('Please fill in all fields');
+      return;
+    }
+
+    const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+    if (!emailPattern.test(email)) {
+      toast.error('Please enter a valid email address');
+      return;
+    }
+
+    if (password.length < 6) {
+      toast.error('Password must be at least 6 characters');
+      return;
+    }
+
+    try {
+      const userCredential = await createUserWithEmailAndPassword(
+        auth,
+        email,
+        password,
+      );
+      const user = userCredential.user;
+      await updateProfile(user, {
+        displayName: `${firstName} ${lastName}`,
+      });
+      toast.success('Your account has been successfully created!', {
+        style: {
+          fontSize: '14px',
+        },
+      });
+      router.push('/login');
+    } catch (error) {
+      const errorMessage = error instanceof Error ? error.message : 'Error signing up.';
+      toast.error(errorMessage);
+    }
+  };
+
+  return (
+    <div
+      className={`min-h-screen ${
+        isDark ? 'bg-[#000000] text-[#FFFFFF]' : 'bg-[#FFFFFF] text-[#000000]'
+      }`}
+    >
+      <div className="pt-4">
+        <Nav
+          isDark={isDark}
+          toggleDarkMode={toggleDarkMode}
+          showAuthButtons={false}
+        />
+      </div>
+      <div className="mt-24 flex flex-col items-center justify-center py-2">
+        <h1 className="mb-4 text-3xl font-bold">Sign Up</h1>
+        <h2 className="font mb-4 text-2xl">
+          Already a member?{' '}
+          <Link
+            href="/login"
+            className={`hover:underline ${
+              isDark ? 'text-white' : 'text-black'
+            }`}
+          >
+            Log In
+          </Link>
+        </h2>
+        <div className="flex w-full max-w-md flex-col space-y-4">
+          <input
+            type="text"
+            placeholder="First Name"
+            value={firstName}
+            onChange={(e) => setFirstName(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          <input
+            type="text"
+            placeholder="Last Name"
+            value={lastName}
+            onChange={(e) => setLastName(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          <input
+            type="email"
+            placeholder="Email"
+            value={email}
+            onChange={(e) => setEmail(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          <input
+            type="password"
+            placeholder="Password"
+            value={password}
+            onChange={(e) => setPassword(e.target.value)}
+            className={`rounded border px-4 py-2 ${
+              isDark
+                ? 'border-gray-700 bg-gray-800 text-white'
+                : 'border-gray-300 bg-white text-black'
+            }`}
+          />
+          <button
+            onClick={handleSignUp}
+            className={`rounded px-4 py-2 ${
+              isDark
+                ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
+                : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
+            }`}
+          >
+            Sign Up
+          </button>
+        </div>
+      </div>
+    </div>
+  );
+};
+
+export default SignUpWithEmail;
diff --git a/public/google.svg b/public/google.svg
new file mode 100644
index 0000000..93f9a56
--- /dev/null
+++ b/public/google.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Copyright (c) 2016 Google Inc. All rights reserved. -->
+<svg width="118px" height="120px" viewBox="0 0 118 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 3.6 (26304) - http://www.bohemiancoding.com/sketch -->
+    <title>google_buttn</title>
+    <desc>Created with Sketch.</desc>
+    <defs></defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="Artboard-1" transform="translate(-332.000000, -639.000000)">
+            <g id="google_buttn" transform="translate(332.000000, 639.000000)">
+                <g id="logo_googleg_48dp">
+                    <path d="M117.6,61.3636364 C117.6,57.1090909 117.218182,53.0181818 116.509091,49.0909091 L60,49.0909091 L60,72.3 L92.2909091,72.3 C90.9,79.8 86.6727273,86.1545455 80.3181818,90.4090909 L80.3181818,105.463636 L99.7090909,105.463636 C111.054545,95.0181818 117.6,79.6363636 117.6,61.3636364 L117.6,61.3636364 Z" id="Shape" fill="#4285F4"></path>
+                    <path d="M60,120 C76.2,120 89.7818182,114.627273 99.7090909,105.463636 L80.3181818,90.4090909 C74.9454545,94.0090909 68.0727273,96.1363636 60,96.1363636 C44.3727273,96.1363636 31.1454545,85.5818182 26.4272727,71.4 L6.38181818,71.4 L6.38181818,86.9454545 C16.2545455,106.554545 36.5454545,120 60,120 L60,120 Z" id="Shape" fill="#34A853"></path>
+                    <path d="M26.4272727,71.4 C25.2272727,67.8 24.5454545,63.9545455 24.5454545,60 C24.5454545,56.0454545 25.2272727,52.2 26.4272727,48.6 L26.4272727,33.0545455 L6.38181818,33.0545455 C2.31818182,41.1545455 0,50.3181818 0,60 C0,69.6818182 2.31818182,78.8454545 6.38181818,86.9454545 L26.4272727,71.4 L26.4272727,71.4 Z" id="Shape" fill="#FBBC05"></path>
+                    <path d="M60,23.8636364 C68.8090909,23.8636364 76.7181818,26.8909091 82.9363636,32.8363636 L100.145455,15.6272727 C89.7545455,5.94545455 76.1727273,0 60,0 C36.5454545,0 16.2545455,13.4454545 6.38181818,33.0545455 L26.4272727,48.6 C31.1454545,34.4181818 44.3727273,23.8636364 60,23.8636364 L60,23.8636364 Z" id="Shape" fill="#EA4335"></path>
+                    <path d="M0,0 L120,0 L120,120 L0,120 L0,0 Z" id="Shape"></path>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 5**

<details>
<summary>🧹 Nitpick comments (14)</summary><blockquote>

<details>
<summary>contexts/AuthContext.tsx (1)</summary><blockquote>

`8-10`: **Consider implementing the commented signUpWithEmail method**

The commented-out `signUpWithEmail` method in the interface is incomplete. Either implement this functionality or remove the commented code to avoid confusion.

```diff
- // signUpWithEmail: (email: string, password: string) => Promise<void>;
+ signUpWithEmail: (email: string, password: string) => Promise<void>;
```

</blockquote></details>
<details>
<summary>pages/login.tsx (3)</summary><blockquote>

`10-14`: **Consider adding form validation**

The login form lacks input validation for email and password fields. Consider adding validation to ensure email format is correct and password meets minimum requirements.

```diff
 const Login: React.FC = () => {
   const { isDark, toggleDarkMode } = useTheme();
   const [email, setEmail] = useState('');
   const [password, setPassword] = useState('');
+  const [errors, setErrors] = useState({ email: '', password: '' });
   const router = useRouter();
```

---

`28-40`: **Add loading state indication**

The login form doesn't show a loading state during authentication, which might lead to multiple submission attempts from users. Consider adding a loading state.

```diff
 const Login: React.FC = () => {
   const { isDark, toggleDarkMode } = useTheme();
   const [email, setEmail] = useState('');
   const [password, setPassword] = useState('');
+  const [isLoading, setIsLoading] = useState(false);
   const router = useRouter();

   const handleLogin = async () => {
+    setIsLoading(true);
     try {
       await signInWithEmailAndPassword(auth, email, password);
       toast.success('Successfully logged in !', {
         duration: 2000, // Show for 2 seconds
       });
       router.push('/');
     } catch (error) {
       toast.error('Error logging in.');
+    } finally {
+      setIsLoading(false);
     }
   };

   // Then update the button to show loading state:
   // <button disabled={isLoading}>
   //   {isLoading ? 'Logging in...' : 'Log In'}
   // </button>
```

---

`66-75`: **Add keyboard accessibility to login form**

The login form should support form submission via the Enter key. Consider wrapping the inputs in a form element with an onSubmit handler.

```diff
- <button
-   onClick={handleLogin}
-   className={`rounded px-4 py-2 ${
-     isDark
-       ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
-       : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
-   }`}
- >
-   Log In
- </button>
+ <form onSubmit={(e) => { e.preventDefault(); handleLogin(); }}>
+   {/* Move the inputs inside the form */}
+   <button
+     type="submit"
+     disabled={isLoading}
+     className={`rounded px-4 py-2 ${
+       isDark
+         ? 'bg-[#FFFFFF] text-[#000000] hover:bg-[#E0E0E0]'
+         : 'bg-[#000000] text-[#FFFFFF] hover:bg-[#333333]'
+     }`}
+   >
+     {isLoading ? 'Logging in...' : 'Log In'}
+   </button>
+ </form>
```

</blockquote></details>
<details>
<summary>contexts/ThemeContext.tsx (2)</summary><blockquote>

`10-18`: **Consider using the stored value for initial state.**

Instead of initializing with `false` and then immediately updating with useEffect, consider initializing with the stored value directly:

```diff
- const [isDark, setIsDark] = useState(false);
+ const [isDark, setIsDark] = useState(() => 
+   typeof window !== 'undefined' && localStorage.getItem('unelTheme') === 'true'
+ );
```

This would prevent a potential flash of incorrect theme during initial render.

---

`20-25`: **Consider more consistent localStorage value handling.**

Using `JSON.stringify` for booleans is fine, but for consistency you should use `JSON.parse` when reading the value:

```diff
- const savedDarkMode = localStorage.getItem('unelTheme') === 'true';
+ const savedDarkMode = JSON.parse(localStorage.getItem('unelTheme') || 'false');
```

This makes the read/write operations more symmetrical.

</blockquote></details>
<details>
<summary>pages/signup.tsx (2)</summary><blockquote>

`1-9`: **Unused import in the file.**

The `useState` import isn't being used in this component.


```diff
-import React, { useState } from 'react';
+import React from 'react';
```

---

`14-24`: **Good error handling but logging could be improved.**

The Google sign-in function has good error handling but consider showing an error toast to the user instead of just logging to console:

```diff
catch (error) {
  console.error('Error signing in with Google:', error);
+ toast.error('Failed to sign in with Google. Please try again.');
}
```

</blockquote></details>
<details>
<summary>pages/signupwithemail.tsx (3)</summary><blockquote>

`10-14`: **Unused interface definition.**

The `SignUpProps` interface is defined but never used in the component. Either remove it or update the component to use it.

```diff
-interface SignUpProps {
-  isDark: boolean;
-  toggleDarkMode: (isDark: boolean) => void;
-}
```

---

`41-42`: **Improve error message with specifics.**

The error handling could be more informative by displaying the specific error message from Firebase:

```diff
} catch (error) {
-  toast.error('Error signing up.');
+  const errorMessage = error instanceof Error ? error.message : 'Error signing up.';
+  toast.error(errorMessage);
}
```

---

`126-128`: **Remove commented-out code.**

There's commented-out code that should be either implemented or removed for cleaner code.

```diff
-  {/* <Link href="/" className={`hover:underline ${isDark ? 'text-white' : 'text-black'}`}>
-    Back to Home
-  </Link> */}
```

</blockquote></details>
<details>
<summary>components/Nav.tsx (3)</summary><blockquote>

`1-1`: **Remove unused import `MouseEventHandler`.**

The `MouseEventHandler` import is no longer used after changing the `toggleDarkMode` type from `MouseEventHandler<HTMLButtonElement>` to `() => void`.

```diff
-import React, { useState, useEffect, MouseEventHandler } from 'react';
+import React, { useState, useEffect } from 'react';
```

---

`18-20`: **Consider providing visual feedback during sign-in delay.**

The 1.5-second timeout before calling the success handler might create a perceived lag for users. Consider adding a visual loading indicator during this period to improve user experience.

---

`105-105`: **Remove empty span element.**

There's an empty span that doesn't contain any content. Consider removing it to clean up the DOM.

```diff
-                  <span className={isDark ? 'text-white' : 'text-black'}></span>
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between f3b6283ecb008f51b2e373d6a30992bd56f8c549 and 61fda3ff557bc5bbd7d95e2bc3c432509caedab7.

</details>

<details>
<summary>📒 Files selected for processing (9)</summary>

* `components/Nav.tsx` (2 hunks)
* `components/RestrictedModelModal.tsx` (3 hunks)
* `contexts/AuthContext.tsx` (2 hunks)
* `contexts/ThemeContext.tsx` (1 hunks)
* `pages/_app.tsx` (1 hunks)
* `pages/index.tsx` (3 hunks)
* `pages/login.tsx` (1 hunks)
* `pages/signup.tsx` (1 hunks)
* `pages/signupwithemail.tsx` (1 hunks)

</details>

<details>
<summary>🔇 Additional comments (19)</summary><blockquote>

<details>
<summary>contexts/AuthContext.tsx (2)</summary>

`3-3`: **Expanded auth imports look good**

The additional Firebase auth imports provide the necessary functions for implementing email and Google authentication.

---

`70-71`: **Context provider value updated correctly**

The AuthContext.Provider value has been updated to include the new authentication methods.

</details>
<details>
<summary>pages/_app.tsx (2)</summary>

`2-4`: **Clean import updates**

The import statements have been properly updated to include ThemeProvider and simplify the AppProps type.

---

`7-15`: **Good implementation of ThemeProvider**

The ThemeProvider has been correctly implemented to wrap the application, allowing for global theme state management. This is a good architectural improvement that will make theme management more consistent throughout the application.

</details>
<details>
<summary>pages/index.tsx (4)</summary>

`22-22`: **Good import of useTheme hook**

The useTheme hook is properly imported from the ThemeContext.

---

`59-59`: **Proper implementation of theme context**

The local state for theme management has been successfully migrated to use the global theme context, which is a better approach for maintaining consistency across the application.

---

`394-394`: **Minor UI adjustment**

The margin-top adjustments for different viewport sizes look good.

---

`356-368`: **Nav component correctly uses theme context**

The Nav component has been updated to use the theme context for managing the dark mode, which is consistent with the architectural changes.

</details>
<details>
<summary>pages/login.tsx (1)</summary>

`1-9`: **Good imports for login functionality**

The necessary imports for Firebase authentication, routing, and toast notifications are present.

</details>
<details>
<summary>contexts/ThemeContext.tsx (2)</summary>

`1-9`: **Well-structured theme context setup.**

Good job creating a well-typed ThemeContext with a clear interface that includes both state and the toggle function.

---

`34-40`: **Good error handling in the useTheme hook.**

The error message is helpful for developers who might accidentally use the hook outside of a ThemeProvider.

</details>
<details>
<summary>pages/signup.tsx (2)</summary>

`75-79`: **Good use of dividers for visual separation.**

The divider implementation with "or" text in the middle is well-structured and visually clear.

---

`62-73`: <details>
<summary>❓ Verification inconclusive</summary>

**Consider using local image assets for the Google logo.**

Using an external URL for the Google logo creates a dependency on an external service. Consider storing this image locally in your project:

```diff
<Image
- src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg"
+ src="/images/google-logo.svg"
  alt="Google logo"
  width={36}
  height={36}
  className="mr-3 h-9 w-9"
/>
```

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if there's already a local Google logo in the project
fd -t f -e svg -e png -e jpg "google" public
```

Length of output: 44

---



</details>

**Action Required: Verify and Add a Local Google Logo Asset**

The suggestion to replace the external Google logo URL with a local asset is still valid. However, our automated search in the `public` folder didn’t return any matching files, so it appears that no local copy of the image exists at the expected path. Please manually verify if the project already contains a local Google logo asset (perhaps under a different directory or file name) or add the asset in the `public/images` folder. Once confirmed, update the code as follows:

- Replace the external URL:
  ```diff
  <Image
  - src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg"
  + src="/images/google-logo.svg"
    alt="Google logo"
    width={36}
    height={36}
    className="mr-3 h-9 w-9"
  />
  ```

**Next Steps:**
- Confirm that a local image file (e.g., `public/images/google-logo.svg`) exists.
- If it does not exist, add the asset to the project.
- Update the component as shown above to eliminate the external dependency.

</details>
<details>
<summary>components/RestrictedModelModal.tsx (3)</summary>

`22-24`: **Good implementation of the signup redirect.**

The handler function is concise and correctly uses Next.js router to navigate to the signup page.

---

`28-38`: **Improved UI messaging for model limitations.**

The updated messaging clearly communicates the model limitations and the options available to the user. The styling is consistent with the overall application design.

---

`39-53`: **Good button layout with clear visual hierarchy.**

The button layout with Sign Up as the primary action (blue) and Switch Model as the secondary action (gray) creates a clear visual hierarchy for users.

</details>
<details>
<summary>components/Nav.tsx (3)</summary>

`8-12`: **Interface rename improves type clarity.**

Good job renaming the interface from `themeBtn` to `NavProps` which better reflects its purpose. The simplified type for `toggleDarkMode` and addition of the optional `showAuthButtons` property improve the component's flexibility.

---

`46-48`: **Good simplification of the dark mode toggle handler.**

The direct call to `toggleDarkMode` simplifies the code and removes unnecessary indirection, which is a good refactoring decision.

---

`81-119`: **Well-structured conditional rendering for authentication UI.**

The conditional rendering of authentication buttons based on user state is well-implemented. This approach provides a clear separation between authenticated and unauthenticated states.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-03-10T08:46:56Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (10)</summary><blockquote>

<details>
<summary>pages/login.tsx (3)</summary><blockquote>

`18-21`: **Consider a more robust email validation approach.**  
The current regex under “validateEmail” may reject valid addresses or allow invalid ones since email validation is more complex than simple regexes.  
  
You could consider using a well-tested library or more advanced regex patterns:

```diff
- const validateEmail = (email: string) => {
-   const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
-   return re.test(String(email).toLowerCase());
- };
+ import isEmail from 'validator/lib/isEmail';
+ const validateEmail = (email: string) => {
+   return isEmail(email);
+ };
```

---

`40-47`: **Improve error handling with specific Firebase errors.**  
Currently, any error while calling `signInWithEmail` defaults to a generic “Invalid email or password.” Providing more specific feedback based on Firebase error codes (e.g., `auth/user-not-found`, `auth/wrong-password`) can help users troubleshoot login issues more easily.  
  
```diff
try {
  await signInWithEmail(email, password);
  toast.success('Successfully logged in!', {
    duration: 2000,
  });
  router.push('/');
} catch (error) {
-  toast.error('Invalid email or password. Please try again.');
+  if (error instanceof Error) {
+    if (error.message.includes('auth/user-not-found')) {
+      toast.error('User not found. Please check your email or sign up.');
+    } else if (error.message.includes('auth/wrong-password')) {
+      toast.error('Incorrect password. Please try again or reset your password.');
+    } else {
+      toast.error('Error logging in: ' + error.message);
+    }
+  } else {
+    toast.error('An unknown error occurred. Please try again.');
+  }
}
```

---

`89-92`: **Offer a “Show Password” toggle for better UX.**  
Providing a show/hide password option can enhance user experience and reduce password entry errors.  

```diff
<input
  type={showPassword ? 'text' : 'password'}
  placeholder="Password"
  value={password}
  onChange={(e) => setPassword(e.target.value)}
  ...
/>

+ <div className="mt-2">
+   <label className="inline-flex items-center">
+     <input
+       type="checkbox"
+       checked={showPassword}
+       onChange={() => setShowPassword(!showPassword)}
+     />
+     <span className="ml-2">Show Password</span>
+   </label>
+ </div>
```

</blockquote></details>
<details>
<summary>contexts/ThemeContext.tsx (1)</summary><blockquote>

`15-24`: **Consider a class-based approach to theming.**  
Applying color changes using a class on the `<html>` or `<body>` node (e.g., `"dark"` vs. `"light"`) can simplify styling changes across the app and avoid inline style manipulation.  

```diff
- document.body.style.backgroundColor = newIsDark ? '#131416' : '#fff';
+ const body = document.body;
+ if (newIsDark) {
+   body.classList.add('dark');
+   body.classList.remove('light');
+ } else {
+   body.classList.add('light');
+   body.classList.remove('dark');
+ }
```

</blockquote></details>
<details>
<summary>pages/signup.tsx (2)</summary><blockquote>

`11-20`: **Show user-facing feedback if Google Sign-In fails.**  
Currently, the error is only logged to the console. Presenting a toast or error message would help users understand why Google sign-in failed.  

```diff
} catch (error) {
  console.error('Error signing in with Google:', error);
+ toast.error('Google sign-in failed, please try again or use email sign-up.');
  return null;
}
```

---

`27-37`: **Handle null returns from signInWithGoogle.**  
If `signInWithGoogle` returns `null`, it indicates the sign-in process failed. Notifying the user ensures they’re aware that authentication didn’t proceed.  

```diff
if (user) {
  toast.success('Successfully signed in using Google !', {
    duration: 2000,
  });
  router.push('/');
} 
+ else {
+   toast.error('Failed to sign in with Google, please try again.');
+ }
```

</blockquote></details>
<details>
<summary>contexts/AuthContext.tsx (1)</summary><blockquote>

`18-19`: **Consider throwing an error if these are called outside the provider.**
When the context is not yet provided, these defaults do nothing. Throwing an error can help catch unintended usage.



```diff
-  signInWithEmail: async () => {},
-  signInWithGoogle: async () => {},
+  signInWithEmail: async () => {
+    throw new Error("AuthContext not provided: signInWithEmail not implemented");
+  },
+  signInWithGoogle: async () => {
+    throw new Error("AuthContext not provided: signInWithGoogle not implemented");
+  },
```

</blockquote></details>
<details>
<summary>pages/signupwithemail.tsx (3)</summary><blockquote>

`1-9`: **Potential user state check before displaying a sign-up form.**
If the user is already logged in, you might consider redirecting them rather than showing the sign-up page again. This helps avoid confusion.


```diff
+ // Redirect if user is already logged in
+ useEffect(() => {
+   if (auth.currentUser) {
+     router.push('/');
+   }
+ }, [router]);
```

---

`18-56`: **Surfacing specialized Firebase errors can improve user experience.**
For known Firebase errors (e.g., 'auth/email-already-in-use'), you could display a more specific message than the generic error.



```diff
catch (error) {
  if (error instanceof FirebaseError) {
+   if (error.code === 'auth/email-already-in-use') {
+     toast.error('This email address is already in use');
+   } else {
+     toast.error(error.message);
+   }
  } else {
    toast.error('Error signing up.');
  }
}
```

---

`58-145`: **Overall UI and form structure is sound.**
Consider using a form library (e.g., React Hook Form) to handle validation and form state more systematically, especially as your codebase grows.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 61fda3ff557bc5bbd7d95e2bc3c432509caedab7 and b3ad87f832cdb8995ad68aeba3508cd0b2dc81e9.

</details>

<details>
<summary>⛔ Files ignored due to path filters (1)</summary>

* `public/google.svg` is excluded by `!**/*.svg`

</details>

<details>
<summary>📒 Files selected for processing (6)</summary>

* `components/Nav.tsx` (2 hunks)
* `contexts/AuthContext.tsx` (2 hunks)
* `contexts/ThemeContext.tsx` (1 hunks)
* `pages/login.tsx` (1 hunks)
* `pages/signup.tsx` (1 hunks)
* `pages/signupwithemail.tsx` (1 hunks)

</details>

<details>
<summary>🔇 Additional comments (18)</summary><blockquote>

<details>
<summary>pages/login.tsx (1)</summary>

`1-130`: **Overall, the login flow looks solid!**  
The component is well-structured, uses context-based authentication correctly, and includes local validation to assist users.

</details>
<details>
<summary>contexts/ThemeContext.tsx (1)</summary>

`10-39`: **ThemeProvider implementation looks clean!**  
Storing and restoring theme preference from localStorage is a good practice to maintain user preference.

</details>
<details>
<summary>pages/signup.tsx (1)</summary>

`1-111`: **Sign-up flow is well-structured and user-friendly!**  
The integration of Google sign-in, dark mode support, and fallback sign-up with email is neat and straightforward.

</details>
<details>
<summary>contexts/AuthContext.tsx (6)</summary>

`3-3`: **Good import usage for Firebase authentication.**
No issues found here. This import ensures the necessary Firebase methods are available for both email and Google sign-in flows.

---

`8-9`: **Great addition of new sign-in methods in the Auth context.**
Declaring these async functions in the interface allows the rest of the app to cleanly utilize email and Google authentication flows.

---

`27-34`: **Re-throwing errors for email sign-in is a good design choice.**
Forwarding errors to the caller avoids swallowing exceptions and enables the UI to handle them gracefully.

---

`36-44`: **Re-throwing errors for Google sign-in is consistent with best practices.**
This facilitates unified error handling patterns across the application.

---

`51-51`: **Uniform error re-throw for sign-out.**
Consistent error handling ensures that sign-out failures can also be caught at the caller level.

---

`65-65`: **Cleanly providing the new auth methods.**
Adding `signInWithEmail` and `signInWithGoogle` to the context value is well-organized and improves discoverability for consumers of this context.

</details>
<details>
<summary>pages/signupwithemail.tsx (1)</summary>

`10-16`: **State initialization looks good.**
No issues found; these initial states for sign-up data and theme usage are straightforward and maintainable.

</details>
<details>
<summary>components/Nav.tsx (8)</summary>

`1-1`: **React import is correct.**
No concerns; this line is properly importing React at the file's top.

---

`6-9`: **Refined `NavProps` interface.**
Introducing `showAuthButtons?: boolean` provides greater control over the component’s layout. Changing `toggleDarkMode` to a no-arg function is a tidy change.

---

`12-16`: **Props destructuring is straightforward.**
Defaulting `showAuthButtons` to `true` is a clear approach that enhances flexibility.

---

`27-29`: **Direct toggle call for dark mode.**
Eliminating unnecessary parameters clarifies the intention behind the toggle.

---

`32-36`: **Dark/light styling updated.**
Good usage of dynamic tailwind classes to handle theme changes consistently.

---

`45-57`: **Well-positioned link and theme button.**
Providing an external link back to U16P and placing the theme toggle near it is logical for the user interface.

---

`103-103`: **Exporting Nav component.**
No issues found; default export keeps usage consistent across the codebase.

---

`58-95`: <details>
<summary>❓ Verification inconclusive</summary>

**Verify link routing logic for sign-up flow.**
This navigates to `/signup`, while the PR also includes a new `/signupwithemail` page. Confirm that this is the intended route or if it should point to the new sign-up page.

---

🏁 Script executed:

```shell
#!/bin/bash
# Searching references to ensure only one consistent signup route is used.
rg -A 5 "href=\"/signup\""
rg -A 5 "href=\"/signupwithemail\""
```

Length of output: 1208

---



</details>

**Confirm the Intended Sign-Up Route**

In the navigation component (components/Nav.tsx, lines 58–95) the sign-up link points to `/signup`, while the new sign-up page uses `/signupwithemail` (as seen in pages/signup.tsx). Please verify whether this discrepancy is intentional or if the link in Nav (and possibly in pages/login.tsx) should be updated to point to `/signupwithemail` to ensure a consistent sign-up flow.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-03-10T11:19:08Z
user: login: amitkalwar
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-12T09:23:24Z

Review comments:
diff_hunk: @@ -1,23 +1,54 @@
 import { createContext, useContext, useEffect, useState } from 'react';
 import { auth } from '../config/firebase';
-import { User, signOut as firebaseSignOut } from 'firebase/auth';
-
+import { User, signOut as firebaseSignOut, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider } from 'firebase/auth';
+ 
 export interface AuthContextType {
   user: User | null;
   loading: boolean;
+  // signUpWithEmail: (email: string, password: string) => Promise<void>;
+  signInWithEmail: (email: string, password: string) => Promise<void>;
+  signInWithGoogle: () => Promise<void>;
   signOut: () => Promise<void>;
 }
 
 const AuthContext = createContext<AuthContextType>({
   user: null,
   loading: true,
+  // signUpWithEmail: async () => {},
+  signInWithEmail: async () => {},
+  signInWithGoogle: async () => {},
   signOut: async () => {},
 });
 
 export function AuthProvider({ children }: { children: React.ReactNode }) {
   const [user, setUser] = useState<User | null>(null);
   const [loading, setLoading] = useState(true);
-
+ 
+  // const signUpWithEmail = async (email: string, password: string) => {
+  //   try {
+  //     await createUserWithEmailAndPassword(auth, email, password);
+  //   } catch (error) {
+  //     console.error('Error signing up with email:', error);
+  //   }
+  // };
+ 
+  const signInWithEmail = async (email: string, password: string) => {
+    try {
+      await signInWithEmailAndPassword(auth, email, password);
+    } catch (error) {
+      console.error('Error signing in with email:', error);
+    }
+  };
+ 
+  const signInWithGoogle = async () => {
+    try {
+      const provider = new GoogleAuthProvider();
+      await signInWithPopup(auth, provider);
+    } catch (error) {
+      console.error('Error signing in with Google:', error);
+    }
+  };
path: contexts/AuthContext.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Improve error handling in signInWithGoogle**

Similar to the email sign-in method, consider re-throwing errors to allow consuming components to handle them appropriately.

```diff
 const signInWithGoogle = async () => {
   try {
     const provider = new GoogleAuthProvider();
     await signInWithPopup(auth, provider);
   } catch (error) {
     console.error('Error signing in with Google:', error);
+    throw error; // Re-throw to allow components to handle the error
   }
 };
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const signInWithGoogle = async () => {
    try {
      const provider = new GoogleAuthProvider();
      await signInWithPopup(auth, provider);
    } catch (error) {
      console.error('Error signing in with Google:', error);
      throw error; // Re-throw to allow components to handle the error
    }
  };
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-10T08:46:55Z
author_association: NONE
diff_hunk: @@ -1,23 +1,54 @@
 import { createContext, useContext, useEffect, useState } from 'react';
 import { auth } from '../config/firebase';
-import { User, signOut as firebaseSignOut } from 'firebase/auth';
-
+import { User, signOut as firebaseSignOut, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider } from 'firebase/auth';
+ 
 export interface AuthContextType {
   user: User | null;
   loading: boolean;
+  // signUpWithEmail: (email: string, password: string) => Promise<void>;
+  signInWithEmail: (email: string, password: string) => Promise<void>;
+  signInWithGoogle: () => Promise<void>;
   signOut: () => Promise<void>;
 }
 
 const AuthContext = createContext<AuthContextType>({
   user: null,
   loading: true,
+  // signUpWithEmail: async () => {},
+  signInWithEmail: async () => {},
+  signInWithGoogle: async () => {},
   signOut: async () => {},
 });
 
 export function AuthProvider({ children }: { children: React.ReactNode }) {
   const [user, setUser] = useState<User | null>(null);
   const [loading, setLoading] = useState(true);
-
+ 
+  // const signUpWithEmail = async (email: string, password: string) => {
+  //   try {
+  //     await createUserWithEmailAndPassword(auth, email, password);
+  //   } catch (error) {
+  //     console.error('Error signing up with email:', error);
+  //   }
+  // };
+ 
+  const signInWithEmail = async (email: string, password: string) => {
+    try {
+      await signInWithEmailAndPassword(auth, email, password);
+    } catch (error) {
+      console.error('Error signing in with email:', error);
+    }
+  };
path: contexts/AuthContext.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Improve error handling in signInWithEmail**

The current implementation only logs errors to the console. Consider throwing or returning the error to allow consuming components to handle errors appropriately and display user-friendly messages.

```diff
 const signInWithEmail = async (email: string, password: string) => {
   try {
     await signInWithEmailAndPassword(auth, email, password);
   } catch (error) {
     console.error('Error signing in with email:', error);
+    throw error; // Re-throw to allow components to handle the error
   }
 };
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const signInWithEmail = async (email: string, password: string) => {
    try {
      await signInWithEmailAndPassword(auth, email, password);
    } catch (error) {
      console.error('Error signing in with email:', error);
      throw error; // Re-throw to allow components to handle the error
    }
  };
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-10T08:46:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,93 @@
+import React, { useState } from 'react';
+import { signInWithEmailAndPassword } from 'firebase/auth';
+import { toast } from 'react-hot-toast';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import Nav from '../components/Nav';
+import { auth } from '../config/firebase';
+import { useTheme } from '../contexts/ThemeContext';
+
+const Login: React.FC = () => {
+  const { isDark, toggleDarkMode } = useTheme();
+  const [email, setEmail] = useState('');
+  const [password, setPassword] = useState('');
+  const router = useRouter();
+
+  const handleLogin = async () => {
+    try {
+      await signInWithEmailAndPassword(auth, email, password);
+      toast.success('Successfully logged in !', {
+        duration: 2000, // Show for 2 seconds
+      });
+      router.push('/');
+    } catch (error) {
+      toast.error('Error logging in.');
+    }
+  };
path: pages/login.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Direct Firebase auth call instead of using context**

The login component directly calls Firebase authentication instead of using the `signInWithEmail` method from the AuthContext. Consider using the context method for consistency.

```diff
- import { signInWithEmailAndPassword } from 'firebase/auth';
- import { auth } from '../config/firebase';
+ import { useAuth } from '../contexts/AuthContext';

 const Login: React.FC = () => {
   const { isDark, toggleDarkMode } = useTheme();
+  const { signInWithEmail } = useAuth();
   const [email, setEmail] = useState('');
   const [password, setPassword] = useState('');
   const router = useRouter();

   const handleLogin = async () => {
     try {
-      await signInWithEmailAndPassword(auth, email, password);
+      await signInWithEmail(email, password);
       toast.success('Successfully logged in !', {
         duration: 2000, // Show for 2 seconds
       });
       router.push('/');
     } catch (error) {
-      toast.error('Error logging in.');
+      toast.error('Error logging in: ' + (error instanceof Error ? error.message : 'Unknown error'));
     }
   };
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
import { useAuth } from '../contexts/AuthContext';
import { useTheme } from '../contexts/ThemeContext'; // unchanged context import (if applicable)
// Removed: import { signInWithEmailAndPassword } from 'firebase/auth';
// Removed: import { auth } from '../config/firebase';
import { useState } from 'react';
import { useRouter } from 'next/router';
import toast from 'react-hot-toast'; // assuming toast is imported

const Login: React.FC = () => {
  const { isDark, toggleDarkMode } = useTheme();
  const { signInWithEmail } = useAuth();
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');
  const router = useRouter();

  const handleLogin = async () => {
    try {
      await signInWithEmail(email, password);
      toast.success('Successfully logged in !', {
        duration: 2000, // Show for 2 seconds
      });
      router.push('/');
    } catch (error) {
      toast.error('Error logging in: ' + (error instanceof Error ? error.message : 'Unknown error'));
    }
  };

  return (
    <div>
      {/* The rest of your login form JSX */}
      <form onSubmit={(e) => { e.preventDefault(); handleLogin(); }}>
        <input 
          type="email"
          value={email}
          onChange={(e) => setEmail(e.target.value)}
          placeholder="Email"
        />
        <input 
          type="password"
          value={password}
          onChange={(e) => setPassword(e.target.value)}
          placeholder="Password"
        />
        <button type="submit">Login</button>
      </form>
    </div>
  );
};

export default Login;
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-10T08:46:56Z
author_association: NONE
diff_hunk: @@ -0,0 +1,135 @@
+import React, { useState } from 'react';
+import { createUserWithEmailAndPassword, updateProfile } from 'firebase/auth';
+import { toast } from 'react-hot-toast';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import Nav from '../components/Nav';
+import { auth } from '../config/firebase';
+import { useTheme } from '../contexts/ThemeContext';
+
+interface SignUpProps {
+  isDark: boolean;
+  toggleDarkMode: (isDark: boolean) => void;
+}
+
+const SignUpWithEmail: React.FC = () => {
+  const { isDark, toggleDarkMode } = useTheme();
+  const [firstName, setFirstName] = useState('');
+  const [lastName, setLastName] = useState('');
+  const [email, setEmail] = useState('');
+  const [password, setPassword] = useState('');
+  const router = useRouter();
+
+  const handleSignUp = async () => {
+    try {
+      const userCredential = await createUserWithEmailAndPassword(
+        auth,
+        email,
+        password,
+      );
+      const user = userCredential.user;
+      await updateProfile(user, {
+        displayName: `${firstName} ${lastName}`,
+      });
+      toast.success('Your account has been successfully created!', {
+        style: {
+          fontSize: '14px',
+        },
+      });
+      router.push('/login');
+    } catch (error) {
+      toast.error('Error signing up.');
+    }
+  };
path: pages/signupwithemail.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Add form validation before submission.**

The form doesn't validate input fields before attempting to create a user account. Consider adding basic validation:

```diff
const handleSignUp = async () => {
+  // Basic validation
+  if (!firstName || !lastName || !email || !password) {
+    toast.error('Please fill in all fields');
+    return;
+  }
+  
+  if (password.length < 6) {
+    toast.error('Password must be at least 6 characters');
+    return;
+  }

  try {
    // Rest of the function
```



<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const handleSignUp = async () => {
    // Basic validation
    if (!firstName || !lastName || !email || !password) {
      toast.error('Please fill in all fields');
      return;
    }
    
    if (password.length < 6) {
      toast.error('Password must be at least 6 characters');
      return;
    }
    
    try {
      const userCredential = await createUserWithEmailAndPassword(
        auth,
        email,
        password,
      );
      const user = userCredential.user;
      await updateProfile(user, {
        displayName: `${firstName} ${lastName}`,
      });
      toast.success('Your account has been successfully created!', {
        style: {
          fontSize: '14px',
        },
      });
      router.push('/login');
    } catch (error) {
      toast.error('Error signing up.');
    }
  };
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-10T08:46:56Z
author_association: NONE
diff_hunk: @@ -1,37 +1,39 @@
-import React, { MouseEventHandler } from 'react';
+import React, { useState, useEffect, MouseEventHandler } from 'react';
 import ThemeButton from './ThemeButton';
 import { useAuth } from '../contexts/AuthContext';
 import Link from 'next/link';
 import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
-import Image from 'next/image';
 import { auth } from '../config/firebase';
-import { toast } from 'react-toastify';
 
-interface themeBtn {
+interface NavProps {
   isDark: boolean;
-  toggleDarkMode: MouseEventHandler<HTMLButtonElement>;
-  handleSignInSuccess?: () => void;
+  toggleDarkMode: () => void; // Changed this type
+  showAuthButtons?: boolean;
 }
 
 export const signInWithGoogle = async (handleSignInSuccess?: () => void) => {
   try {
     const provider = new GoogleAuthProvider();
     const result = await signInWithPopup(auth, provider);
-    if (result.user) {
-      toast.success('Successfully signed in using google!\nYou now have unlimited access.', {
-        autoClose: 2000 // Show for 2 seconds
-      });
-      if (handleSignInSuccess) {
-        setTimeout(handleSignInSuccess, 1500); // Call handler after 1.5 seconds
-      }
+    if (result.user && handleSignInSuccess) {
+      setTimeout(handleSignInSuccess, 1500); // Call handler after 1.5 seconds
     }
   } catch (error) {
     console.error('Error signing in with Google:', error);
   }
 };
 
-const Nav: React.FC<themeBtn> = ({isDark, toggleDarkMode, handleSignInSuccess}) => {
+const Nav: React.FC<NavProps> = ({
+  isDark,
+  toggleDarkMode,
+  showAuthButtons = true,
+}) => {
   const { user, signOut } = useAuth();
+  const [isLoading, setIsLoading] = useState(true);
+
+  useEffect(() => {
+    setIsLoading(false);
+  }, []);
path: components/Nav.tsx
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Verify if the loading state is necessary.**

The loading state is set to false immediately after mounting without any conditional or async operation. If there's no asynchronous initialization happening, this pattern may be unnecessary. Consider removing it if it doesn't serve a specific purpose.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if there are any async operations in the component initialization
# that would justify the loading state

# Look for async operations in useEffect hooks around this component
rg -A 10 "useEffect\(\(\) => \{" --glob "components/Nav.tsx"
```

Length of output: 479

---



</details>

**Action Required: Remove Unnecessary Loading State**

It appears that the `isLoading` state in `components/Nav.tsx` is initialized to `true` and then immediately set to `false` on mount, without being used to manage any asynchronous initialization. Although there is an asynchronous function (`handleSignOut`), it doesn’t interact with this loading state. To simplify the component, please remove the unused `isLoading` state and the corresponding `useEffect`.

- **Location:** `components/Nav.tsx`, Lines 32-36  
- **Action:** Remove the initialization (`const [isLoading, setIsLoading] = useState(true);`) and the immediate state update within `useEffect`.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-10T08:46:56Z
author_association: NONE

PR comments:
user: login: vercel[bot]
created_at: 2025-03-10T08:42:08Z
body: [vc]: #yocpXXhHtZY25XTsoZUThztp/DotR0MJBUpBvWLYHEs=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ1bmVsbWEtY29kZS10cmFuc2xhdGUiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoidW5lbG1hLWNvZGUtdHJhbnNsYXRlLWdpdC1zaWduLXVwLTIyMmE2ZS11bmVsbWEtcGxhdGZvcm1zLXRlYW0udmVyY2VsLmFwcCJ9LCJpbnNwZWN0b3JVcmwiOiJodHRwczovL3ZlcmNlbC5jb20vdW5lbG1hLXBsYXRmb3Jtcy10ZWFtL3VuZWxtYS1jb2RlLXRyYW5zbGF0ZS8zVmlxMnJYUEtoYUoyTDlpVFFkRFFFTjlmR2c4IiwicHJldmlld1VybCI6InVuZWxtYS1jb2RlLXRyYW5zbGF0ZS1naXQtc2lnbi11cC0yMjJhNmUtdW5lbG1hLXBsYXRmb3Jtcy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJyb290RGlyZWN0b3J5IjpudWxsfV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **unelma-code-translate** | ✅ Ready ([Inspect](https://vercel.com/unelma-platforms-team/unelma-code-translate/3Viq2rXPKhaJ2L9iTQdDQEN9fGg8)) | [Visit Preview](https://unelma-code-translate-git-sign-up-222a6e-unelma-platforms-team.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/unelma-code-translate-git-sign-up-222a6e-unelma-platforms-team.vercel.app?via=pr-comment-feedback-link) | Mar 10, 2025 11:15am |


author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-03-10T08:42:13Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
This pull request refactors the navigation component and restricted model modal to update their interfaces and rendering logic. It extends the authentication context with new Firebase email and Google sign-in methods while introducing a dedicated theme context for dark/light mode management. The main app and home page have been updated to leverage the ThemeProvider instead of local state, and several new pages for login and sign-up (both with Google and email) have been created, all incorporating error handling, conditional UI rendering, and responsive styling.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `comp.../Nav.tsx` | Renamed interface to `NavProps`; updated `toggleDarkMode` signature; added optional `showAuthButtons` prop; removed toast notification from sign-in; introduced loading state and conditional auth button rendering. |
| `comp.../RestrictedModelModal.tsx` | Removed `signInWithGoogle` import and `handleSignInSuccess`; added `handleSignUpClick` for navigation; updated modal title, messaging, and buttons layout to shift from sign-in to sign-up focus. |
| `cont.../AuthContext.tsx` | Expanded Firebase imports; added `signInWithEmail` and `signInWithGoogle` methods to the `AuthContextType` and provider; removed the commented-out `signUpWithEmail`. |
| `cont.../ThemeContext.tsx` | New file implementing theme management via a `ThemeProvider` and `useTheme` hook; manages dark/light mode state with localStorage and updates document background accordingly. |
| `pages/_app.tsx, pages/index.tsx` | Removed Nav component and Inter font; integrated `ThemeProvider` in `_app.tsx`; refactored `index.tsx` to use theme context instead of local state for background styling. |
| `pages/login.tsx, pages/signup.tsx, pages/signupwithemail.tsx` | Introduced new authentication pages: a Login page for email/password sign-in; a SignUp page for Google and email sign-up; and a SignUpWithEmail page using Firebase’s account creation with profile updates. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant U as User
    participant LE as Login Component
    participant AC as AuthContext
    participant FA as Firebase Auth
    U->>LE: Enters email & password, clicks login
    LE->>AC: Calls signInWithEmail(email, password)
    AC->>FA: Request: signInWithEmailAndPassword(email, password)
    FA-->>AC: Return success or error
    AC-->>LE: Return response
    alt Successful Login
        LE->>U: Display success toast & navigate home
    else Login Failed
        LE->>U: Display error toast
    end
```

```mermaid
sequenceDiagram
    participant U as User
    participant SU as SignUp Component
    participant AC as AuthContext
    participant FP as Firebase Popup Auth
    U->>SU: Clicks "Sign Up with Google" button
    SU->>AC: Calls signInWithGoogle()
    AC->>FP: Initiates Google sign-in popup
    FP-->>AC: Returns user data or error
    AC-->>SU: Returns response
    alt Successful SignUp
        SU->>U: Display success toast & navigate home
    else SignUp Failed
        SU->>U: Log and display error
    end
```

## Poem
> I'm a bouncy rabbit with code so neat,  
> Hop through changes with agile little feet.  
> Dark mode and auth now dance in bright light,  
> With sign-up and login soaring to new heights.  
> In this garden of updates, I cheer and repeat! 🐰✨

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEg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NtQD5L3CUICpNyHRApFBCDuHsA+vQGO5jQdxU0fEJJFJ5Fi6g2tESUqRVJVkNSWpU7tdybI4S5IqdQOiA0VJcw8BSQnwDUOLrA5KAGTI8EPUibn4+AsKPwOYit4ahqc3LGxD9T1JhCQUuNKXkvXImkAvUMebDnUKyHCc7+iwgyTTQ5ER1I6X5XFOUJ8r2oU8PPaoafTIlq9G6fk0FH2PAFfpTIAUx6CuGnKz1KUIwvkBOO3yF8Ee7JOcRAITArimp8EycF6nkm/d+w4TZkcRiejLCnUg9D8SWnpCboH8BJWbgiME7yBYR0QFEXbRxjojw+ngJOMCw6iS0/sSgLuA0jmGoBCRTeDqAnkjyXEqItHTqF9hprkFe6q9dIaeEGLxtn6Cw9RhD3AGoBsGowOoRfzCDYNXGsxXMTZ0FGj8Hi4/DYs51WL0sEqkoufscXqiL9AGK/ERpRntFaTXwyojRq/2+gnC1Rj/N+B/H7hjQh4h8b/gdjPgDAL4aAK+MaIqYrwVAT8DeK/EMDbxLQfeSyH0EQCWQlEIwb4rQEsiuRscPcAwEzIABscwQYD8HoLYQrgAAdgEAMALgqgWgFLNoAABOC4CQDOCyz6CDAL/PQUuAAAGZWZiDoAqApZDMwWX3AaD0E1gMwKWYMBmC6yGAtAAQDMGVmqy1gQsmYGgHEH0ELgesmYI7L1kCAzgtABgPMBIDKyzZ5siAMzPUCszmyHM35E0joCWQB4DMoAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=unelmacoin/unelma-code-translate&utm_content=81):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE