Merge branch 'fix-badge-crash' into 'main'

Badge: fix page crash when color isn't defined

Closes #1650

See merge request soapbox-pub/soapbox!2996
This commit is contained in:
Alex Gleason 2024-04-16 20:53:29 +00:00
commit 87d04e6a0c

View file

@ -13,7 +13,9 @@ const Badge: React.FC<IBadge> = ({ title, slug, color }) => {
const fallback = !['patron', 'admin', 'moderator', 'opaque', 'badge:donor'].includes(slug);
const isDark = useMemo(() => {
const hsl = hexToHsl(color!);
if (!color) return false;
const hsl = hexToHsl(color);
if (hsl && hsl.l > 50) return false;