From 222df9f11c6ca97cad016328c3ad7e5ef1684a91 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 22 Jan 2026 21:36:52 +0100 Subject: [PATCH] feat(dashboard): add Tor Network support in Locations component with custom naming and icon --- components/dashboard/Locations.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/components/dashboard/Locations.tsx b/components/dashboard/Locations.tsx index 6aa4bb3..82c1f33 100644 --- a/components/dashboard/Locations.tsx +++ b/components/dashboard/Locations.tsx @@ -7,6 +7,7 @@ import * as Flags from 'country-flag-icons/react/3x2' import iso3166 from 'iso-3166-2' import WorldMap from './WorldMap' import { Modal } from '@ciphera-net/ui' +import { SiTorproject } from 'react-icons/si' interface LocationProps { countries: Array<{ country: string; pageviews: number }> @@ -25,12 +26,19 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' const getFlagComponent = (countryCode: string) => { if (!countryCode || countryCode === 'Unknown') return null + + if (countryCode === 'T1') { + return + } + const FlagComponent = (Flags as any)[countryCode] return FlagComponent ? : null } const getCountryName = (code: string) => { if (!code || code === 'Unknown') return 'Unknown' + if (code === 'T1') return 'Tor Network' + try { const regionNames = new Intl.DisplayNames(['en'], { type: 'region' }) return regionNames.of(code) || code @@ -40,6 +48,7 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' } const getRegionName = (regionCode: string, countryCode: string) => { + if (regionCode === 'T1') return 'Tor Network' if (!regionCode || regionCode === 'Unknown' || !countryCode || countryCode === 'Unknown') return 'Unknown' try { @@ -60,6 +69,12 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' } } + const getCityName = (city: string) => { + if (city === 'T1') return 'Tor Network' + if (!city || city === 'Unknown') return 'Unknown' + return city + } + const getData = () => { switch (activeTab) { case 'countries': return countries @@ -162,7 +177,7 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' {activeTab === 'countries' ? getCountryName(item.country) : activeTab === 'regions' ? getRegionName(item.region, item.country) : - (item.city === 'Unknown' ? 'Unknown' : item.city)} + getCityName(item.city)}
@@ -196,7 +211,7 @@ export default function Locations({ countries, cities, regions, geoDataLevel = ' {activeTab === 'countries' ? getCountryName(item.country) : activeTab === 'regions' ? getRegionName(item.region, item.country) : - (item.city === 'Unknown' ? 'Unknown' : item.city)} + getCityName(item.city)}