Fix CRI-17: wire handleSubmitEntry to entry form, remove dead state + unused prop

WaterFieldClient.tsx:
- Wrap entry-form section in <form onSubmit={handleSubmitEntry}>
  (handler was defined but never bound to a form or button — submit
  button did nothing). Submit button already had type="submit".
- Remove unused selectedRole state + its two setSelectedRole calls
  (state was set at role-selection but never read).

wholesale/login/page.tsx:
- Remove unused 'name' prop from BrandLogo (was passed in but
  never referenced inside the component).

Fixes CRI-17.
This commit is contained in:
2026-06-03 02:13:44 +00:00
parent 1fe5ffee8d
commit f155bf6f5c
2 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ const BRANDS = [
{ id: "64294306-5f42-463d-a5e8-2ad6c81a96de", name: "Tuxedo Corn", slug: "tuxedo" },
];
function BrandLogo({ name }: { name: string }) {
function BrandLogo() {
return (
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-emerald-900/60 border border-emerald-700/50">
<svg className="h-5 w-5 text-emerald-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.5}>
@@ -119,7 +119,7 @@ export default function WholesaleLoginPage() {
<div className="bg-zinc-900 border-b border-zinc-800">
<div className="mx-auto max-w-5xl px-6 py-4 flex items-center justify-between">
<div className="flex items-center gap-3">
<BrandLogo name={selectedBrand.name} />
<BrandLogo />
<div>
<p className="font-bold text-base text-zinc-100 leading-none">{selectedBrand.name}</p>
<p className="text-xs text-zinc-500 mt-0.5">Wholesale Portal</p>
+7 -5
View File
@@ -133,7 +133,6 @@ function WaterFieldInner() {
});
const [pin, setPin] = useState("");
const [irrigatorName, setIrrigatorName] = useState("");
const [selectedRole, setSelectedRole] = useState<"irrigator" | "water_admin" | null>(null);
const [headgates, setHeadgates] = useState<Headgate[]>([]);
const [selectedHeadgate, setSelectedHeadgate] = useState("");
const [headgateLocked, setHeadgateLocked] = useState(false);
@@ -396,13 +395,13 @@ function WaterFieldInner() {
<p className="text-stone-500 text-center mb-8">{t.whoAreYou}</p>
<div className="flex flex-col gap-4">
<button
onClick={() => { setSelectedRole("irrigator"); setStep("pin"); }}
onClick={() => { setStep("pin"); }}
className="w-full rounded-xl bg-white px-6 py-5 text-xl font-semibold text-stone-900 shadow-sm ring-1 ring-stone-200 hover:bg-stone-50 min-h-[64px]"
>
Irrigator
</button>
<button
onClick={() => { setSelectedRole("water_admin"); setStep("pin"); }}
onClick={() => { setStep("pin"); }}
className="w-full rounded-xl bg-stone-900 px-6 py-5 text-xl font-semibold text-white shadow-sm ring-1 ring-stone-700 hover:bg-stone-800 min-h-[64px]"
>
Admin
@@ -496,7 +495,10 @@ function WaterFieldInner() {
</div>
</div>
<div className="mx-auto max-w-lg px-4 py-6 space-y-5">
<form
onSubmit={handleSubmitEntry}
className="mx-auto max-w-lg px-4 py-6 space-y-5"
>
{/* Success banner */}
{success && (
<div className="rounded-xl bg-green-100 border border-green-200 px-4 py-4 text-center text-green-800 font-semibold">
@@ -688,7 +690,7 @@ function WaterFieldInner() {
{loading && (
<p className="text-center text-xs text-stone-400 mt-1">Submitting your reading...</p>
)}
</div>
</form>
</div>
);
}