import React from 'react' import { FaChrome, FaFirefox, FaSafari, FaEdge, FaOpera, FaInternetExplorer, FaWindows, FaApple, FaLinux, FaAndroid, FaDesktop, FaMobileAlt, FaTabletAlt, FaGoogle, FaFacebook, FaTwitter, FaLinkedin, FaInstagram, FaGithub, FaYoutube, FaReddit, FaQuestion, FaGlobe } from 'react-icons/fa' import { SiBrave } from 'react-icons/si' import { MdDeviceUnknown, MdSmartphone, MdTabletMac, MdDesktopWindows } from 'react-icons/md' export function getBrowserIcon(browserName: string) { if (!browserName) return const lower = browserName.toLowerCase() if (lower.includes('chrome')) return if (lower.includes('firefox')) return if (lower.includes('safari')) return if (lower.includes('edge')) return if (lower.includes('opera')) return if (lower.includes('ie') || lower.includes('explorer')) return if (lower.includes('brave')) return return } export function getOSIcon(osName: string) { if (!osName) return const lower = osName.toLowerCase() if (lower.includes('win')) return if (lower.includes('mac') || lower.includes('ios')) return if (lower.includes('linux') || lower.includes('ubuntu') || lower.includes('debian')) return if (lower.includes('android')) return return } export function getDeviceIcon(deviceName: string) { if (!deviceName) return const lower = deviceName.toLowerCase() if (lower.includes('mobile') || lower.includes('phone')) return if (lower.includes('tablet') || lower.includes('ipad')) return if (lower.includes('desktop') || lower.includes('laptop')) return return } export function getReferrerIcon(referrerName: string) { if (!referrerName) return const lower = referrerName.toLowerCase() if (lower.includes('google')) return if (lower.includes('facebook')) return if (lower.includes('twitter') || lower.includes('t.co') || lower.includes('x.com')) return if (lower.includes('linkedin')) return if (lower.includes('instagram')) return if (lower.includes('github')) return if (lower.includes('youtube')) return if (lower.includes('reddit')) return // Try to use a generic globe or maybe check if it is a URL return } export function getReferrerFavicon(referrer: string) { try { const url = new URL(referrer.startsWith('http') ? referrer : `https://${referrer}`); return `https://www.google.com/s2/favicons?domain=${url.hostname}&sz=32`; } catch (e) { return null; } }