Updates for cloud mode.
Some checks failed
Node.js CI / build (postgresql, 18.18) (push) Has been cancelled

This commit is contained in:
Mike Cao 2025-09-04 20:27:42 -07:00
parent dc1736458b
commit f40e1b44f3
51 changed files with 251 additions and 173 deletions

View file

@ -16,7 +16,7 @@ export function WebsiteProvider({
const { data: website, isFetching, isLoading } = useWebsiteQuery(websiteId);
if (isFetching && isLoading) {
return <Loading position="page" />;
return <Loading placement="absolute" />;
}
if (!website) {

View file

@ -1,6 +1,7 @@
import Link from 'next/link';
import { WebsitesTable } from './WebsitesTable';
import { DataGrid } from '@/components/common/DataGrid';
import { useUserWebsitesQuery } from '@/components/hooks';
import { useNavigation, useUserWebsitesQuery } from '@/components/hooks';
export function WebsitesDataTable({
teamId,
@ -14,16 +15,21 @@ export function WebsitesDataTable({
showActions?: boolean;
}) {
const queryResult = useUserWebsitesQuery({ teamId });
const { renderUrl } = useNavigation();
const renderLink = (row: any) => (
<Link href={renderUrl(`/websites/${row.id}`, false)}>{row.name}</Link>
);
return (
<DataGrid query={queryResult} allowSearch allowPaging>
{({ data }) => (
<WebsitesTable
teamId={teamId}
data={data}
showActions={showActions}
allowEdit={allowEdit}
allowView={allowView}
renderLink={renderLink}
/>
)}
</DataGrid>

View file

@ -3,27 +3,24 @@ import { Row, Text, Icon, DataTable, DataColumn, MenuItem } from '@umami/react-z
import { useMessages, useNavigation } from '@/components/hooks';
import { MenuButton } from '@/components/input/MenuButton';
import { Eye, SquarePen } from '@/components/icons';
import Link from 'next/link';
export interface WebsitesTableProps {
data: Record<string, any>[];
showActions?: boolean;
allowEdit?: boolean;
allowView?: boolean;
teamId?: string;
children?: ReactNode;
}
export function WebsitesTable({
data = [],
showActions,
allowEdit,
allowView,
renderLink,
children,
}: WebsitesTableProps) {
}: {
data: Record<string, any>[];
showActions?: boolean;
allowEdit?: boolean;
allowView?: boolean;
renderLink?: (row: any) => ReactNode;
children?: ReactNode;
}) {
const { formatMessage, labels } = useMessages();
const { renderUrl, pathname } = useNavigation();
const isSettings = pathname.includes('/settings');
const { renderUrl } = useNavigation();
if (!data?.length) {
return children;
@ -32,11 +29,7 @@ export function WebsitesTable({
return (
<DataTable data={data}>
<DataColumn id="name" label={formatMessage(labels.name)}>
{(row: any) => (
<Link href={renderUrl(`${isSettings ? '/settings' : ''}/websites/${row.id}`, false)}>
{row.name}
</Link>
)}
{renderLink}
</DataColumn>
<DataColumn id="domain" label={formatMessage(labels.domain)} />
{showActions && (

View file

@ -50,7 +50,7 @@ export function FunnelEditForm({
};
if (id && !data) {
return <Loading position="page" />;
return <Loading placement="absolute" />;
}
const defaultValues = {

View file

@ -44,7 +44,7 @@ export function GoalEditForm({
};
if (id && !data) {
return <Loading position="page" />;
return <Loading placement="absolute" />;
}
const defaultValues = {

View file

@ -52,7 +52,7 @@ export function CohortEditForm({
};
if (cohortId && !data) {
return <Loading position="page" />;
return <Loading placement="absolute" />;
}
const defaultValues = {

View file

@ -49,7 +49,7 @@ export function SegmentEditForm({
};
if (segmentId && !data) {
return <Loading position="page" />;
return <Loading placement="absolute" />;
}
return (

View file

@ -64,7 +64,7 @@ export function WebsiteTransferForm({
};
if (isLoading) {
return <Loading icon="dots" position="center" />;
return <Loading icon="dots" placement="center" />;
}
return (