refactor(places): one label for a rating badge

The list rows and the map pins wrote the average with their own copy of
the whole star or one decimal rule; both now read ratingBadge.
This commit is contained in:
Maurice
2026-11-30 12:34:50 +01:00
parent 7008427022
commit 501e4449ef
2 changed files with 5 additions and 6 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import { ratingBadge } from '../Collections/ratingLabel';
import './ratingBadge.css';
/**
@@ -12,8 +13,8 @@ import './ratingBadge.css';
* 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);
const label = ratingBadge(rating);
if (!label) return '';
// 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;