From 9946dff29dbe4eba8f199f440a0bca2b57bce437 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 28 Jan 2026 11:52:30 +0530 Subject: [PATCH] feat: Hide tooltip based on domain --- src/lib/components/ExternalLinkWrapper.svelte | 44 ++++++++++--------- src/lib/components/McWrapper.svelte | 13 ++++-- src/lib/util/util.ts | 2 +- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/lib/components/ExternalLinkWrapper.svelte b/src/lib/components/ExternalLinkWrapper.svelte index be0c885c..1345ebd0 100644 --- a/src/lib/components/ExternalLinkWrapper.svelte +++ b/src/lib/components/ExternalLinkWrapper.svelte @@ -11,7 +11,8 @@ side = 'bottom', labelPrefix = 'Opens your diagram in', isVisible = true, - sharesData = true + sharesData = true, + showPopup = true }: { children: Snippet; domain: string; @@ -20,6 +21,7 @@ labelPrefix?: string; isVisible?: boolean; sharesData?: boolean; + showPopup?: boolean; } = $props(); let shouldDisableComponent = $derived( @@ -35,25 +37,27 @@ {@render children()} - -
- {#if shouldDisableComponent} -
- This diagram type is not supported in {domain} -
- {:else} - - - {labelPrefix} -
{domain}
-
- {/if} -
-
+ {#if showPopup} + +
+ {#if shouldDisableComponent} +
+ This diagram type is not supported in {domain} +
+ {:else} + + + {labelPrefix} +
{domain}
+
+ {/if} +
+
+ {/if} {/if} diff --git a/src/lib/components/McWrapper.svelte b/src/lib/components/McWrapper.svelte index 6dcd525a..50911d37 100644 --- a/src/lib/components/McWrapper.svelte +++ b/src/lib/components/McWrapper.svelte @@ -6,12 +6,19 @@ let { children, ...props - }: Omit, 'isVisible' | 'domain'> = $props(); + }: Omit< + ComponentProps, + 'isVisible' | 'domain' | 'showPopup' + > = $props(); + + const mermaidChartDomain = 'mermaid.ai'; + const isMermaidAiDomain = env.domain === mermaidChartDomain; + domain={mermaidChartDomain} + isVisible={env.isEnabledMermaidChartLinks} + showPopup={!isMermaidAiDomain}> {@render children()} diff --git a/src/lib/util/util.ts b/src/lib/util/util.ts index a3702419..08552c55 100644 --- a/src/lib/util/util.ts +++ b/src/lib/util/util.ts @@ -35,7 +35,7 @@ export const initHandler = async (): Promise => { export const isMac = navigator.platform.toUpperCase().includes('MAC'); export const cmdKey = isMac ? 'Cmd' : 'Ctrl'; export const MCBaseURL = env.isEnabledMermaidChartLinks - ? 'https://mermaidchart.com' // 'http://localhost:5174' + ? 'https://mermaid.ai' // 'http://localhost:5174' : 'https://example.com'; let count = 0;