Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

some generic improvements for cities

Blue Mouse5a075896cd98
diff --git a/app/pages/Project/View/Panels.tsx b/app/pages/Project/View/Panels.tsx
index 684c0e4fe..9dcc85673 100644
--- a/app/pages/Project/View/Panels.tsx
+++ b/app/pages/Project/View/Panels.tsx
@@ -141,7 +141,7 @@ const PanelContainer = ({
)}
{/* if it is a Country tab */}
- {type === 'cc' && (
+ {(type === 'cc' || type === 'rg' || type === 'ct') && (
<>
<MapIcon
className={cx(iconClassName, 'ml-2 cursor-pointer', {
@@ -900,7 +900,7 @@ const Panel = ({
}
// Showing map of stats a data
- if (id === 'cc' && activeFragment === 1 && !_isEmpty(data)) {
+ if ((id === 'cc' || id === 'rg' || id === 'ct') && activeFragment === 1 && !_isEmpty(data)) {
return (
<PanelContainer
name={name}
diff --git a/app/pages/Project/View/ViewProject.tsx b/app/pages/Project/View/ViewProject.tsx
index 34130f064..fa19fe220 100644
--- a/app/pages/Project/View/ViewProject.tsx
+++ b/app/pages/Project/View/ViewProject.tsx
@@ -52,7 +52,7 @@ import {
import { IUser } from 'redux/models/IUser'
import { IProject, ILiveStats } from 'redux/models/IProject'
import { IProjectForShared, ISharedProject } from 'redux/models/ISharedProject'
-import { IEntry } from 'redux/models/IEntry'
+import { ICountryEntry } from 'redux/models/IEntry'
import Loader from 'ui/Loader'
import Dropdown from 'ui/Dropdown'
import Checkbox from 'ui/Checkbox'
@@ -2194,17 +2194,17 @@ const ViewProject = ({
if (type === 'cc') {
const ccPanelName = tnMapping[countryActiveTab]
- const rowMapper = (entry: IEntry) => {
+ const rowMapper = (entry: ICountryEntry) => {
const { name: entryName, cc } = entry
if (cc) {
return (
- <CCRow rowName={cc} language={language} />
+ <CCRow cc={cc} name={entryName} language={language} />
)
}
return (
- <CCRow rowName={entryName} language={language} />
+ <CCRow cc={entryName} language={language} />
)
}
@@ -2365,17 +2365,17 @@ const ViewProject = ({
if (type === 'cc') {
const ccPanelName = tnMapping[countryActiveTab]
- const rowMapper = (entry: IEntry) => {
+ const rowMapper = (entry: ICountryEntry) => {
const { name: entryName, cc } = entry
if (cc) {
return (
- <CCRow rowName={cc} language={language} />
+ <CCRow cc={cc} name={entryName} language={language} />
)
}
return (
- <CCRow rowName={entryName} language={language} />
+ <CCRow cc={entryName} language={language} />
)
}
diff --git a/app/pages/Project/View/components/CCRow.tsx b/app/pages/Project/View/components/CCRow.tsx
index bed9f85f1..bf1843c7e 100644
--- a/app/pages/Project/View/components/CCRow.tsx
+++ b/app/pages/Project/View/components/CCRow.tsx
@@ -1,35 +1,37 @@
import React, { memo } from 'react'
import Flag from 'react-flagkit'
import countries from 'utils/isoCountries'
-import PropTypes from 'prop-types'
+
+interface ICCRow {
+ cc: string
+ name?: string
+ language: string
+}
/**
* Component to render country flag in the 'Countries' panel.
*
- * @param {string} rowName - The country code.
+ * @param {string} cc - The country code.
+ * @param {string} name - Row name to override country name with.
* @param {string} language - Language to use for country name.
* @returns {JSX.Element}
*/
-const CCRow = ({ rowName, language }: {
- rowName: string
- language: string
-}): JSX.Element => (
+const CCRow = ({ cc, name, language }: ICCRow): JSX.Element => (
<>
<Flag
className='rounded-sm'
- country={rowName}
+ country={cc}
size={21}
alt=''
aria-hidden='true'
/>
&nbsp;&nbsp;
- {countries.getName(rowName, language)}
+ {name || countries.getName(cc, language)}
</>
)
-CCRow.propTypes = {
- rowName: PropTypes.string.isRequired,
- language: PropTypes.string.isRequired,
+CCRow.defaultProps = {
+ name: null,
}
export default memo(CCRow)
diff --git a/app/redux/models/IEntry.ts b/app/redux/models/IEntry.ts
index be1f92ef6..fdb336d4e 100644
--- a/app/redux/models/IEntry.ts
+++ b/app/redux/models/IEntry.ts
@@ -3,3 +3,7 @@ export interface IEntry {
count: number
cc?: string
}
+
+export interface ICountryEntry extends IEntry {
+ cc: string
+}