feat: simplify phone-first authentication flow

This commit is contained in:
2026-09-28 22:06:42 +03:30
parent 4c969a7c9f
commit b7d5f7bc65
12 changed files with 150 additions and 401 deletions

View File

@@ -20,8 +20,7 @@ const isProfileOrAuthPath = (pathname: string) =>
pathname === "/profile" ||
pathname.startsWith("/profile/") ||
pathname === "/auth" ||
pathname.startsWith("/auth/") ||
pathname.startsWith("/reset-password");
pathname.startsWith("/auth/");
export default function MobileBottomNav({ siteContent }: { siteContent: SiteContent }) {
const pathname = usePathname() || "/";

View File

@@ -3,7 +3,7 @@
import type { ReactNode } from "react";
import { useMemo } from "react";
import Image from "next/image";
import { LayoutDashboard, LogOut, RotateCcw, UserRound } from "lucide-react";
import { LayoutDashboard, LogOut, UserRound } from "lucide-react";
import { Link, NavLink } from "@/lib/router";
import { useAuth } from "@/contexts/AuthContext";
import ModeToggle from "@/components/ModeToggle";
@@ -91,12 +91,6 @@ function ProfileAvatarMenu() {
<UserRound className="h-4 w-4" />
</Link>
</DropdownMenuItem>
<DropdownMenuItem asChild className="flex-row-reverse justify-end gap-2 rounded-xl">
<Link to="/reset-password">
تغییر یا بازیابی رمز
<RotateCcw className="h-4 w-4" />
</Link>
</DropdownMenuItem>
{isAdminUser ? (
<DropdownMenuItem asChild className="flex-row-reverse justify-end gap-2 rounded-xl">
<Link to="/admin">

View File

@@ -9,6 +9,7 @@ type OtpCodeFieldProps = {
disabled?: boolean;
length?: number;
className?: string;
ariaLabel?: string;
};
export default function OtpCodeField({
@@ -17,6 +18,7 @@ export default function OtpCodeField({
disabled = false,
length = 5,
className,
ariaLabel = "کد تایید پیامکی",
}: OtpCodeFieldProps) {
return (
<InputOTP
@@ -26,6 +28,7 @@ export default function OtpCodeField({
onChange={(nextValue) => onChange(nextValue.replace(/[^\d]/g, ""))}
disabled={disabled}
inputMode="numeric"
aria-label={ariaLabel}
containerClassName={cn("w-full justify-center", className)}
>
<InputOTPGroup dir="ltr" className="justify-center">

View File

@@ -11,9 +11,9 @@ const buttonVariants = cva(
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
outline: "border border-input bg-background text-foreground hover:bg-secondary hover:text-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/75 hover:text-foreground",
ghost: "hover:bg-secondary hover:text-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {

View File

@@ -35,7 +35,7 @@ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
const NavigationMenuItem = NavigationMenuPrimitive.Item;
const navigationMenuTriggerStyle = cva(
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-secondary hover:text-foreground focus:bg-secondary focus:text-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-secondary/70 data-[state=open]:bg-secondary/70",
);
const NavigationMenuTrigger = React.forwardRef<

View File

@@ -10,7 +10,7 @@ const toggleVariants = cva(
variants: {
variant: {
default: "bg-transparent",
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
outline: "border border-input bg-transparent hover:bg-secondary hover:text-foreground",
},
size: {
default: "h-10 px-3",