openvibers/openvibe.rent Commits

Rent home: with nothing posted yet, the largest cities' rents replace "Nobody has posted here yet" (#67)

OP OpenVibers committed 28 days ago · 8a20b04b8c · 3 files, +14 −4

Changes

ddiff --git a/server/http/pages.js b/server/http/pages.js
iindex ae08c68..1c8538a 100644
---- a/server/http/pages.js
++++ b/server/http/pages.js
@@@ -31,6 +31,7 @@ const housingHpi = require('../housing/hpi');
const everywhere = require('../aggregate/everywhere');
const { mountBoardPages } = require('./board-pages');
const { mountCityPages, listingFairLine } = require('./city-pages');
++const cityList = require('../aggregate/cities');
const SITE_NAME = 'OpenVibe.Rent';
const TAGLINE = 'Every rental site, one search.';
@@@ -183,10 +184,13 @@ ${notice(p && p.detail ? p.detail : 'You are over the limit for this.', 'warn')}
<p class="sc-lede">Public housing, tax-credit (LIHTC) and HUD-assisted properties, and the authorities and counselling agencies to apply through, from U.S. HUD open data.</p>
<p><a class="sc-btn sc-primary" href="/housing">Find housing near you</a></p></section>
--<section class="sc-sec" aria-labelledby="h-latest"><h2 id="h-latest">Posted on ${SITE_NAME}</h2>
++${latest.rows.length ? html`<section class="sc-sec" aria-labelledby="h-latest"><h2 id="h-latest">Posted on ${SITE_NAME}</h2>
<p class="sc-lede">Listings people post here themselves: apartments, rooms, houses, commercial space, parking and storage, and equipment. <a href="/listings">Browse them</a> or search them by place.</p>
--${listingList(latest.rows, { empty: 'Nobody has posted here yet: yours could be the first.' })}
--<p><a class="sc-btn" href="/listings">Every listing posted here</a> <a class="sc-btn" href="/post">Post a listing</a></p></section>
++${listingList(latest.rows, { empty: '' })}
++<p><a class="sc-btn" href="/listings">Every listing posted here</a> <a class="sc-btn" href="/post">Post a listing</a></p></section>` : html`<section class="sc-sec" aria-labelledby="h-cities"><h2 id="h-cities">What rent costs in the largest cities</h2>
++<p class="sc-lede">The typical 2-bedroom rent (Census Bureau), and every rental site's search for each city. <a href="/in">All 885 cities</a> · <a href="/fair">Check a rent</a></p>
++<ul class="ew-chips">${cityList.cities.slice().sort((a, b) => b.population - a.population).slice(0, 8).map((c) => html`<li><a href="${c.path}">${c.name} ${cityList.rentText(c.rent.b2)}</a></li>`)}</ul>
++<p class="small muted">Renting something out? <a href="/post">Post a listing</a>.</p></section>`}
${raw(showcase.features({
title: 'How it works',
ddiff --git a/test/cities.test.js b/test/cities.test.js
iindex 90de333..e0c78a9 100644
---- a/test/cities.test.js
++++ b/test/cities.test.js
@@@ -64,6 +64,12 @@ const cities = require('../server/aggregate/cities');
const t = await boot();
const kim = t.network.addUser('kim');
++ await check('with nothing posted yet, the home shows the largest cities\' rents instead of an empty list', async () => {
++ const home = await t.get('/');
++ assert.ok(home.text.includes('What rent costs in the largest cities') && home.text.includes('href="/in/ny/new-york"'));
++ assert.ok(!home.text.includes('Nobody has posted here yet'));
++ });
++
await check('a city page: typical rents with margins and the source, the fair form, every site at the city, what is here, nearby', async () => {
const r = await t.get('/in/tx/austin');
assert.strictEqual(r.status, 200);
ddiff --git a/test/perf-budget.test.js b/test/perf-budget.test.js
iindex 4ff0184..ed91476 100644
---- a/test/perf-budget.test.js
++++ b/test/perf-budget.test.js
@@@ -19,7 +19,7 @@ const { measure, check, format } = require('openvibe-shared/perf-budget');
// budget keeps the same ~10% headroom over the new measurement; the other lines are unchanged.
const BUDGETS = {
htmlRawKB: 33.5, // measured 31.0 (real glyphs for page, db, deploy and gauge icons, shared 2.21.1); was 31.5
-- htmlBrotliKB: 8.0, // 7.4 (real glyphs for page, db, deploy and gauge icons, shared 2.21.1); was 7.2
++ htmlBrotliKB: 8.5, // 8.1 on 2026-10-16 (Rent by city: the largest cities' rents where an empty "posted here" was); 7.4 before
jsFiles: 5, // 5 (theme-loader, web-runtime, navbar, footer, boost: openvibe-shared/shell)
jsRawKB: 264, // 239.8
jsBrotliKB: 62.5, // 56.5