diff --git a/packages/shared/src/api.ts b/packages/shared/src/api.ts index dc1f282..fdc3083 100644 --- a/packages/shared/src/api.ts +++ b/packages/shared/src/api.ts @@ -107,6 +107,8 @@ export interface ReportDetail extends ReportListItem { attachments: Attachment[]; steps: RecordingStep[]; + /** present on the detail GET — lets the panel link back to the project */ + project_share_token?: string | null; } export interface ReportList { diff --git a/packages/web/src/pages/ReportPage.vue b/packages/web/src/pages/ReportPage.vue index 8cd7466..dd3afa9 100644 --- a/packages/web/src/pages/ReportPage.vue +++ b/packages/web/src/pages/ReportPage.vue @@ -209,6 +209,20 @@ } } +/** + * Back navigation: in-app history means a plain back; a cold share-link visit + * has none, so fall back to the report's project page (then the projects list). + */ +function goBack() { + if (window.history.state?.back != null) { + router.back(); + } else if (report.value?.project_share_token) { + router.push(`/p/${report.value.project_share_token}`); + } else { + router.push("/"); + } +} + function statusVariant(status: string) { return status === "open" ? "warning" : status === "fixed" ? "success" : "secondary"; } @@ -255,13 +269,14 @@