From 364d21b37aba4680058e593923d6bb4e07b18801 Mon Sep 17 00:00:00 2001 From: Eric P Green Date: Thu, 5 Dec 2024 10:40:30 -0500 Subject: [PATCH] Embeds: Remove the "Back to home" CTA from the error page (#6210) * Embeds: Remove the "Back to home" CTA from the error page * Move function to `web-common` --- web-common/src/components/ErrorPage.svelte | 6 +++++- web-common/src/layout/navigation/navigation-utils.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/web-common/src/components/ErrorPage.svelte b/web-common/src/components/ErrorPage.svelte index 4b6b804790c..19de4c82774 100644 --- a/web-common/src/components/ErrorPage.svelte +++ b/web-common/src/components/ErrorPage.svelte @@ -1,8 +1,10 @@ @@ -23,7 +27,7 @@ {/if}

{header}

{body} - {#if !fatal} + {#if !fatal && !onEmbedPage} Back to home {/if} {#if detail} diff --git a/web-common/src/layout/navigation/navigation-utils.ts b/web-common/src/layout/navigation/navigation-utils.ts index 08ed7a6c223..786518b001c 100644 --- a/web-common/src/layout/navigation/navigation-utils.ts +++ b/web-common/src/layout/navigation/navigation-utils.ts @@ -1,11 +1,12 @@ import { appScreen } from "@rilldata/web-common/layout/app-store"; -import { get } from "svelte/store"; import { behaviourEvent } from "@rilldata/web-common/metrics/initMetrics"; import { BehaviourEventMedium } from "@rilldata/web-common/metrics/service/BehaviourEventTypes"; import { MetricsEventScreenName, MetricsEventSpace, } from "@rilldata/web-common/metrics/service/MetricsTypes"; +import type { Page } from "@sveltejs/kit"; +import { get } from "svelte/store"; export function getNavURLToScreenMap(href: string) { if (href.includes("/source/")) return MetricsEventScreenName.Source; @@ -26,3 +27,7 @@ export async function emitNavigationTelemetry(href: string, name: string) { screenName, ); } + +export function isEmbedPage(page: Page): boolean { + return page.route.id === "/-/embed"; +}