diff --git a/app/account/account-form.tsx b/app/account/account-form.tsx index edac0d3..0c5b787 100644 --- a/app/account/account-form.tsx +++ b/app/account/account-form.tsx @@ -80,27 +80,14 @@ export default function AccountForm({ user, message }: { user: User | null; mess -
-
- - Update Profile - -
-
-
- -
-
+
+ + Update Profile +
diff --git a/app/layout.tsx b/app/layout.tsx index f2e1dc1..8f2f79c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -27,7 +27,7 @@ export default function RootLayout({ return ( - + diff --git a/app/login/actions.tsx b/app/login/actions.tsx index e689f47..c463bcf 100644 --- a/app/login/actions.tsx +++ b/app/login/actions.tsx @@ -14,19 +14,19 @@ export async function login(formData: FormData) { // Validate input if (!email || !password) { const params = new URLSearchParams({ message: 'Please fill in all fields' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/login?${params.toString()}`) } if (!email.includes('@')) { const params = new URLSearchParams({ message: 'Please enter a valid email address' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/login?${params.toString()}`) } if (password.length < 8) { const params = new URLSearchParams({ message: 'Password must be at least 8 characters long' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/login?${params.toString()}`) } @@ -59,7 +59,7 @@ export async function login(formData: FormData) { } catch (error) { console.error('Login error:', error) const params = new URLSearchParams() - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) if (error instanceof ClientResponseError) { if (error.status === 400) { @@ -85,31 +85,31 @@ export async function signup(formData: FormData) { // Validate input if (!email || !password || !passwordConfirm || !name) { const params = new URLSearchParams({ message: 'Please fill in all fields' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/signup?${params.toString()}`) } if (!email.includes('@')) { const params = new URLSearchParams({ message: 'Please enter a valid email address' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/signup?${params.toString()}`) } if (password.length < 8) { const params = new URLSearchParams({ message: 'Password must be at least 8 characters long' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/signup?${params.toString()}`) } if (password !== passwordConfirm) { const params = new URLSearchParams({ message: 'Passwords do not match' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/signup?${params.toString()}`) } if (name.trim().length < 2) { const params = new URLSearchParams({ message: 'Name must be at least 2 characters long' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) return redirect(`/signup?${params.toString()}`) } @@ -122,14 +122,13 @@ export async function signup(formData: FormData) { passwordConfirm: passwordConfirm, name: name.trim(), } - try { const record = await pb.collection('users').create(data) await pb.collection('users').requestVerification(email) } catch (error) { console.error('Signup error:', error) const params = new URLSearchParams() - if (redirectTo !== '/account') params.set('redirect', redirectTo) + if (redirectTo && redirectTo !== '/account') params.set('redirect', redirectTo) if (error instanceof ClientResponseError) { const errorData = error.response?.data @@ -149,9 +148,11 @@ export async function signup(formData: FormData) { params.set('message', 'Failed to create account. Please try again.') return redirect(`/signup?${params.toString()}`) } - // Automatically log the user in after successful signup try { + // Small delay to ensure user record is fully created + await new Promise(resolve => setTimeout(resolve, 100)) + const authData = await pb.collection('users').authWithPassword(email, password) const cookieStore = await cookies() @@ -171,13 +172,28 @@ export async function signup(formData: FormData) { }) revalidatePath('/', 'layout') - redirect(redirectTo) + + // Try to add success message to destination URL if possible + try { + const url = new URL(redirectTo, 'https://example.com') // Use dummy base for relative URLs + url.searchParams.set('message', 'Account created successfully! Welcome to the platform.') + redirect(url.pathname + url.search) + } catch { + // If URL manipulation fails, just redirect to the destination + redirect(redirectTo) + } } catch (error) { - // If auto-login fails, redirect to login page with success message + // If auto-login fails, still redirect to original destination but with a success message revalidatePath('/', 'layout') - const params = new URLSearchParams({ message: 'Account created successfully! Please log in to access the platform.' }) - if (redirectTo !== '/account') params.set('redirect', redirectTo) - redirect(`/login?${params.toString()}`) + // Try to add success message to destination URL if possible + try { + const url = new URL(redirectTo, 'https://example.com') // Use dummy base for relative URLs + url.searchParams.set('message', 'Account created successfully! You have been logged in.') + redirect(url.pathname + url.search) + } catch { + // If URL manipulation fails, just redirect to the destination + redirect(redirectTo) + } } } diff --git a/app/mht-cet-login-required/page.tsx b/app/mht-cet-login-required/page.tsx index ce53f2d..4b5aebe 100644 --- a/app/mht-cet-login-required/page.tsx +++ b/app/mht-cet-login-required/page.tsx @@ -2,9 +2,12 @@ import Link from "next/link"; import Image from "next/image"; import { Button } from "@/components/ui/button"; -export default function MHTCETLoginRequired({ searchParams }: { +export default async function MHTCETLoginRequired({ searchParams }: { searchParams: Promise<{ redirect?: string }> }) { + const params = await searchParams + const redirectTo = params?.redirect || '/mht-cet' + return (
@@ -34,7 +37,7 @@ export default function MHTCETLoginRequired({ searchParams }: {
-
- {/* Stats */} - {totalItems > 0 && ( -
-

Total Records

-

{totalItems.toLocaleString()}

-
- )} - {/* Export Button */} - -
{/* Filters */} @@ -1169,7 +1151,7 @@ export default function StateCutoffsPage() {
{ const value = e.target.value; @@ -1187,7 +1169,6 @@ export default function StateCutoffsPage() {
-

Enter Target Percentile

+

Enter Your MHT-CET Percentile

Please enter a target percentile above to search for MHT-CET cutoffs

@@ -1887,151 +1868,266 @@ export default function StateCutoffsPage() { {/* Informational Cards - Improved Design & UX */} -
- {/* How to Use This Tool */} + {/* How to Use This Tool - always on top, full width */} +
- -
- + +
+
How to Use This Tool
- -
    -
  1. - 1 - - Enter Your Percentile - Type your MHT-CET percentile to see colleges in a -10% range. - -
  2. -
  3. - 2 - - Filter Your Preferences - Select categories, courses, and seat types to narrow down results. - -
  4. -
  5. - 3 - - Analyze & Strategize - Results are sorted by highest cutoff. Use this to plan your CAP round choices. - -
  6. -
-
- - + +
+ {/* Step 1 */} +
+
+ 1 +
+

Enter Your MHT-CET Percentile

+

+ Type your percentile score (e.g., 95.5) in the box above.
+ The tool will show all colleges where the cutoff is less than or equal to your percentile.
(Range: 0% up to your target percentile)
+

+
+ {/* Step 2 */} +
+
+ 2 +
+

Filter Your Preferences

+

+ Use the filters to select categories, courses, seat types, and university regions.
+ This helps you narrow down the results to match your eligibility and interests. +

+
+ {/* Step 3 */} +
+
+ 3 +
+

Analyze & Plan

+

+ Results are sorted by highest cutoff first.
+ Use this to plan your CAP round choices and maximize your admission chances. +

+
+
+
+ + - - Pro Tip: Enter your percentile to see all colleges where you have a chance of admission (from 0% to your target percentile). Results show the distance from your target. + + Tip: Enter your percentile to see all colleges where you have a chance of admission (from 0% up to your target percentile).
+ This tool uses official DTE Maharashtra cutoff data for accuracy.
+ Always double-check with the latest official DTE Maharashtra sources and college websites for the most current and authoritative information. We do not guarantee admission or take responsibility for any decisions made using this tool.
+
- {/* Seat Allocation Types */} - -
- - -
- + {/* Seat Allocation Types and Category & Code Legends side by side */} +
+ {/* Seat Allocation Types - left */} + +
+ + +
+
- Seat Allocation Types + Seat Allocation Types (Explained)
- -
- -
- State Level - Open to all Maharashtra candidates. + +
+ {/* State Level */} +
+ +
+
State Level (S)
+
+ Who can apply?
+ All students from Maharashtra, regardless of their home university region. +
+
+ Example: If you are from any part of Maharashtra, you can compete for these seats. +
+
-
-
- -
- Home University - For students within the same university region. + + {/* Home University */} +
+ +
+
Home University (H)
+
+ Who can apply?
+ Only students whose Home University matches the college's university region. +
+
+ What is Home University?
+ The university region where you completed your 12th standard (HSC) or equivalent. Each district in Maharashtra is mapped to a university region. +
+
+ Example: If you studied in Pune district, your Home University is "Savitribai Phule Pune University". You can apply for Home University seats in colleges under this university. +
+
-
-
- -
- Other University - For students from different university regions. + + {/* Other University */} +
+ +
+
Other University (O)
+
+ Who can apply?
+ Students from other university regions (not the college's Home University region). +
+
+ Example: If your Home University is "Mumbai University" and you are applying to a college under "Pune University", you are eligible for Other University seats there. +
+
+
+ + {/* Visual Table for Quick Reference */} +
+
+ + Quick Reference Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
TypeCodeWho Can Apply?
State LevelSAll Maharashtra students
Home UniversityHStudents from the same university region
Other UniversityOStudents from other university regions
+
+
+ Tip: If you are unsure about your Home University, check your 12th (HSC) board details or ask your school/college. +
-
-
- Tip: Hover on seat types in the table for more info.
- {/* Category and Code Legends */} - -
- - -
- + {/* Category and Code Legends - right */} + +
+ + +
+
- Category & Code Legends + Category & Code Legends
- - - -
- - Category Code Format -
-
- -
-

G = General, L = Ladies

-

H = Home Uni, O = Other Uni, S = State

-

Example: GOPENH is General Open Home University.

-
-
-
- - -
- - Special Category Codes -
-
- -
-

TFWS: Tuition Fee Waiver Scheme

-

EWS: Economically Weaker Section

-

DEF: Defence Reserved

-

PWD: Persons with Disability

-

MI: Minority Institutions

-
-
-
- - -
- - Video Explanation +
+ {/* Category Code Format */} +
+
+ + Category Code Format +
+
    +
  • +
    +
    G = General (open to all)
    +
    L = Ladies (female candidates only)
    +
    SC = Scheduled Caste, ST = Scheduled Tribe, OBC = Other Backward Class, EWS = Economically Weaker Section
    +
    +
  • +
  • +
    +
    OPEN = Open to all within that category
    +
    SC/ST/OBC/EWS = Reserved for specific categories
    +
    +
  • +
  • +
    +
    H = Home University (your university region)
    +
    O = Other University (other regions)
    +
    S = State Level (all Maharashtra students)
    +
    +
  • +
  • +
    +
    Example 1: GOPENH = General, Open seat, Home University
    +
    Example 2: LOPENO = Ladies, Open seat, Other University
    +
    +
  • +
+
+ How to read a code: Most codes are a combination of: +
    +
  • First part: G = General, L = Ladies, SC = Scheduled Caste, ST = Scheduled Tribe, OBC = Other Backward Class, EWS = Economically Weaker Section, etc.
  • +
  • OPEN: Open to all within that category (not a reserved sub-quota). Other codes like OBC, SC, etc. indicate reservation for that group.
  • +
  • H/O/S: H = Home University, O = Other University, S = State Level. This is always at the end of the code.
  • +
+
+ Full Example: + GOPENO = General, Open seat, Other University.
+ LOPENS = Ladies, Open seat, State Level.
- - -
-