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!

display flag near locales

Blue Mouse7edc8dca5278
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index 52954d6a8..238258361 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -3669,22 +3669,27 @@ const ViewProject = () => {
{ id: 'map', label: 'Map', hasData: !!panelsData.data.cc },
]
- const getLocationRowMapper = (activeTab: string) => {
- if (activeTab === 'cc' || activeTab === 'rg' || activeTab === 'ct') {
- // eslint-disable-next-line
- return (entry: CountryEntry) => {
- const { name: entryName, cc } = entry
- if (cc) {
- return <CCRow cc={cc} name={entryName} language={language} />
- }
- return <CCRow cc={entryName} language={language} />
- }
+ const rowMapper = (entry: CountryEntry) => {
+ const { name: entryName, cc } = entry
+
+ if (locationActiveTab === 'lc') {
+ const entryNameArray = entryName.split('-')
+ const displayName = getLocaleDisplayName(entryName, language)
+
+ return (
+ <CCRow
+ cc={entryNameArray[entryNameArray.length - 1]}
+ name={displayName}
+ language={language}
+ />
+ )
}
- if (activeTab === 'lc') {
- return ({ name: entryName }: { name: string }) =>
- getLocaleDisplayName(entryName, language)
+
+ if (cc) {
+ return <CCRow cc={cc} name={entryName} language={language} />
}
- return undefined
+
+ return <CCRow cc={entryName} language={language} />
}
return (
@@ -3699,7 +3704,7 @@ const ViewProject = () => {
activeTabId={locationActiveTab}
data={panelsData.data[locationActiveTab]}
customTabs={customTabs}
- rowMapper={getLocationRowMapper(locationActiveTab)}
+ rowMapper={rowMapper}
customRenderer={
locationActiveTab === 'map'
? () => {
diff --git a/web/app/ui/Flag.tsx b/web/app/ui/Flag.tsx
index b0dcd3eb7..696e6d7bc 100644
--- a/web/app/ui/Flag.tsx
+++ b/web/app/ui/Flag.tsx
@@ -19,15 +19,7 @@ const Flag = ({ country, size = 24, alt, ...props }: FlagProps) => {
return <span className={props.className}>{country}</span>
}
- return (
- <img
- src={`${FLAGS_PREFIX_PATH}/${countryLower}.svg`}
- alt={alt || `Flag of ${country}`}
- {...props}
- width={size}
- height={size}
- />
- )
+ return <img src={`${FLAGS_PREFIX_PATH}/${countryLower}.svg`} alt={alt || ''} {...props} width={size} height={size} />
}
export default Flag