sharePage hotfix
This commit is contained in:
@@ -1,14 +1,22 @@
|
|||||||
import { DataGrid } from '@/components/common/DataGrid';
|
import { DataGrid } from '@/components/common/DataGrid';
|
||||||
import { useWebsiteSessionsQuery } from '@/components/hooks';
|
import { useNavigation, useWebsiteSessionsQuery } from '@/components/hooks';
|
||||||
import { SessionsTable } from './SessionsTable';
|
import { SessionsTable } from './SessionsTable';
|
||||||
|
|
||||||
export function SessionsDataTable({ websiteId }: { websiteId: string }) {
|
export function SessionsDataTable({ websiteId }: { websiteId: string }) {
|
||||||
const queryResult = useWebsiteSessionsQuery(websiteId);
|
const queryResult = useWebsiteSessionsQuery(websiteId);
|
||||||
|
const { pathname } = useNavigation();
|
||||||
|
const isSharePage = pathname.includes('/share/');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataGrid query={queryResult} allowPaging allowSearch>
|
<DataGrid query={queryResult} allowPaging allowSearch>
|
||||||
{({ data }) => {
|
{({ data }) => {
|
||||||
return <SessionsTable data={data} websiteId={websiteId} />;
|
return (
|
||||||
|
<SessionsTable
|
||||||
|
data={data}
|
||||||
|
websiteId={websiteId}
|
||||||
|
getSessionHref={isSharePage ? () => undefined : undefined}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,15 +16,16 @@ export function SessionsTable({
|
|||||||
return (
|
return (
|
||||||
<DataTable {...props}>
|
<DataTable {...props}>
|
||||||
<DataColumn id="id" label={t(labels.session)} width="100px">
|
<DataColumn id="id" label={t(labels.session)} width="100px">
|
||||||
{(row: any) => (
|
{(row: any) => {
|
||||||
<Link
|
const href = getSessionHref ? getSessionHref(row) : `/websites/${websiteId}/sessions/${row.id}`;
|
||||||
href={
|
return href ? (
|
||||||
getSessionHref ? getSessionHref(row) : `/websites/${websiteId}/sessions/${row.id}`
|
<Link href={href}>
|
||||||
}
|
<Avatar seed={row.id} size={32} />
|
||||||
>
|
</Link>
|
||||||
|
) : (
|
||||||
<Avatar seed={row.id} size={32} />
|
<Avatar seed={row.id} size={32} />
|
||||||
</Link>
|
);
|
||||||
)}
|
}}
|
||||||
</DataColumn>
|
</DataColumn>
|
||||||
<DataColumn id="visits" label={t(labels.visits)} width="80px" />
|
<DataColumn id="visits" label={t(labels.visits)} width="80px" />
|
||||||
<DataColumn id="views" label={t(labels.views)} width="80px" />
|
<DataColumn id="views" label={t(labels.views)} width="80px" />
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export function SharePage() {
|
|||||||
<PageBody gap>
|
<PageBody gap>
|
||||||
<WebsiteProvider websiteId={websiteId}>
|
<WebsiteProvider websiteId={websiteId}>
|
||||||
<Column>
|
<Column>
|
||||||
<WebsiteHeader showActions={false} />
|
<WebsiteHeader showActions={false} allowLink={false} />
|
||||||
<PageComponent websiteId={websiteId} />
|
<PageComponent websiteId={websiteId} />
|
||||||
</Column>
|
</Column>
|
||||||
</WebsiteProvider>
|
</WebsiteProvider>
|
||||||
|
|||||||
Reference in New Issue
Block a user