mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Fixed insights report.
This commit is contained in:
parent
d0e1912faf
commit
e068ac0dd9
@ -99,7 +99,7 @@
|
|||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"prisma": "5.6.0",
|
"prisma": "5.6.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-basics": "^0.109.0",
|
"react-basics": "^0.110.0",
|
||||||
"react-beautiful-dnd": "^13.1.0",
|
"react-beautiful-dnd": "^13.1.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-error-boundary": "^4.0.4",
|
"react-error-boundary": "^4.0.4",
|
||||||
|
@ -37,10 +37,10 @@ export function InsightsTable() {
|
|||||||
width="100px"
|
width="100px"
|
||||||
alignment="end"
|
alignment="end"
|
||||||
>
|
>
|
||||||
{row => row.visitors.toLocaleString()}
|
{row => row?.visitors?.toLocaleString()}
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
<GridColumn name="views" label={formatMessage(labels.views)} width="100px" alignment="end">
|
<GridColumn name="views" label={formatMessage(labels.views)} width="100px" alignment="end">
|
||||||
{row => row.views.toLocaleString()}
|
{row => row?.views?.toLocaleString()}
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
</GridTable>
|
</GridTable>
|
||||||
);
|
);
|
||||||
|
@ -9,23 +9,23 @@ export function useFormat() {
|
|||||||
const { locale } = useLocale();
|
const { locale } = useLocale();
|
||||||
const countryNames = useCountryNames(locale);
|
const countryNames = useCountryNames(locale);
|
||||||
|
|
||||||
const formatBrowser = (value: string) => {
|
const formatBrowser = (value: string): string => {
|
||||||
return BROWSERS[value] || value;
|
return BROWSERS[value] || value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatCountry = (value: string) => {
|
const formatCountry = (value: string): string => {
|
||||||
return countryNames[value] || value;
|
return countryNames[value] || value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatRegion = (value: string) => {
|
const formatRegion = (value: string): string => {
|
||||||
return regions[value] ? regions[value] : value;
|
return regions[value] ? regions[value] : value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDevice = (value: string) => {
|
const formatDevice = (value: string): string => {
|
||||||
return formatMessage(labels[value] || labels.unknown);
|
return formatMessage(labels[value] || labels.unknown);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatValue = (value: string, type: string) => {
|
const formatValue = (value: string, type: string): string => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'browser':
|
case 'browser':
|
||||||
return formatBrowser(value);
|
return formatBrowser(value);
|
||||||
|
@ -55,7 +55,7 @@ const schema = {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
function convertFilters(filters) {
|
function convertFilters(filters: any[]) {
|
||||||
return filters.reduce((obj, { name, ...value }) => {
|
return filters.reduce((obj, { name, ...value }) => {
|
||||||
obj[name] = value;
|
obj[name] = value;
|
||||||
|
|
||||||
|
@ -86,8 +86,9 @@ async function clickhouseQuery(
|
|||||||
).then(a => {
|
).then(a => {
|
||||||
return Object.values(a).map(a => {
|
return Object.values(a).map(a => {
|
||||||
return {
|
return {
|
||||||
x: a.x,
|
...a,
|
||||||
y: Number(a.y),
|
views: Number(a.views),
|
||||||
|
visitors: Number(a.visitors),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -7476,10 +7476,10 @@ rc@^1.2.7:
|
|||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
strip-json-comments "~2.0.1"
|
strip-json-comments "~2.0.1"
|
||||||
|
|
||||||
react-basics@^0.109.0:
|
react-basics@^0.110.0:
|
||||||
version "0.109.0"
|
version "0.110.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.109.0.tgz#9c1f41ebf6abbcf67f7dd11a16a7fb5e3aedd38d"
|
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.110.0.tgz#7b7689edcb96b973528abc91b964345edc6e000a"
|
||||||
integrity sha512-n955CwqIeQ/sTMxxvbtYpWtBWS07Rg39zrNKeUYN/JoCIq0YbbZiZDALAhh1Out+qsIe62NoOFA7JtHzk1EkHQ==
|
integrity sha512-3XQx5hR0zTuEAxDDHyaqS2GfXOowb0Lri8ay65kjGUd7RmvdpnIr62MsrAwo62rtTwtzRzsJXHJCR5CKQ/D3rQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@react-spring/web" "^9.7.3"
|
"@react-spring/web" "^9.7.3"
|
||||||
classnames "^2.3.1"
|
classnames "^2.3.1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user