Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

remove fallback logic, use service instead of direct URL

Francis Cao7e54e7de312e
diff --git a/src/app/(main)/boards/BoardEntityBadge.tsx b/src/app/(main)/boards/BoardEntityBadge.tsx
index 3a3e1d554..31d7081ab 100644
--- a/src/app/(main)/boards/BoardEntityBadge.tsx
+++ b/src/app/(main)/boards/BoardEntityBadge.tsx
@@ -1,33 +1,8 @@
import { Icon, Row, Text } from '@umami/react-zen';
-import { useState } from 'react';
-import { Globe, Grid2x2, Link } from '@/components/icons';
+import { Favicon } from '@/components/common/Favicon';
+import { Grid2x2, Link } from '@/components/icons';
import type { BoardEntityType } from '@/lib/boards';
-const HOSTNAME_REGEX = /^(?:https?:\/\/)?(?:[^@\n]+@)?([^:/\n?=]+)/im;
-
-function WebsiteIcon({ domain }: { domain?: string }) {
- const [failed, setFailed] = useState(false);
-
- if (domain && !failed) {
- const match = domain.match(HOSTNAME_REGEX);
- const hostname = match?.[1];
-
- if (hostname) {
- return (
- <img
- src={`https://${hostname}/favicon.ico`}
- width={16}
- height={16}
- alt=""
- onError={() => setFailed(true)}
- />
- );
- }
- }
-
- return <Globe width={16} height={16} />;
-}
-
export function BoardEntityBadge({
type,
name,
@@ -45,7 +20,7 @@ export function BoardEntityBadge({
) : type === 'link' ? (
<Link />
) : (
- <WebsiteIcon domain={domain} />
+ <Favicon domain={domain} />
)}
</Icon>
<Text size="sm">{name}</Text>