import { GscBreakdownTable } from '@/components/page/gsc-breakdown-table'; import { GscClicksChart } from '@/components/page/gsc-clicks-chart'; import { PageViewsChart } from '@/components/page/page-views-chart'; import { SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; type Props = { type: 'page' | 'query'; projectId: string; value: string; }; export default function PageDetails({ type, projectId, value }: Props) { return ( {value}
{type === 'page' && (() => { let origin: string; let path: string; try { const url = new URL(value); origin = url.origin; path = url.pathname + url.search; } catch { // value is path-only (e.g. "/docs/foo") origin = typeof window !== 'undefined' ? window.location.origin : ''; path = value; } return ( ); })()}
); }