/* ============================================================
WorkStay — Explore / Search (editorial, not marketplace grid)
exports: ExplorePage
============================================================ */
const { useState: useStateEx, useMemo } = React;
function PropertyRow({ p, go, wished, toggleWish, i }) {
const [hov, setHov] = useStateEx(false);
const flip = i % 2 === 1;
return (
setHov(true)} onMouseLeave={() => setHov(false)}
style={{ display: 'grid', gridTemplateColumns: flip ? '1fr 1.15fr' : '1.15fr 1fr', gap: 'clamp(28px,4vw,64px)',
alignItems: 'center', paddingBlock: 'clamp(40px,5vw,72px)', borderTop: '1px solid var(--line)' }} className="ws-prow">
{/* visual */}
{/* copy */}
{p.collection}
{p.city}, {p.country}
{p.tagline}
{p.amenities.slice(0, 4).map(a => (
{a}
))}
${p.price.toLocaleString()} / {p.period}
go('property', { id: p.id })}>View work profile
);
}
function ExplorePage({ go, params = {}, wish = [], toggleWish }) {
const { PROPERTIES, COLLECTIONS } = window.WS_DATA;
const [filter, setFilter] = useStateEx(params.collection || 'All');
const [sort, setSort] = useStateEx('work');
const wishOnly = params.wishOnly;
const filters = ['All', ...COLLECTIONS.map(c => c.title)];
const list = useMemo(() => {
let r = PROPERTIES.slice();
if (wishOnly) r = r.filter(p => wish.includes(p.id));
else if (filter !== 'All') r = r.filter(p => p.collection === filter);
if (sort === 'work') r.sort((a, b) => b.workScore - a.workScore);
if (sort === 'price') r.sort((a, b) => a.price - b.price);
if (sort === 'speed') r.sort((a, b) => b.speed - a.speed);
return r;
}, [filter, sort, wishOnly, wish]);
return (