diff --git a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
index f76fa920..97cfc5da 100644
--- a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
+++ b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
@@ -1,6 +1,6 @@
import { Icon, Text, Row, NavMenu, NavMenuItem } from '@umami/react-zen';
import {
- Overview,
+ Eye,
Lightning,
User,
Clock,
@@ -24,7 +24,7 @@ export function WebsiteNav({ websiteId }: { websiteId: string }) {
{
id: 'overview',
label: formatMessage(labels.overview),
- icon: ,
+ icon: ,
path: '',
},
{
diff --git a/src/app/(main)/websites/[websiteId]/goals/Goal.tsx b/src/app/(main)/websites/[websiteId]/goals/Goal.tsx
index 3fbc5947..bfa35a24 100644
--- a/src/app/(main)/websites/[websiteId]/goals/Goal.tsx
+++ b/src/app/(main)/websites/[websiteId]/goals/Goal.tsx
@@ -16,7 +16,7 @@ import {
AlertDialog,
} from '@umami/react-zen';
import { useMessages, useResultQuery } from '@/components/hooks';
-import { Edit, More, Trash, File, Lightning, User, Eye } from '@/components/icons';
+import { Edit, More, Trash, File, Lightning, User } from '@/components/icons';
import { LoadingPanel } from '@/components/common/LoadingPanel';
import { formatLongNumber } from '@/lib/format';
import { GoalAddForm } from '@/app/(main)/websites/[websiteId]/goals/GoalAddForm';
@@ -62,7 +62,7 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
-
+
@@ -77,7 +77,9 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
{parameters.value}
- {isPage ? : }
+
+
+
{`${formatLongNumber(
data?.num,
)} / ${formatLongNumber(data?.total)}`}
@@ -99,8 +101,16 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
);
}
-const ActionsButton = ({ id, websiteId }: { id: string; websiteId: string }) => {
- const { formatMessage, labels } = useMessages();
+const ActionsButton = ({
+ id,
+ name,
+ websiteId,
+}: {
+ id: string;
+ name: string;
+ websiteId: string;
+}) => {
+ const { formatMessage, labels, messages } = useMessages();
const [showEdit, setShowEdit] = useState(false);
const [showDelete, setShowDelete] = useState(false);
const { mutate, touch } = useDeleteQuery(`/reports/${id}`);
@@ -154,7 +164,11 @@ const ActionsButton = ({ id, websiteId }: { id: string; websiteId: string }) =>
{showEdit && (
-
>
diff --git a/src/app/(main)/websites/[websiteId]/goals/GoalAddButton.tsx b/src/app/(main)/websites/[websiteId]/goals/GoalAddButton.tsx
index f092cc0d..0407147f 100644
--- a/src/app/(main)/websites/[websiteId]/goals/GoalAddButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/goals/GoalAddButton.tsx
@@ -15,7 +15,11 @@ export function GoalAddButton({ websiteId }: { websiteId: string }) {
{formatMessage(labels.addGoal)}
-
+
{({ close }) => }
diff --git a/src/app/(main)/websites/[websiteId]/goals/GoalAddForm.tsx b/src/app/(main)/websites/[websiteId]/goals/GoalAddForm.tsx
index 8bff4b56..dd1a2e9c 100644
--- a/src/app/(main)/websites/[websiteId]/goals/GoalAddForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/goals/GoalAddForm.tsx
@@ -10,7 +10,6 @@ import {
Radio,
Text,
Icon,
- Loading,
} from '@umami/react-zen';
import { useApi, useMessages, useModified, useReportQuery } from '@/components/hooks';
import { File, Lightning } from '@/components/icons';
@@ -54,7 +53,7 @@ export function GoalAddForm({
};
if (id && !data) {
- return ;
+ return null;
}
return (
diff --git a/src/components/hooks/queries/useReportQuery.ts b/src/components/hooks/queries/useReportQuery.ts
index b4cad2a0..c544491a 100644
--- a/src/components/hooks/queries/useReportQuery.ts
+++ b/src/components/hooks/queries/useReportQuery.ts
@@ -12,5 +12,6 @@ export function useReportQuery(reportId: string) {
...data,
});
},
+ enabled: !!reportId,
});
}
diff --git a/src/components/hooks/queries/useReportsQuery.ts b/src/components/hooks/queries/useReportsQuery.ts
index 3fafe1cd..5754fd1e 100644
--- a/src/components/hooks/queries/useReportsQuery.ts
+++ b/src/components/hooks/queries/useReportsQuery.ts
@@ -4,23 +4,12 @@ import { useModified } from '../useModified';
export function useReportsQuery({ websiteId, teamId }: { websiteId?: string; teamId?: string }) {
const { modified } = useModified(`reports`);
- const { get, del, useMutation } = useApi();
- const queryResult = usePagedQuery({
+ const { get } = useApi();
+
+ return usePagedQuery({
queryKey: ['reports', { websiteId, teamId, modified }],
queryFn: (params: any) => {
return get('/reports', { websiteId, teamId, ...params });
},
});
- const { mutate } = useMutation({ mutationFn: (reportId: string) => del(`/reports/${reportId}`) });
-
- const deleteReport = (reportId: any) => {
- mutate(reportId, {
- onSuccess: () => {},
- });
- };
-
- return {
- ...queryResult,
- deleteReport,
- };
}
diff --git a/src/components/hooks/usePagedQuery.ts b/src/components/hooks/usePagedQuery.ts
index f0d76075..06b0e211 100644
--- a/src/components/hooks/usePagedQuery.ts
+++ b/src/components/hooks/usePagedQuery.ts
@@ -12,7 +12,7 @@ export function usePagedQuery({
const { query: queryParams } = useNavigation();
const [params, setParams] = useState({
search: '',
- page: +queryParams.page || 1,
+ page: +queryParams?.page || 1,
});
const { useQuery } = useApi();
diff --git a/src/queries/sql/reports/getGoal.ts b/src/queries/sql/reports/getGoal.ts
index 2a0b49e5..0def8bcd 100644
--- a/src/queries/sql/reports/getGoal.ts
+++ b/src/queries/sql/reports/getGoal.ts
@@ -30,7 +30,7 @@ async function relationalQuery(websiteId: string, criteria: GoalCriteria) {
`
select count(*) as num,
(
- select count(${isPage ? '*' : 'distinct session_id'})
+ select count(distinct session_id)
from website_event
where website_id = {websiteId:UUID}
and event_type = ${eventType}
@@ -59,10 +59,9 @@ async function clickhouseQuery(websiteId: string, criteria: GoalCriteria) {
`
select count(*) as num,
(
- select count(${isPage ? '*' : 'distinct session_id'})
+ select count(distinct session_id)
from website_event
where website_id = {websiteId:UUID}
- and event_type = ${eventType}
${dateQuery}
) as total
from website_event