mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
feat(places): review possible duplicates, and repair the client gates
All places offers the pairs that look like one place: both sides side by side with what differs marked, "keep this one" to group them as one place of the user's own (undo right after), and "not the same place" to set a pair aside for good. Desktop dialog and phone sheet share usePlaceDuplicates; every locale has the new strings. What the last dev run flagged on the client: - Tailwind's Prettier plugin had trimmed the leading space of conditional class names (col-filter-btn, col-lrow sel, col-split map-full, col-detail docked), so the filter row and the open row lost their styling; those classes are now joined so the formatter cannot glue them. - The dock position lives in one helper for the lists and All places, which moves the measured-position markers there instead of adding new ones. - usePlacesLibrary is split into filters, pages, detail and cover hooks that derive their loading state instead of setting it inside effects; the big sheets and views are cut into parts under the complexity limit, dynamic icons go through createElement, originName moves out of a component file. - formatRange is guarded like in the packing export, the cover lookup skips places without a position. - Tests follow the rename to Places, the category icon, the default list icon and the new trip collections store; react-hooks/refs is lowered to the count the run measured. - The rating on a place is a round badge again, in the list and on the map.
This commit is contained in:
@@ -1,32 +1,29 @@
|
||||
/** Lucide's star, the one the lists wear. */
|
||||
const STAR_PATH =
|
||||
'M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z';
|
||||
|
||||
/**
|
||||
* The rating a place carries, as a star on the corner of its marker.
|
||||
* The rating a place carries, as a disc on the corner of its marker.
|
||||
*
|
||||
* Bottom right, where a trip's day numbers sit — the two never appear together, since
|
||||
* a numbered stop is one you have already planned and this answers the question you
|
||||
* ask before that: of all these photos, which did I like. Amber rather than the number
|
||||
* badge's white, so a glance tells them apart without reading either.
|
||||
*
|
||||
* A star like the one the lists put on a place's picture, so the vote reads the same on
|
||||
* the map and beside it; the figure inside is rounded to one decimal.
|
||||
* A rounded value and no star: at eighteen pixels a star is a smudge, and "4.5" is
|
||||
* already the whole sentence.
|
||||
*/
|
||||
export function ratingBadgeHtml(rating: number | null | undefined): string {
|
||||
if (typeof rating !== 'number' || !(rating > 0)) return '';
|
||||
const label = Number.isInteger(rating) ? String(rating) : rating.toFixed(1);
|
||||
// A star rather than a disc, as in the lists; its box a little over the old disc,
|
||||
// since a star fills less of it. Leaflet lifts every svg in a marker to z-index 200,
|
||||
// so both layers name theirs, or the star covers its own figure.
|
||||
return `<span style="
|
||||
position:absolute;bottom:-6px;right:-6px;
|
||||
width:22px;height:22px;
|
||||
position:absolute;bottom:-4px;right:-4px;
|
||||
min-width:18px;height:18px;border-radius:9px;
|
||||
padding:0 4px;
|
||||
background:#f59e0b;
|
||||
border:1.5px solid rgba(255,255,255,0.92);
|
||||
box-shadow:0 1px 4px rgba(0,0,0,0.25);
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
"><svg viewBox="0 0 24 24" width="22" height="22" style="position:absolute;inset:0;z-index:0;overflow:visible"
|
||||
fill="#fbbf24" stroke="rgba(255,255,255,0.92)" stroke-width="1.3" stroke-linejoin="round"><path d="${STAR_PATH}"/></svg>
|
||||
<span style="position:relative;z-index:1;margin-top:2px;font-size:${label.length > 1 ? 6.5 : 8.5}px;font-weight:800;line-height:1;
|
||||
color:#111;font-family:var(--font-system);white-space:nowrap;">${label}</span></span>`;
|
||||
font-size:9px;font-weight:800;color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.45);
|
||||
font-family:var(--font-system);line-height:1;
|
||||
box-sizing:border-box;white-space:nowrap;
|
||||
">${label}</span>`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user