Fix session avatar href
This commit is contained in:
1 parent
26ced6cdf2
commit
163e46d1f1
3 files changed
+14
-20
No files matched your search
@@ -4,20 +4,17 @@ import { SessionsTable } from './SessionsTable';
|
||||
|
||||
export function SessionsDataTable({ websiteId }: { websiteId: string }) {
|
||||
const queryResult = useWebsiteSessionsQuery(websiteId);
|
||||
const { pathname } = useNavigation();
|
||||
const isSharePage = pathname.includes('/share/');
|
||||
const { updateParams } = useNavigation();
|
||||
|
||||
return (
|
||||
<DataGrid query={queryResult} allowPaging allowSearch>
|
||||
{({ data }) => {
|
||||
return (
|
||||
<SessionsTable
|
||||
data={data}
|
||||
websiteId={websiteId}
|
||||
getSessionHref={isSharePage ? () => undefined : undefined}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
{({ data }) => (
|
||||
<SessionsTable
|
||||
data={data}
|
||||
websiteId={websiteId}
|
||||
getSessionHref={row => updateParams({ session: row.id })}
|
||||
/>
|
||||
)}
|
||||
</DataGrid>
|
||||
);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteContro
|
||||
import { Panel } from '@/components/common/Panel';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
import { getItem, setItem } from '@/lib/storage';
|
||||
import { SessionModal } from './SessionModal';
|
||||
import { SessionProperties } from './SessionProperties';
|
||||
import { SessionsDataTable } from './SessionsDataTable';
|
||||
|
||||
@@ -22,6 +23,7 @@ export function SessionsPage({ websiteId }) {
|
||||
return (
|
||||
<Column gap="3">
|
||||
<WebsiteControls websiteId={websiteId} />
|
||||
<SessionModal websiteId={websiteId} />
|
||||
<Panel>
|
||||
<Tabs selectedKey={tab} onSelectionChange={handleSelect}>
|
||||
<TabList>
|
||||
|
||||
@@ -16,16 +16,11 @@ export function SessionsTable({
|
||||
return (
|
||||
<DataTable {...props}>
|
||||
<DataColumn id="id" label={t(labels.session)} width="100px">
|
||||
{(row: any) => {
|
||||
const href = getSessionHref ? getSessionHref(row) : `/websites/${websiteId}/sessions/${row.id}`;
|
||||
return href ? (
|
||||
<Link href={href}>
|
||||
<Avatar seed={row.id} size={32} />
|
||||
</Link>
|
||||
) : (
|
||||
{(row: any) => (
|
||||
<Link href={getSessionHref ? getSessionHref(row) : `/websites/${websiteId}/sessions/${row.id}`}>
|
||||
<Avatar seed={row.id} size={32} />
|
||||
);
|
||||
}}
|
||||
</Link>
|
||||
)}
|
||||
</DataColumn>
|
||||
<DataColumn id="visits" label={t(labels.visits)} width="80px" />
|
||||
<DataColumn id="views" label={t(labels.views)} width="80px" />
|
||||
|
||||
Reference in new issue
Block a user