Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Merge branch 'dev' into search-formatted-metrics

Mike Cao4ab8b1ff9171
diff --cc src/components/hooks/useFormat.ts
index 2316e7329,631b3f03b..100307216
--- a/src/components/hooks/useFormat.ts
+++ b/src/components/hooks/useFormat.ts
@@@ -8,8 -7,7 +8,8 @@@ import regions from '../../../public/is
export function useFormat() {
const { formatMessage, labels } = useMessages();
const { locale } = useLocale();
- const countryNames = useCountryNames(locale);
- const languageNames = useLanguageNames(locale);
+ const { countryNames } = useCountryNames(locale);
++ const { languageNames } = useLanguageNames(locale);
const formatOS = (value: string): string => {
return OS_NAMES[value] || value;
diff --cc src/components/metrics/CitiesTable.tsx
index fbbcafa69,b3573b5c3..61624f6a1
--- a/src/components/metrics/CitiesTable.tsx
+++ b/src/components/metrics/CitiesTable.tsx
@@@ -1,12 -1,20 +1,15 @@@
import MetricsTable, { MetricsTableProps } from './MetricsTable';
import { emptyFilter } from 'lib/filters';
import FilterLink from 'components/common/FilterLink';
++
+ import TypeIcon from 'components/common/TypeIcon';
+ import { useLocale } from 'components/hooks';
import { useMessages } from 'components/hooks';
-import { useCountryNames } from 'components/hooks';
+import { useFormat } from 'components/hooks';
export function CitiesTable(props: MetricsTableProps) {
- const { locale } = useLocale();
const { formatMessage, labels } = useMessages();
- const { countryNames } = useCountryNames(locale);
-
- const renderLabel = (city: string, country: string) => {
- const countryName = countryNames[country];
- return countryName ? `${city}, ${countryName}` : city;
- };
+ const { formatCity } = useFormat();
const renderLink = ({ x: city, country }) => {
return (
diff --cc src/components/metrics/MetricsTable.tsx
index 87779f947,4ca3ff522..f8bc4df39
--- a/src/components/metrics/MetricsTable.tsx
+++ b/src/components/metrics/MetricsTable.tsx
@@@ -28,7 -26,8 +26,9 @@@ export interface MetricsTableProps exte
onDataLoad?: (data: any) => void;
onSearch?: (search: string) => void;
allowSearch?: boolean;
+ searchFormattedValues?: boolean;
+ showMore?: boolean;
+ params?: { [key: string]: any };
children?: ReactNode;
}
@@@ -41,7 -40,8 +41,9 @@@ export function MetricsTable(
onDataLoad,
delay = null,
allowSearch = false,
+ searchFormattedValues = false,
+ showMore = true,
+ params,
children,
...props
}: MetricsTableProps) {
@@@ -57,23 -53,11 +55,25 @@@
const { data, isLoading, isFetched, error } = useWebsiteMetrics(
websiteId,
+ { type, limit, 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,
+ onDataLoad,
},
- { retryDelay: delay || DEFAULT_ANIMATION_DURATION, onDataLoad },
);
const filteredData = useMemo(() => {