Fixes for country search.

This commit is contained in:
Mike Cao 2024-11-28 16:46:40 -08:00
parent 8925283564
commit 98352628cb
3 changed files with 4 additions and 20 deletions

View File

@ -1,9 +1,6 @@
import MetricsTable, { MetricsTableProps } from './MetricsTable'; import MetricsTable, { MetricsTableProps } from './MetricsTable';
import { emptyFilter } from 'lib/filters'; import { emptyFilter } from 'lib/filters';
import FilterLink from 'components/common/FilterLink'; import FilterLink from 'components/common/FilterLink';
import TypeIcon from 'components/common/TypeIcon';
import { useLocale } from 'components/hooks';
import { useMessages } from 'components/hooks'; import { useMessages } from 'components/hooks';
import { useFormat } from 'components/hooks'; import { useFormat } from 'components/hooks';
@ -16,7 +13,9 @@ export function CitiesTable(props: MetricsTableProps) {
<FilterLink id="city" value={city} label={formatCity(city, country)}> <FilterLink id="city" value={city} label={formatCity(city, country)}>
{country && ( {country && (
<img <img
src={`${process.env.basePath}/images/flags/${country?.toLowerCase() || 'xx'}.png`} src={`${process.env.basePath || ''}/images/country/${
country?.toLowerCase() || 'xx'
}.png`}
alt={country} alt={country}
/> />
)} )}

View File

@ -29,7 +29,6 @@ export function CountriesTable({ ...props }: MetricsTableProps) {
type="country" type="country"
metric={formatMessage(labels.visitors)} metric={formatMessage(labels.visitors)}
renderLabel={renderLink} renderLabel={renderLink}
onDataLoad={handleDataLoad}
searchFormattedValues={true} searchFormattedValues={true}
/> />
); );

View File

@ -55,22 +55,8 @@ export function MetricsTable({
const { data, isLoading, isFetched, error } = useWebsiteMetrics( const { data, isLoading, isFetched, error } = useWebsiteMetrics(
websiteId, websiteId,
{ type, limit, search, ...params }, { type, limit, search: searchFormattedValues ? undefined : search, ...params },
{ {
type,
startAt: +startDate,
endAt: +endDate,
url,
referrer,
os,
title,
browser,
device,
country,
region,
city,
limit,
search: (searchFormattedValues) ? undefined : search,
retryDelay: delay || DEFAULT_ANIMATION_DURATION, retryDelay: delay || DEFAULT_ANIMATION_DURATION,
onDataLoad, onDataLoad,
}, },