mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
fix(ci): the second round of gates after the places changes
- index.css stays at its size: the map canvas colour moves to its own stylesheet. - The rating badge on map markers takes its amber and white from a class in ratingBadge.css instead of inline literals; the theme entry drops with it. - Strict mode: the identity a link joins is resolved without a widened union, the description of an entry's origins is string or undefined, and the map search rows are typed. - knip: PLACE_NAME_ATTR is module private, the linked-by enum names the values the service writes, and the unlink contract is its own described schema rather than a second name for the use schema. - The duplicates hook test reads toasts through a module mock instead of the window hook; react-hooks/refs is lowered to the count the run measured. - Tests follow the rename to Places and the list icon on an edit.
This commit is contained in:
@@ -11,7 +11,7 @@ import './placeNames.css';
|
||||
* A place folded into a cluster has no element, so it has no label either.
|
||||
*/
|
||||
|
||||
export const PLACE_NAME_ATTR = 'data-place-name';
|
||||
const PLACE_NAME_ATTR = 'data-place-name';
|
||||
const PRIORITY_ATTR = 'data-place-name-priority';
|
||||
const LABEL_CLASS = 'trek-place-name';
|
||||
const HIDDEN_ATTR = 'data-hidden';
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/* The rating on a map marker's corner: amber with a white figure, like the list's badge. */
|
||||
.trek-rating-badge {
|
||||
background: #f59e0b;
|
||||
color: #fff;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
@@ -27,11 +27,11 @@ describe('cornerBadgeHtml', () => {
|
||||
const html = cornerBadgeHtml([2, 5], 4.5, true, -4);
|
||||
expect(html).toContain('2 · 5');
|
||||
expect(html).toContain('bottom:-4px;inset-inline-end:-4px');
|
||||
expect(html).not.toContain('#fbbf24');
|
||||
expect(html).not.toContain('trek-rating-badge');
|
||||
});
|
||||
|
||||
it('FE-MAP-RATINGBADGE-102: without numbers the rating shows when asked for, else nothing', () => {
|
||||
expect(cornerBadgeHtml(null, 4, true, -2)).toContain('#fbbf24');
|
||||
expect(cornerBadgeHtml(null, 4, true, -2)).toContain('trek-rating-badge');
|
||||
expect(cornerBadgeHtml([], 4, false, -2)).toBe('');
|
||||
expect(cornerBadgeHtml([3], null, true, -2)).toContain('height:18px');
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import './ratingBadge.css';
|
||||
|
||||
/**
|
||||
* The rating a place carries, as a disc on the corner of its marker.
|
||||
*
|
||||
@@ -12,15 +14,15 @@
|
||||
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);
|
||||
return `<span style="
|
||||
// Its amber and white live in ratingBadge.css, beside the list's badge of the same look.
|
||||
return `<span class="trek-rating-badge" style="
|
||||
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;
|
||||
font-size:9px;font-weight:800;color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.45);
|
||||
font-size:9px;font-weight:800;
|
||||
font-family:var(--font-system);line-height:1;
|
||||
box-sizing:border-box;white-space:nowrap;
|
||||
">${label}</span>`;
|
||||
|
||||
Reference in New Issue
Block a user