Referral page, bug fixes, seed data, persona tiers

- New /refer page with share/copy/stats
- Fixed modal z-index conflicts (z-50 → z-[60]) across forum, groups, souq, halal-monitor
- Seed route: forum categories, marketplace listings, private groups
- Mufti/Daie personas now available in Premium tier
- Fixed referral share link: falahos.my/mobile/auth?ref=CODE
- Fixed client-side persona access check for premium
This commit is contained in:
root
2026-06-18 09:38:05 +02:00
parent b39bce91e4
commit ed34b186f9
29 changed files with 996 additions and 188 deletions
+31 -5
View File
@@ -1,8 +1,8 @@
"use client";
import { useState, FormEvent } from "react";
import { Suspense, useState, FormEvent, useEffect } from "react";
import { useAuth } from "@/lib/AuthContext";
import { useRouter } from "next/navigation";
import { useRouter, useSearchParams } from "next/navigation";
import { Mail, ArrowLeft } from "lucide-react";
type AuthMode = "login" | "register";
@@ -41,9 +41,16 @@ function GitHubLogo({ className }: { className?: string }) {
);
}
export default function AuthPage() {
const { login, register, oauthLogin, loading: authLoading } = useAuth();
function AuthPageInner() {
const { user, login, register, oauthLogin, loading: authLoading } = useAuth();
const router = useRouter();
const searchParams = useSearchParams();
const refCode = searchParams.get("ref");
// Redirect to main page if already logged in (e.g. after OAuth popup completes)
useEffect(() => {
if (user) router.push("/");
}, [user, router]);
const [pageState, setPageState] = useState<PageState>("select");
const [mode, setMode] = useState<AuthMode>("register");
@@ -90,7 +97,7 @@ export default function AuthPage() {
if (mode === "login") {
await login(email.trim(), password);
} else {
await register(email.trim(), name.trim(), password);
await register(email.trim(), name.trim(), password, refCode || undefined);
}
router.push("/");
} catch (err: unknown) {
@@ -339,6 +346,13 @@ export default function AuthPage() {
<p className="text-xs text-gray-500">
Get <span className="text-[#D4AF37] font-semibold">5,000 FLH</span>{" "}
free on sign up + 7-day premium trial
{refCode && (
<>
{" "}+{" "}
<span className="text-emerald-400 font-semibold">1,000 FLH</span>{" "}
referral bonus
</>
)}
</p>
</div>
)}
@@ -356,3 +370,15 @@ export default function AuthPage() {
</div>
);
}
export default function AuthPage() {
return (
<Suspense fallback={
<div className="min-h-dvh bg-[#0a0a0f] flex items-center justify-center">
<div className="w-8 h-8 rounded-full border-2 border-[#D4AF37]/30 border-t-[#D4AF37] animate-spin" />
</div>
}>
<AuthPageInner />
</Suspense>
);
}