Skip to content

Commit

Permalink
fix(dashboard): unknow country code
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Aug 17, 2024
1 parent fdd465b commit f04b32d
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/pages/Dashboard/GoogleAnalytics/Realtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const GoogleAnalyticsRealtime: React.FC<GoogleAnalyticsRealtimeProps> = (
window.clearTimeout(intervalId.current)
})

const renderList = (dataSource: ReportRowItem[]) => (
const renderRegionList = (dataSource: ReportRowItem[]) => (
<List
style={{ maxHeight: 120, overflowY: 'auto' }}
size="small"
Expand All @@ -95,13 +95,23 @@ export const GoogleAnalyticsRealtime: React.FC<GoogleAnalyticsRealtimeProps> = (
renderItem={(item, index) => (
<List.Item key={index} style={{ paddingInline: 0 }}>
<Flex justify="space-between">
<UniversalText
text={item.dimensionValues[0].value}
prefix={countryCodeToEmoji(item.dimensionValues[0].value)}
suffix={
<UniversalText text={item.dimensionValues[1].value} type="secondary" small />
}
/>
{item.dimensionValues[0].value.includes('other') ? (
<UniversalText
text={'__'}
prefix="🌍"
suffix={
<UniversalText text={item.dimensionValues[1].value} type="secondary" small />
}
/>
) : (
<UniversalText
text={item.dimensionValues[0].value}
prefix={countryCodeToEmoji(item.dimensionValues[0].value)}
suffix={
<UniversalText text={item.dimensionValues[1].value} type="secondary" small />
}
/>
)}
<UniversalText text={item.metricValues[0].value} type="secondary" />
</Flex>
</List.Item>
Expand All @@ -125,7 +135,7 @@ export const GoogleAnalyticsRealtime: React.FC<GoogleAnalyticsRealtimeProps> = (
/>
<Divider style={{ marginBottom: 0, marginTop: 14 }} />
{regionReports.length ? (
renderList(regionReports)
renderRegionList(regionReports)
) : (
<Empty image={null} imageStyle={{ height: '1rem' }} />
)}
Expand Down

0 comments on commit f04b32d

Please sign in to comment.