[WEB-5179] chore: icon utils code refactor #8458

This commit is contained in:
Anmol Singh Bhatia 2025-12-29 13:31:27 +05:30 committed by GitHub
parent ec215bb3b1
commit 630d2b9600
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,8 +16,8 @@ import {
FileCode, FileCode,
Mail, Mail,
Chrome, Chrome,
Link2,
} from "lucide-react"; } from "lucide-react";
import { LinkIcon } from "@plane/propel/icons";
type IconMatcher = { type IconMatcher = {
pattern: RegExp; pattern: RegExp;
@ -60,5 +60,5 @@ export const getIconForLink = (url: string) => {
const allMatchers = [...SOCIAL_MEDIA_MATCHERS, ...PRODUCTIVITY_MATCHERS, ...FILE_TYPE_MATCHERS, ...OTHER_MATCHERS]; const allMatchers = [...SOCIAL_MEDIA_MATCHERS, ...PRODUCTIVITY_MATCHERS, ...FILE_TYPE_MATCHERS, ...OTHER_MATCHERS];
const matchedIcon = allMatchers.find(({ pattern }) => pattern.test(lowerUrl)); const matchedIcon = allMatchers.find(({ pattern }) => pattern.test(lowerUrl));
return matchedIcon?.icon ?? LinkIcon; return matchedIcon?.icon ?? Link2;
}; };