diff --git a/islands/dialogs/PopAddLeaseDialog.tsx b/islands/dialogs/PopAddLeaseDialog.tsx index f101c86..b2c7e17 100644 --- a/islands/dialogs/PopAddLeaseDialog.tsx +++ b/islands/dialogs/PopAddLeaseDialog.tsx @@ -1,4 +1,3 @@ -// islands/AsyncYesNoPop.ts import { useState } from "preact/hooks"; import AddLeaseDialog from "./AddLeaseDialog.tsx"; import { Lease, Property } from "../../db/interfaces.ts"; @@ -6,7 +5,7 @@ import { Lease, Property } from "../../db/interfaces.ts"; export function PopAddLeaseDialog(leases: Lease[], properties: Property[]) { const [popup, setPopup] = useState< { - propertyId: string; + propertyId: string | null; popupKey: number; resolve: (value: boolean) => void; } | null @@ -25,7 +24,7 @@ export function PopAddLeaseDialog(leases: Lease[], properties: Property[]) { // Show the popup and return a Promise for the answer const popAddLease = ( - propertyId: string, + propertyId?: string, popupKey: number, ): Promise => { return new Promise((resolve) => { @@ -36,7 +35,7 @@ export function PopAddLeaseDialog(leases: Lease[], properties: Property[]) { // Render the popup if needed const popupAddLeaseDialog = popup ? (() => { - const { title, address, price } = getPropertyInfo(popup.propertyId); + const { title, address, price } = getPropertyInfo(popup.propertyId || ""); return ( { + const [selectedPropertyId, setSelectedPropertyId] = useState(""); + + return ( +
+
+

Select Property

+ +
+ + +
+
+
+ ); + })() + : null; + + return [popAddLease, popupAddLeaseDialog || propertySelectionDialog] as const; } +