From dce8afc9079d76314b4ac1d8df5f35e998161906 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 20 Oct 2025 16:17:26 +0000 Subject: [PATCH] basic logic for remote assessment live --- .../[slug]/remote-assessment/page.tsx | 134 +++++++++++++++++- src/middleware.ts | 3 - 2 files changed, 127 insertions(+), 10 deletions(-) diff --git a/src/app/portfolio/[slug]/remote-assessment/page.tsx b/src/app/portfolio/[slug]/remote-assessment/page.tsx index b82ec524..51276c84 100644 --- a/src/app/portfolio/[slug]/remote-assessment/page.tsx +++ b/src/app/portfolio/[slug]/remote-assessment/page.tsx @@ -1,12 +1,132 @@ +"use client"; + +import { useState } from "react"; +import { Input } from "@/app/shadcn_components/ui/input"; +import { Button } from "@/app/shadcn_components/ui/button"; +import { + Select, + SelectTrigger, + SelectContent, + SelectItem, + SelectValue, +} from "@/app/shadcn_components/ui/select"; +import { Card } from "@/app/shadcn_components/ui/card"; +import { Pencil } from "lucide-react"; // ✅ already available from lucide-react + export default function RemoteAssessmentPage() { + const [postcode, setPostcode] = useState(""); + const [isLoading, setIsLoading] = useState(false); + const [addresses, setAddresses] = useState([]); + const [selectedAddress, setSelectedAddress] = useState(null); + const [error, setError] = useState(null); + + async function handleSearch() { + setError(null); + setAddresses([]); + setSelectedAddress(null); + + if (!postcode.trim()) { + setError("Please enter a postcode"); + return; + } + + setIsLoading(true); + await new Promise((r) => setTimeout(r, 800)); // simulate delay + + const fakeResults = [ + "10 Downing Street, London, SW1A 2AA", + "11 Downing Street, London, SW1A 2AA", + "12 Downing Street, London, SW1A 2AA", + ]; + + setAddresses(fakeResults); + setIsLoading(false); + } + + function handleChangeAddress() { + setSelectedAddress(null); + } + return ( -
-

Remote Assessment

-

- Welcome to the Remote Assessment page. Here you can start your remote - assessment process. -

- {/* Additional content and components for remote assessment can be added here */} +
+ +

+ Remote Assessment +

+

+ Search for your property using its postcode to start your assessment. +

+ + {/* Step 1: Postcode input */} + {!selectedAddress && ( + <> +
+ setPostcode(e.target.value.toUpperCase())} + placeholder="Enter postcode (e.g. SW1A 2AA)" + className="text-lg" + /> + +
+ + {error &&

{error}

} + + {/* Step 2: Dropdown of addresses */} + {addresses.length > 0 && ( +
+ + +
+ )} + + )} + + {/* Step 3: Confirmation card */} + {selectedAddress && ( +
+
+

+ Selected Address +

+

{selectedAddress}

+
+ + +
+ )} +
); } diff --git a/src/middleware.ts b/src/middleware.ts index 87277110..f1f44e90 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,9 +6,6 @@ export async function middleware(req: NextRequest) { const token = await getToken({ req }); const { pathname } = req.nextUrl; - console.log("token", token); - console.log("onboarded", token?.onboarded); - // If no session, send user to sign-in page if (!token) { return NextResponse.redirect(new URL("/", req.url));