Fix build errors, remove active users link on share page.

This commit is contained in:
Francis Cao committed 2026-04-20 08:51:56 -07:00
1 parent b3c4b70991
commit 0bd5e70df7
4 files changed
+27 -16

No files matched your search

@@ -1,7 +1,7 @@
import type { ReactQueryOptions } from '@/lib/types';
import { useApi } from '../useApi';
export function useActyiveUsersQuery(websiteId: string, options?: ReactQueryOptions) {
export function useActiveUsersQuery(websiteId: string, options?: ReactQueryOptions) {
const { get, useQuery } = useApi();
return useQuery<any>({
queryKey: ['websites:active', websiteId],
+15 -9
View File
@@ -7,17 +7,19 @@ export function ActiveUsers({
websiteId,
value,
refetchInterval = 60000,
allowLink = true,
}: {
websiteId: string;
value?: number;
refetchInterval?: number;
allowLink?: boolean;
}) {
const { t, labels } = useMessages();
const { data } = useActiveUsersQuery(websiteId, { refetchInterval });
const count = useMemo(() => {
if (websiteId) {
return data?.visitors || 0;
return data?.visitors || 10;
}
return value !== undefined ? value : 0;
@@ -27,13 +29,17 @@ export function ActiveUsers({
return null;
}
return (
<Link href={`/websites/${websiteId}/realtime`}>
<StatusLight variant="success">
<Text size="sm" weight="medium">
{count} {t(labels.online)}
</Text>
</StatusLight>
</Link>
const content = (
<StatusLight variant="success">
<Text size="sm" weight="medium">
{count} {t(labels.online)}
</Text>
</StatusLight>
);
if (!allowLink) {
return content;
}
return <Link href={`/websites/${websiteId}/realtime`}>{content}</Link>;
}