// Woodbury Operator — Properties (asset grid). Registers window.PropertiesScreen.
(function () {
const NS = window.WoodburyPropertiesDesignSystem_7290ca;
const { Card, Button, Badge, Input, ProgressBar, Modal, Select } = NS;
function PropertyCard({ p, onManage }) {
const tone = p.status === "Flagship" ? "accent" : p.status === "Premium" ? "brand" : "neutral";
return (
{p.status}
{p.name}
{p.type} · {p.units} units
Occupancy{p.occ}%
= 95 ? "success" : "brand"} />
{p.vacant ? `${p.vacant} vacant` : "Fully occupied"}
);
}
function PropertiesScreen() {
const D = window.WB_DATA;
const all = D.properties;
const [modal, setModal] = React.useState(null); // 'map' | 'add' | property
const [q, setQ] = React.useState("");
const [addUnit, setAddUnit] = React.useState(false);
const [editP, setEditP] = React.useState(false);
const [pDraft, setPDraft] = React.useState(null);
const [unitDraft, setUnitDraft] = React.useState({ label: "", status: "Vacant" });
const [, force] = React.useReducer((x) => x + 1, 0);
const close = () => setModal(null);
React.useEffect(() => { const f = window.WBFocus; if (f && f.kind === "property") { const p = all.find((x) => x.name === f.key); if (p) setModal(p); window.WBFocus = null; } }, []);
const shown = all.filter((p) => !q || (p.name + p.type).toLowerCase().includes(q.toLowerCase()));
return (
} />
{shown.length === 0 && No estates match “{q}”.
}
{/* Map view modal */}
{[
{ l: "22%", t: "30%", n: "Lashibi Townhouses" }, { l: "58%", t: "22%", n: "Cantonments City" },
{ l: "70%", t: "58%", n: "Mirage" }, { l: "34%", t: "64%", n: "Onehive Tse Addo" },
{ l: "48%", t: "44%", n: "Hamlet" },
].map((pin) => (
{pin.n}
))}
Greater Accra · schematic
{/* Add property modal */}
}>
{/* Manage property modal */}
}>
{modal && typeof modal === "object" && (
{[["Units", modal.units], ["Occupancy", modal.occ + "%"], ["Vacant", modal.vacant]].map(([k, v]) => (
))}
Units ({(window.WB_UNITS[modal.name] || []).length})
{(window.WB_UNITS[modal.name] || []).map((u) => (
{u.label}
{u.tenant &&
{u.tenant}
}
{u.status}
))}
{(window.WB_UNITS[modal.name] || []).length === 0 &&
No units listed yet.
}
)}
{/* Add unit modal */}
setAddUnit(false)} icon="door-open" title="Add Unit" subtitle={modal && typeof modal === "object" ? modal.name : ""} width={440}
footer={}>
setUnitDraft((d) => ({ ...d, label: e.target.value }))} />
{/* Edit property modal */}
setEditP(false)} icon="pencil" title="Edit Property" subtitle={pDraft && pDraft.name} width={480}
footer={}>
{pDraft && (
)}
);
}
window.PropertiesScreen = PropertiesScreen;
})();