From ab46dc22a94d78b725cc5e4d528c56726138a9ee Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 22 Jan 2026 21:39:39 +0100 Subject: [PATCH] feat(dashboard): enhance Locations component with additional country codes and corresponding icons for better representation --- components/dashboard/Locations.tsx | 44 ++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/components/dashboard/Locations.tsx b/components/dashboard/Locations.tsx index 82c1f33..629e501 100644 --- a/components/dashboard/Locations.tsx +++ b/components/dashboard/Locations.tsx @@ -8,6 +8,7 @@ import iso3166 from 'iso-3166-2' import WorldMap from './WorldMap' import { Modal } from '@ciphera-net/ui' import { SiTorproject } from 'react-icons/si' +import { FaUserSecret, FaSatellite, FaGlobe } from 'react-icons/fa' interface LocationProps { countries: Array<{ country: string; pageviews: number }> @@ -27,8 +28,17 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' const getFlagComponent = (countryCode: string) => { if (!countryCode || countryCode === 'Unknown') return null - if (countryCode === 'T1') { - return + switch (countryCode) { + case 'T1': + return + case 'A1': + return + case 'A2': + return + case 'O1': + case 'EU': + case 'AP': + return } const FlagComponent = (Flags as any)[countryCode] @@ -37,7 +47,15 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' const getCountryName = (code: string) => { if (!code || code === 'Unknown') return 'Unknown' - if (code === 'T1') return 'Tor Network' + + switch (code) { + case 'T1': return 'Tor Network' + case 'A1': return 'Anonymous Proxy' + case 'A2': return 'Satellite Provider' + case 'O1': return 'Other' + case 'EU': return 'Europe' + case 'AP': return 'Asia/Pacific' + } try { const regionNames = new Intl.DisplayNames(['en'], { type: 'region' }) @@ -48,7 +66,16 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' } const getRegionName = (regionCode: string, countryCode: string) => { - if (regionCode === 'T1') return 'Tor Network' + // Check for special country codes first + switch (countryCode) { + case 'T1': return 'Tor Network' + case 'A1': return 'Anonymous Proxy' + case 'A2': return 'Satellite Provider' + case 'O1': return 'Other' + case 'EU': return 'Europe' + case 'AP': return 'Asia/Pacific' + } + if (!regionCode || regionCode === 'Unknown' || !countryCode || countryCode === 'Unknown') return 'Unknown' try { @@ -70,7 +97,14 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' } const getCityName = (city: string) => { - if (city === 'T1') return 'Tor Network' + // Check for special codes that might appear in city field + switch (city) { + case 'T1': return 'Tor Network' + case 'A1': return 'Anonymous Proxy' + case 'A2': return 'Satellite Provider' + case 'O1': return 'Other' + } + if (!city || city === 'Unknown') return 'Unknown' return city }