fmt
This commit is contained in:
parent
2f149503bb
commit
6ea544a0f6
10 changed files with 144 additions and 60 deletions
|
|
@ -44,7 +44,7 @@ function getProductDemoSlug(language: string | undefined, isMobile: boolean): st
|
|||
return isMobile ? `${base}-mobile` : base;
|
||||
}
|
||||
|
||||
function highlightBrandText(text: string) {
|
||||
function highlightBrandText(text: string, className = BRAND_TEXT_CLASS) {
|
||||
const parts = text.split(BRAND_NAME);
|
||||
if (parts.length === 1) return text;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ function highlightBrandText(text: string) {
|
|||
index === 0
|
||||
? [part]
|
||||
: [
|
||||
<span key={`brand-${index}`} className={BRAND_TEXT_CLASS}>
|
||||
<span key={`brand-${index}`} className={className}>
|
||||
{BRAND_NAME}
|
||||
</span>,
|
||||
part,
|
||||
|
|
@ -325,7 +325,7 @@ export default function HomePage({
|
|||
{t('home.heroSubtitle')}
|
||||
</p>
|
||||
<p className="text-base md:text-lg text-warm-200 mb-8 max-w-xl">
|
||||
{highlightBrandText(t('home.heroDescription'))}
|
||||
{highlightBrandText(t('home.heroDescription'), 'font-semibold text-teal-300')}
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4 mb-10">
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -561,9 +561,7 @@ export default function MapPage({
|
|||
isGroupExpanded={isAreaGroupExpanded}
|
||||
onToggleGroup={toggleAreaGroup}
|
||||
scrollTopRef={areaPaneScrollTopRef}
|
||||
scrollRestoreKey={
|
||||
selectedHexagon ? `${selectedHexagon.type}:${selectedHexagon.id}` : null
|
||||
}
|
||||
scrollRestoreKey={selectedHexagon ? `${selectedHexagon.type}:${selectedHexagon.id}` : null}
|
||||
scrollSaveDisabled={loadingAreaStats && areaStats == null}
|
||||
/>
|
||||
</Suspense>
|
||||
|
|
@ -578,9 +576,7 @@ export default function MapPage({
|
|||
hexagonId={selectedHexagon?.id || null}
|
||||
onLoadMore={handleLoadMoreProperties}
|
||||
scrollTopRef={propertiesPaneScrollTopRef}
|
||||
scrollRestoreKey={
|
||||
selectedHexagon ? `${selectedHexagon.type}:${selectedHexagon.id}` : null
|
||||
}
|
||||
scrollRestoreKey={selectedHexagon ? `${selectedHexagon.type}:${selectedHexagon.id}` : null}
|
||||
scrollSaveDisabled={loadingProperties && properties.length === 0}
|
||||
/>
|
||||
</Suspense>
|
||||
|
|
|
|||
|
|
@ -34,11 +34,7 @@ describe('useRetainedScrollTop', () => {
|
|||
it('keeps the saved scroll offset while replacement content is loading', () => {
|
||||
const savedScrollTopRef = { current: 0 };
|
||||
const view = render(
|
||||
<ScrollPane
|
||||
restoreKey="area:a"
|
||||
savedScrollTopRef={savedScrollTopRef}
|
||||
suspendSave={false}
|
||||
/>
|
||||
<ScrollPane restoreKey="area:a" savedScrollTopRef={savedScrollTopRef} suspendSave={false} />
|
||||
);
|
||||
const pane = view.getByTestId('pane');
|
||||
|
||||
|
|
@ -55,11 +51,7 @@ describe('useRetainedScrollTop', () => {
|
|||
expect(savedScrollTopRef.current).toBe(360);
|
||||
|
||||
view.rerender(
|
||||
<ScrollPane
|
||||
restoreKey="area:b"
|
||||
savedScrollTopRef={savedScrollTopRef}
|
||||
suspendSave={false}
|
||||
/>
|
||||
<ScrollPane restoreKey="area:b" savedScrollTopRef={savedScrollTopRef} suspendSave={false} />
|
||||
);
|
||||
|
||||
expect(pane.scrollTop).toBe(360);
|
||||
|
|
@ -68,11 +60,7 @@ describe('useRetainedScrollTop', () => {
|
|||
it('restores the saved offset when a pane remounts', () => {
|
||||
const savedScrollTopRef = { current: 220 };
|
||||
const view = render(
|
||||
<ScrollPane
|
||||
restoreKey="area:a"
|
||||
savedScrollTopRef={savedScrollTopRef}
|
||||
suspendSave={false}
|
||||
/>
|
||||
<ScrollPane restoreKey="area:a" savedScrollTopRef={savedScrollTopRef} suspendSave={false} />
|
||||
);
|
||||
|
||||
expect(view.getByTestId('pane').scrollTop).toBe(220);
|
||||
|
|
|
|||
|
|
@ -83,9 +83,7 @@ describe('map utilities', () => {
|
|||
expect(getPoiIconUrl('M&S', '🛒', undefined, 'M&S Simply Food')).toBe(
|
||||
'/assets/poi-icons/visuals/mns.svg'
|
||||
);
|
||||
expect(getPoiIconUrl('Tian Tian', '🛒')).toMatch(
|
||||
/^data:image\/svg\+xml;charset=utf-8,/
|
||||
);
|
||||
expect(getPoiIconUrl('Tian Tian', '🛒')).toMatch(/^data:image\/svg\+xml;charset=utf-8,/);
|
||||
});
|
||||
|
||||
it('keeps POI icon URLs bundled locally', () => {
|
||||
|
|
|
|||
|
|
@ -358,9 +358,8 @@ function getGeneratedPoiLogoUrl(label: string): string {
|
|||
const cached = generatedPoiLogoCache.get(key);
|
||||
if (cached) return cached;
|
||||
|
||||
const [background, foreground] = GENERATED_POI_LOGO_COLORS[
|
||||
hashLabel(key) % GENERATED_POI_LOGO_COLORS.length
|
||||
];
|
||||
const [background, foreground] =
|
||||
GENERATED_POI_LOGO_COLORS[hashLabel(key) % GENERATED_POI_LOGO_COLORS.length];
|
||||
const initials = escapeSvgText(getPoiLogoInitials(key));
|
||||
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><rect width="256" height="256" rx="48" fill="${background}"/><text x="128" y="144" text-anchor="middle" font-family="Inter,Arial,sans-serif" font-size="82" font-weight="800" fill="${foreground}">${initials}</text></svg>`;
|
||||
const url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue