sarlink-portal/components/auth/login-form.tsx
i701 9021f01ff4 Add Agreements page, enhance Devices and Users components with sorting and filtering options, and implement user verification dialogs
- Introduced a new Agreements page for managing agreements in the dashboard.
- Enhanced the Devices page by adding sorting and filtering options for better device management.
- Updated the Users page to include sorting functionality and improved layout.
- Implemented user verification and rejection dialogs for better user management.
- Added InputReadOnly component for displaying user information in a read-only format.
- Refactored search component to improve usability and visual consistency.
2024-12-01 23:19:31 +05:00

53 lines
1.3 KiB
TypeScript

"use client";
import { Button } from "@/components/ui/button";
import { signin } from "@/actions/auth-actions";
import { Loader2 } from "lucide-react";
import { useActionState } from "react";
import { PhoneInput } from "../ui/phone-input";
export default function LoginForm() {
const [state, formAction, isPending] = useActionState(signin, {
message: "",
status: "",
});
return (
<form
className="bg-white overflow-clip dark:bg-transparent dark:border-2 w-full max-w-xs mx-auto rounded-lg shadow mt-4"
action={formAction}
>
<div className="py-4 px-4">
<div className="grid gap-4">
<PhoneInput
id="phone-number"
name="phoneNumber"
maxLength={8}
disabled={isPending}
placeholder="Enter phone number"
defaultCountry="MV"
/>
{state.status === "error" && (
<p className="text-red-500 text-sm">{state.message}</p>
)}
<Button
className=""
disabled={isPending}
type="submit"
>
{isPending ? <Loader2 className="animate-spin" /> : "Request OTP"}
</Button>
</div>
{/* <div className="mt-2 text-center text-sm">
Don&apos;t have an account?{" "}
<Link href="signup" className="underline">
Sign up
</Link>
</div> */}
</div>
</form>
);
}