mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix(favicon): скругляем углы кастомного лого как у плитки в хедере
Кастомное лого квадратное, и в фавиконе показывалось с острыми углами. Теперь лого прогоняется через canvas со скруглённым клипом (radiusRatio 0.3 — как rounded-linear-lg 12px на плитке 40px в хедере) и отдаётся скруглённым PNG. При сбое canvas (taint/нет 2d-контекста) — фолбэк на сырой лого. Применяется и в кабинете (useBranding), и на лендинге (QuickPurchase); буквенная монограмма уже скруглена через rx.
This commit is contained in:
@@ -30,7 +30,7 @@ import LanguageSwitcher from '../components/LanguageSwitcher';
|
||||
import { cn } from '../lib/utils';
|
||||
import { getApiErrorMessage } from '../utils/api-error';
|
||||
import { formatPrice } from '../utils/format';
|
||||
import { setFavicon, letterFaviconDataUri } from '../utils/favicon';
|
||||
import { setFavicon, letterFaviconDataUri, roundedFaviconDataUri } from '../utils/favicon';
|
||||
import { useCurrency } from '../hooks/useCurrency';
|
||||
|
||||
function detectContactType(value: string): 'email' | 'telegram' {
|
||||
@@ -805,7 +805,18 @@ export default function QuickPurchase() {
|
||||
useEffect(() => {
|
||||
if (!branding) return;
|
||||
const logoUrl = branding.has_custom_logo ? getLogoBlobUrl() : null;
|
||||
setFavicon(logoUrl || letterFaviconDataUri(branding.logo_letter));
|
||||
if (!logoUrl) {
|
||||
setFavicon(letterFaviconDataUri(branding.logo_letter));
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
// Round the custom logo like the header tile instead of a hard square.
|
||||
roundedFaviconDataUri(logoUrl).then((rounded) => {
|
||||
if (!cancelled) setFavicon(rounded || logoUrl);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [branding]);
|
||||
|
||||
const [discountExpired, setDiscountExpired] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user