From cd52e7fb0c26b842e7eff72e35c4687823e90c97 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 22 Jun 2026 08:40:37 +0200 Subject: [PATCH] Use alias slugs for navigation in trust center Document, file, and audit rows now navigate to /documents/ when an alias is set, falling back to the resource ID otherwise. The document page query accepts a string ID to support both forms. Signed-off-by: Bryan Frimin --- apps/trust/src/components/AuditRow.tsx | 4 +++- apps/trust/src/components/DocumentRow.tsx | 4 +++- apps/trust/src/components/TrustCenterFileRow.tsx | 4 +++- apps/trust/src/pages/DocumentPage.tsx | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/trust/src/components/AuditRow.tsx b/apps/trust/src/components/AuditRow.tsx index 6a7547421..282cf6da5 100644 --- a/apps/trust/src/components/AuditRow.tsx +++ b/apps/trust/src/components/AuditRow.tsx @@ -57,6 +57,7 @@ const auditRowFragment = graphql` name reportFile { id + alias isUserAuthorized access { id @@ -84,6 +85,7 @@ export function AuditRow(props: { audit: AuditRowFragment$key }) { const navigate = useNavigate(); const audit = useFragment(auditRowFragment, props.audit); + const reportPath = audit.reportFile?.alias ?? audit.reportFile?.id; const hasRequested = audit.reportFile?.access?.status === "REQUESTED"; const [requestAccess, isRequestingAccess] @@ -146,7 +148,7 @@ export function AuditRow(props: { audit: AuditRowFragment$key }) { className="w-full md:w-max" variant="secondary" icon={IconArrowLink} - to={`/documents/${audit.reportFile.id}`} + to={reportPath ? `/documents/${reportPath}` : undefined} > {__("View")} diff --git a/apps/trust/src/components/DocumentRow.tsx b/apps/trust/src/components/DocumentRow.tsx index 36b3a4280..43e8fa0ec 100644 --- a/apps/trust/src/components/DocumentRow.tsx +++ b/apps/trust/src/components/DocumentRow.tsx @@ -49,6 +49,7 @@ const requestAccessMutation = graphql` const documentRowFragment = graphql` fragment DocumentRowFragment on Document { id + alias title isUserAuthorized access { @@ -66,6 +67,7 @@ export function DocumentRow(props: { document: DocumentRowFragment$key }) { const [searchParams] = useSearchParams(); const document = useFragment(documentRowFragment, props.document); + const documentPath = document.alias ?? document.id; const hasRequested = document.access?.status === "REQUESTED"; const [requestAccess, isRequestingAccess] @@ -127,7 +129,7 @@ export function DocumentRow(props: { document: DocumentRowFragment$key }) { className="w-full md:w-max" variant="secondary" icon={IconArrowLink} - onClick={() => void navigate(`/documents/${document.id}`)} + onClick={() => void navigate(`/documents/${documentPath}`)} > {__("View")} diff --git a/apps/trust/src/components/TrustCenterFileRow.tsx b/apps/trust/src/components/TrustCenterFileRow.tsx index d3811af5d..b7f5f4992 100644 --- a/apps/trust/src/components/TrustCenterFileRow.tsx +++ b/apps/trust/src/components/TrustCenterFileRow.tsx @@ -49,6 +49,7 @@ const requestAccessMutation = graphql` const trustCenterFileRowFragment = graphql` fragment TrustCenterFileRowFragment on TrustCenterFile { id + alias name isUserAuthorized access { @@ -68,6 +69,7 @@ export function TrustCenterFileRow(props: { const navigate = useNavigate(); const file = useFragment(trustCenterFileRowFragment, props.file); + const filePath = file.alias ?? file.id; const hasRequested = file.access?.status === "REQUESTED"; const [requestAccess, isRequestingAccess] @@ -131,7 +133,7 @@ export function TrustCenterFileRow(props: { className="w-full md:w-max" variant="secondary" icon={IconArrowLink} - onClick={() => void navigate(`/documents/${file.id}`)} + onClick={() => void navigate(`/documents/${filePath}`)} > {__("View")} diff --git a/apps/trust/src/pages/DocumentPage.tsx b/apps/trust/src/pages/DocumentPage.tsx index 536977adb..8d6898886 100644 --- a/apps/trust/src/pages/DocumentPage.tsx +++ b/apps/trust/src/pages/DocumentPage.tsx @@ -45,7 +45,7 @@ import type { DocumentPageRequestReportAccessMutation } from "./__generated__/Do import type { DocumentPageRequestTrustCenterFileAccessMutation } from "./__generated__/DocumentPageRequestTrustCenterFileAccessMutation.graphql"; export const documentPageQuery = graphql` - query DocumentPageQuery($id: ID!) { + query DocumentPageQuery($id: String!) { currentTrustCenter { logo { downloadUrl