Skip to content

Commit aeedae7

Browse files
authored
Merge pull request #37 from citizenlabsgr/price-limit
Set a default limit on prices
2 parents 7e6b570 + be0a316 commit aeedae7

13 files changed

Lines changed: 145 additions & 44 deletions

AGENTS.md

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ <h2 class="font-semibold text-lg">How each mode works</h2>
232232
min="0"
233233
max="50"
234234
step="5"
235-
value="50"
235+
value="40"
236236
class="min-w-0 flex-1 accent-green-700"
237237
aria-label="Willing to pay"
238238
/>
239239
<span
240240
id="parkingMaxEveningBudgetOut"
241241
class="w-[4.75rem] shrink-0 text-right text-sm font-semibold tabular-nums text-slate-800 sm:w-16"
242-
>Any price</span
242+
>$40</span
243243
>
244244
</div>
245245
<div
@@ -276,14 +276,14 @@ <h2 class="font-semibold text-lg">How each mode works</h2>
276276
min="0"
277277
max="15"
278278
step="1"
279-
value="5"
279+
value="8"
280280
class="min-w-0 flex-1 accent-blue-600"
281281
aria-label="Maximum walk from parking to the nearest DASH stop"
282282
/>
283283
<span
284284
id="parkingMaxWalkBudgetOut"
285285
class="min-w-[6.5rem] shrink-0 text-right text-xs font-semibold tabular-nums leading-tight text-slate-800 sm:min-w-[7.5rem] sm:text-sm"
286-
>0.5 mi (~12 min)</span
286+
>0.8 mi (~19 min)</span
287287
>
288288
</div>
289289
</div>

src/visit/visit.mjs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,22 @@ const PARKING_SPOT_CATEGORY_KEYS = [
4545
/** `#/visit` — slider max (50) means no evening price cap; scale is 0–50 in $5 steps. */
4646
const PARKING_MAX_EVENING_SLIDER_CEILING = 50;
4747
const PARKING_MAX_EVENING_SLIDER_STEP = 5;
48-
/** When `pay` is omitted from the URL, default to max (`Any price`) for a short `#/visit` link. */
49-
const PARKING_DEFAULT_MAX_EVENING_SLIDER_VALUE =
50-
PARKING_MAX_EVENING_SLIDER_CEILING;
48+
/** When `pay` is omitted from the URL, default to **$40** for a short `#/visit` link. */
49+
const PARKING_DEFAULT_MAX_EVENING_SLIDER_VALUE = 40;
5150
const PARKING_PAY_QUERY_KEY = "pay";
5251
const PARKING_PAY_QUERY_KEY_LEGACY = "maxEvening";
5352

5453
/**
5554
* Grid-style walk miles (N–S + E–W, no diagonal shortcut) to the **nearest DASH stop** from each pin
5655
* (minute hints from **`parkingRoutePace.walkMinutesPerMile`**, default ~2.5 mph).
5756
* **Internal/DOM index:** **0** → no distance; **1…15** → **0.1…1.5 mi**.
58-
* **default** index **5** = **0.5 mi** (URL omits `walk`).
57+
* **default** index **8** = **0.8 mi** (URL omits `walk`).
5958
*/
6059
const PARKING_MAX_WALK_MI_MAX = 1.5;
6160
const PARKING_MAX_WALK_SLIDER_CEILING_IDX = Math.round(
6261
PARKING_MAX_WALK_MI_MAX * 10,
6362
);
64-
const PARKING_DEFAULT_WALK_SLIDER_INDEX = 5;
63+
const PARKING_DEFAULT_WALK_SLIDER_INDEX = 8;
6564
const PARKING_WALK_QUERY_KEY = "walk";
6665
const PARKING_WALK_QUERY_KEY_LEGACY = "maxWalk";
6766
/** Show feet (with minute hint) when below this cap — slider **0.1–0.4 mi**; **0.5+** as miles. */
@@ -239,7 +238,7 @@ function getParkingWalkCapMilesFromHash() {
239238
raw = params.get(PARKING_WALK_QUERY_KEY_LEGACY);
240239
}
241240
if (raw == null || String(raw).trim() === "") {
242-
return 0.5;
241+
return 0.8;
243242
}
244243
const t = String(raw).trim().toLowerCase();
245244
if (t === "0" || t === "0.0") return 0;
@@ -1011,6 +1010,17 @@ function getParkingSpotIdForHash() {
10111010
return getParkingCommittedStartSpotIdForHashWrite(undefined);
10121011
}
10131012

1013+
/**
1014+
* Green pick marker: visible committed id, else syntactically valid `park=` when **`walk` ≠ 0** so a
1015+
* shared link still shows one saturated pin (not muted suggestions) even if filters hide the circle.
1016+
*/
1017+
function getParkingCommittedSpotIdForPickMarker() {
1018+
const visible = getParkingSpotIdForHash();
1019+
if (visible) return visible;
1020+
if (getParkingMaxWalkSliderValueForHash() === 0) return undefined;
1021+
return normalizeParkingSpotIdFromHashRaw();
1022+
}
1023+
10141024
/**
10151025
* Both a **destination** (path or `finish=` / legacy venue keys) and committed **`park=`** / legacy **`start=`** / **`spot=`** are in the URL —
10161026
* trip step digits (**1**–**4**) appear on map pins; otherwise badges stay blank.
@@ -1119,6 +1129,8 @@ function buildParkingHashFromState(
11191129
}
11201130
} else if (sliderVal !== PARKING_DEFAULT_MAX_EVENING_SLIDER_VALUE) {
11211131
parts.push(`${PARKING_PAY_QUERY_KEY}=${Math.round(sliderVal)}`);
1132+
} else if (stickyPw.pay) {
1133+
parts.push(`${PARKING_PAY_QUERY_KEY}=${Math.round(sliderVal)}`);
11221134
}
11231135
}
11241136
if (walkIx === 0) {
@@ -1453,7 +1465,7 @@ function getAllParkingSpotMarkers(
14531465
const destLl = getParkingDestinationLatLng();
14541466
const dashStops = getDashStopLatLngsForParkingProximity();
14551467
/**
1456-
* **`walk`** omitted from URL defaults to **0.5** mi — never **0** unless explicit **`walk=0`**.
1468+
* **`walk`** omitted from URL defaults to **0.8** mi — never **0** unless explicit **`walk=0`**.
14571469
* **`walk=0`** uses {@link PARKING_WALK_ZERO_EFFECTIVE_FEET} ft (~**0.019** mi) grid-walk for this filter only.
14581470
*/
14591471
const applyWalkCap =
@@ -3041,7 +3053,7 @@ function syncParkingSpotPickMarker(map) {
30413053
parkingSpotPickLayerGroup = null;
30423054
}
30433055

3044-
const committed = getParkingSpotIdForHash();
3056+
const committed = getParkingCommittedSpotIdForPickMarker();
30453057
if (typeof committed === "string" && committed.length > 0) {
30463058
const p = parseParkingSpotIdToken(committed);
30473059
if (!p) return;
-26.3 KB
Loading
-21.6 KB
Loading
-51.3 KB
Loading

tests/snapshots/phone-1-blank.png

-12.3 KB
Loading

tests/snapshots/phone-2-finish.png

-14.8 KB
Loading

tests/snapshots/phone-3-start.png

-13.8 KB
Loading

tests/snapshots/tablet-1-blank.png

-15.1 KB
Loading

0 commit comments

Comments
 (0)