Use TanStack links for internal table and shell navigation (#215)

* Use TanStack Link for audit issues and external RD links

* Use router link for billing menu

* Fix brand lookup tooltip clipping
This commit is contained in:
Ben Senescu 2026-05-22 21:29:45 -04:00 committed by GitHub
parent 10b77682d9
commit 44073498ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 16 deletions

View File

@ -112,7 +112,7 @@ function BrandHeader({ result }: { result: BrandLookupResult }) {
function KpiTiles({ result }: { result: BrandLookupResult }) { function KpiTiles({ result }: { result: BrandLookupResult }) {
return ( return (
<section className="flex flex-col divide-y divide-base-200 overflow-hidden rounded-xl border border-base-300 bg-base-100"> <section className="flex flex-col divide-y divide-base-200 rounded-xl border border-base-300 bg-base-100">
<KpiTile <KpiTile
label="Total mentions" label="Total mentions"
tooltip="Number of LLM answers where your domain appeared in the text or citations." tooltip="Number of LLM answers where your domain appeared in the text or citations."
@ -194,7 +194,7 @@ function PlatformStatRow({
{formatPlatformLabel(row.platform)} {formatPlatformLabel(row.platform)}
{row.platform === "chat_gpt" ? ( {row.platform === "chat_gpt" ? (
<span <span
className="tooltip tooltip-right inline-flex" className="tooltip tooltip-right z-20 inline-flex"
data-tip="DataForSEO indexes ChatGPT mentions for US English only — country selection is not available for this platform." data-tip="DataForSEO indexes ChatGPT mentions for US English only — country selection is not available for this platform."
> >
<Info className="size-3 text-base-content/40" /> <Info className="size-3 text-base-content/40" />

View File

@ -4,6 +4,7 @@ import {
type ColumnDef, type ColumnDef,
type SortingState, type SortingState,
} from "@tanstack/react-table"; } from "@tanstack/react-table";
import { Link } from "@tanstack/react-router";
import { ExternalLink } from "lucide-react"; import { ExternalLink } from "lucide-react";
import { import {
AppDataTable, AppDataTable,
@ -330,12 +331,14 @@ function buildPerformanceColumns({
header: () => "Issues", header: () => "Issues",
cell: ({ row }) => cell: ({ row }) =>
row.original.r2Key && !isLighthouseFailure(row.original) ? ( row.original.r2Key && !isLighthouseFailure(row.original) ? (
<a <Link
className="btn btn-primary btn-xs" className="btn btn-primary btn-xs"
href={`/p/${projectId}/audit/issues/${row.original.id}?auditId=${auditId}&category=performance`} to="/p/$projectId/audit/issues/$resultId"
params={{ projectId, resultId: row.original.id }}
search={{ auditId, category: "performance" }}
> >
View issues View issues
</a> </Link>
) : ( ) : (
<span className="text-xs text-base-content/40">-</span> <span className="text-xs text-base-content/40">-</span>
), ),

View File

@ -3,7 +3,6 @@ import {
type SortingFn, type SortingFn,
type SortingState, type SortingState,
} from "@tanstack/react-table"; } from "@tanstack/react-table";
import { Link } from "@tanstack/react-router";
import { useState } from "react"; import { useState } from "react";
import { import {
AppDataTable, AppDataTable,
@ -24,6 +23,7 @@ import {
formatDecimal, formatDecimal,
formatNumber, formatNumber,
} from "./backlinksPageUtils"; } from "./backlinksPageUtils";
import { BacklinksExternalLink } from "./BacklinksPageLinks";
type ReferringDomainRow = BacklinksOverviewData["referringDomains"][number]; type ReferringDomainRow = BacklinksOverviewData["referringDomains"][number];
@ -60,14 +60,11 @@ const columns = [
const domain = getValue(); const domain = getValue();
if (!domain) return "-"; if (!domain) return "-";
return ( return (
<Link <BacklinksExternalLink
from="/p/$projectId/backlinks" url={getDomainWebsiteHref(domain)}
to="/p/$projectId/backlinks" label={domain}
search={{ target: domain, scope: "domain", tab: undefined }} className="link link-primary link-hover break-all inline-flex items-center gap-1"
className="link link-primary link-hover break-all" />
>
{domain}
</Link>
); );
}, },
sortingFn: stringNullsLast, sortingFn: stringNullsLast,
@ -157,6 +154,14 @@ const columns = [
const DEFAULT_SORTING: SortingState = [{ id: "backlinks", desc: true }]; const DEFAULT_SORTING: SortingState = [{ id: "backlinks", desc: true }];
function getDomainWebsiteHref(domain: string) {
try {
return new URL(domain).toString();
} catch {
return `https://${domain}`;
}
}
export function ReferringDomainsTable({ export function ReferringDomainsTable({
rows, rows,
}: { }: {

View File

@ -338,10 +338,10 @@ function AccountMenu({ mobileOnly = false }: { mobileOnly?: boolean }) {
) : null} ) : null}
{isHostedMode ? ( {isHostedMode ? (
<li> <li>
<a href={BILLING_ROUTE} className="flex items-center gap-2"> <Link to={BILLING_ROUTE} className="flex items-center gap-2">
<CreditCard className="h-4 w-4" /> <CreditCard className="h-4 w-4" />
Billing Billing
</a> </Link>
</li> </li>
) : null} ) : null}
<li> <li>