From 84e7e25526b00f96a3162850ef32eaed21d13e4b Mon Sep 17 00:00:00 2001 From: Pranjali Bhardwaj Date: Wed, 3 Dec 2025 15:15:05 +0530 Subject: [PATCH 1/3] imporved slider Signed-off-by: Pranjali Bhardwaj --- Backend/app/db/db.py | 2 +- Frontend/src/components/ui/slider.tsx | 39 ++++++++++++++++----------- Frontend/src/pages/Sponsorships.tsx | 28 ++++++++++++++++--- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Backend/app/db/db.py b/Backend/app/db/db.py index ae0f517..bb2b402 100644 --- a/Backend/app/db/db.py +++ b/Backend/app/db/db.py @@ -37,4 +37,4 @@ async def get_db(): async with AsyncSessionLocal() as session: - yield session + yield session \ No newline at end of file diff --git a/Frontend/src/components/ui/slider.tsx b/Frontend/src/components/ui/slider.tsx index 3b528d2..2da4d62 100644 --- a/Frontend/src/components/ui/slider.tsx +++ b/Frontend/src/components/ui/slider.tsx @@ -5,20 +5,29 @@ import { cn } from "../../lib/utils"; const Slider = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - - - -)); +>(({ className, ...props }, ref) => { + const thumbCount = + Array.isArray(props.value ?? props.defaultValue) + ? (props.value ?? props.defaultValue ?? []).length || 1 + : 1 + + return ( + + + + + {Array.from({ length: thumbCount }).map((_, index) => ( + + ))} + + ) +}) export { Slider }; diff --git a/Frontend/src/pages/Sponsorships.tsx b/Frontend/src/pages/Sponsorships.tsx index 67e813e..70659f6 100644 --- a/Frontend/src/pages/Sponsorships.tsx +++ b/Frontend/src/pages/Sponsorships.tsx @@ -24,6 +24,15 @@ import { Label } from "../components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../components/ui/select" export default function SponsorshipsPage() { + const [budgetRange, setBudgetRange] = React.useState<[number, number]>([1000, 10000]) + + const formatCurrency = (value: number) => + value.toLocaleString("en-US", { + style: "currency", + currency: "USD", + maximumFractionDigits: 0, + }) + return (
@@ -123,11 +132,22 @@ export default function SponsorshipsPage() {
- + setBudgetRange(value as [number, number])} + aria-label="Budget range" + /> +
+
+ {formatCurrency(budgetRange[0])} + {formatCurrency(budgetRange[1])}
-
- $1,000 - $10,000 +
+ Potential payout window: {formatCurrency(budgetRange[0])} - {formatCurrency(budgetRange[1])} ( + {formatCurrency(Math.max(budgetRange[1] - budgetRange[0], 0))} spread)
From 90763520b0481bf261f0e1ee4bbb0213e88deb80 Mon Sep 17 00:00:00 2001 From: Pranjali Bhardwaj Date: Wed, 3 Dec 2025 17:20:06 +0530 Subject: [PATCH 2/3] making signup n signin easier Signed-off-by: Pranjali Bhardwaj --- Frontend/src/pages/Signup.tsx | 43 +++++++++++++++++++---------- Frontend/src/pages/Sponsorships.tsx | 28 +++---------------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/Frontend/src/pages/Signup.tsx b/Frontend/src/pages/Signup.tsx index 0055239..805bb9b 100644 --- a/Frontend/src/pages/Signup.tsx +++ b/Frontend/src/pages/Signup.tsx @@ -17,6 +17,7 @@ export default function SignupPage() { const [showPassword, setShowPassword] = useState(false); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(""); + const [successMessage, setSuccessMessage] = useState(""); const [step, setStep] = useState(1); const [user, setuser] = useState("influencer"); const { login } = useAuth(); @@ -39,28 +40,20 @@ export default function SignupPage() { } setIsLoading(true); setError(""); + setSuccessMessage(""); try { const { name, email, password } = formData; - - // Check if user already exists - const { data: existingUser } = await supabase.auth.signInWithPassword({ - email, - password: "dummy-password-to-check-existence", - }); - - if (existingUser.user) { - setError("An account with this email already exists. Please sign in instead."); - setIsLoading(false); - return; - } - + const { data, error } = await supabase.auth.signUp({ email, password, options: { data: { name } }, }); if (error) { - if (error.message.includes("already registered")) { + if ( + error.message.toLowerCase().includes("already registered") || + error.message.toLowerCase().includes("user already exists") + ) { setError("An account with this email already exists. Please sign in instead."); } else { setError(error.message); @@ -68,8 +61,21 @@ export default function SignupPage() { setIsLoading(false); return; } + + // Supabase quirk: if the user already exists (especially with email confirmations enabled), + // signUp can succeed but return a user with no identities. + const identities = (data.user as any)?.identities ?? []; + const isExistingUserWithoutNewIdentity = Array.isArray(identities) && identities.length === 0; + + if (isExistingUserWithoutNewIdentity) { + setError("An account with this email already exists. Please sign in instead."); + } else { + // Truly new account – show verification email message + setSuccessMessage( + "Verification link sent. Please check your email to verify your account before signing in." + ); + } setIsLoading(false); - // AuthContext will handle navigation based on user onboarding status and role } catch (err) { setError("Something went wrong. Please try again."); } finally { @@ -161,6 +167,13 @@ export default function SignupPage() {
)} + {successMessage && ( +
+ + {successMessage} +
+ )} +
diff --git a/Frontend/src/pages/Sponsorships.tsx b/Frontend/src/pages/Sponsorships.tsx index 70659f6..67e813e 100644 --- a/Frontend/src/pages/Sponsorships.tsx +++ b/Frontend/src/pages/Sponsorships.tsx @@ -24,15 +24,6 @@ import { Label } from "../components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../components/ui/select" export default function SponsorshipsPage() { - const [budgetRange, setBudgetRange] = React.useState<[number, number]>([1000, 10000]) - - const formatCurrency = (value: number) => - value.toLocaleString("en-US", { - style: "currency", - currency: "USD", - maximumFractionDigits: 0, - }) - return (
@@ -132,22 +123,11 @@ export default function SponsorshipsPage() {
- setBudgetRange(value as [number, number])} - aria-label="Budget range" - /> -
-
- {formatCurrency(budgetRange[0])} - {formatCurrency(budgetRange[1])} +
-
- Potential payout window: {formatCurrency(budgetRange[0])} - {formatCurrency(budgetRange[1])} ( - {formatCurrency(Math.max(budgetRange[1] - budgetRange[0], 0))} spread) +
+ $1,000 + $10,000
From 0aab1612e81bc56f2d7c4f549b02986ba7f31715 Mon Sep 17 00:00:00 2001 From: Pranjali Bhardwaj <146981751+PranjaliBhardwaj@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:35:29 +0530 Subject: [PATCH 3/3] Refactor Slider component to simplify rendering fixed my pr --- Frontend/src/components/ui/slider.tsx | 39 +++++++++++---------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/Frontend/src/components/ui/slider.tsx b/Frontend/src/components/ui/slider.tsx index 2da4d62..3b528d2 100644 --- a/Frontend/src/components/ui/slider.tsx +++ b/Frontend/src/components/ui/slider.tsx @@ -5,29 +5,20 @@ import { cn } from "../../lib/utils"; const Slider = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const thumbCount = - Array.isArray(props.value ?? props.defaultValue) - ? (props.value ?? props.defaultValue ?? []).length || 1 - : 1 - - return ( - - - - - {Array.from({ length: thumbCount }).map((_, index) => ( - - ))} - - ) -}) +>(({ className, ...props }, ref) => ( + + + + + + +)); export { Slider };