File tree Expand file tree Collapse file tree
apps/dashboard/app/(main)/websites/[id]/users Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use client" ;
22
33import {
4+ formatCountryName ,
45 getCountryCode ,
5- getCountryName ,
66} from "@databuddy/shared/country-codes" ;
77import type { ProfileSession , Session } from "@/types/sessions" ;
88import { notFound , useParams , useRouter } from "next/navigation" ;
@@ -443,7 +443,7 @@ function Header({
443443 const countryCode = userProfile
444444 ? getCountryCode ( userProfile . country || "" )
445445 : "" ;
446- const countryName = getCountryName ( countryCode ) || userProfile ?. country || "" ;
446+ const countryName = formatCountryName ( userProfile ?. country ) ;
447447 const isReturning = ( userProfile ?. total_sessions ?? 0 ) > 1 ;
448448
449449 return (
@@ -594,10 +594,7 @@ export default function UserDetailPage() {
594594 userProfile . region && userProfile . region !== "Unknown"
595595 ? userProfile . region
596596 : undefined ;
597- const countryName =
598- getCountryName ( getCountryCode ( userProfile . country || "" ) ) ||
599- userProfile . country ||
600- "Unknown" ;
597+ const countryName = formatCountryName ( userProfile . country ) || "Unknown" ;
601598 const metrics = [
602599 { label : "Sessions" , value : totalSessions } ,
603600 { label : "Pageviews" , value : userProfile . total_pageviews ?? 0 } ,
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ import { getDeviceIcon } from "@/components/device-icon";
1616import { dynamicQueryFiltersAtom } from "@/stores/jotai/filterAtoms" ;
1717import type { DynamicQueryFilter } from "@/stores/jotai/filterAtoms" ;
1818import {
19+ formatCountryName ,
1920 getCountryCode ,
20- getCountryName ,
2121} from "@databuddy/shared/country-codes" ;
2222import type { ProfileData } from "@/types/analytics" ;
2323import {
@@ -363,9 +363,8 @@ export default function UsersPage() {
363363 id : "location" ,
364364 header : "Location" ,
365365 cell : ( { row } ) => {
366- const country = row . original . country || "" ;
367- const countryCode = getCountryCode ( country ) ;
368- const countryName = getCountryName ( countryCode ) ;
366+ const countryCode = getCountryCode ( row . original . country || "" ) ;
367+ const countryName = formatCountryName ( row . original . country ) ;
369368 const isUnknown = ! countryCode || countryCode === "Unknown" ;
370369
371370 return (
@@ -376,7 +375,7 @@ export default function UsersPage() {
376375 < CountryFlag country = { countryCode } size = "sm" />
377376 ) }
378377 < span className = "truncate text-sm" >
379- { isUnknown ? "Unknown" : countryName || countryCode }
378+ { countryName || "Unknown" }
380379 </ span >
381380 </ div >
382381 ) ;
You can’t perform that action at this time.
0 commit comments