From ee61e47a86ce7b3f0a6818eae5ea9f78a78168d1 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 03:56:14 +0000 Subject: [PATCH 1/3] fix: replace target="_blank" links with Tauri opener plugin for iPhone app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace target="_blank" external links with Tauri opener plugin in SimplifiedFooter.tsx - Fix "Learn more" button in Explainer.tsx to use opener plugin - Ensure external links open in device's default browser instead of new tabs - Add fallback to window.open() for non-Tauri environments - Keep Downloads link unchanged as it works correctly with internal routing Fixes broken links that only worked with long press on iPhone app 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Marks --- frontend/src/components/Explainer.tsx | 21 ++++++++--- frontend/src/components/SimplifiedFooter.tsx | 38 +++++++++++--------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/Explainer.tsx b/frontend/src/components/Explainer.tsx index 3a34c6d2..23623183 100644 --- a/frontend/src/components/Explainer.tsx +++ b/frontend/src/components/Explainer.tsx @@ -90,14 +90,25 @@ export function InfoContent() {
- { + try { + // Use Tauri opener plugin to open external URLs in the device's default browser + const { invoke } = await import("@tauri-apps/api/core"); + await invoke("plugin:opener|open_url", { url: "https://blog.trymaple.ai" }); + } catch (error) { + // Fallback for non-Tauri environments (e.g., web) + console.warn( + "Failed to open URL with Tauri opener, falling back to window.open:", + error + ); + window.open("https://blog.trymaple.ai", "_blank", "noopener,noreferrer"); + } + }} className="text-center hover:underline font-medium text-sm" - target="_blank" - rel="noopener noreferrer" > Learn more - +
); diff --git a/frontend/src/components/SimplifiedFooter.tsx b/frontend/src/components/SimplifiedFooter.tsx index 6b4e0df7..eadca30e 100644 --- a/frontend/src/components/SimplifiedFooter.tsx +++ b/frontend/src/components/SimplifiedFooter.tsx @@ -1,17 +1,27 @@ export function SimplifiedFooter() { + const handleExternalLink = async (url: string) => { + try { + // Use Tauri opener plugin to open external URLs in the device's default browser + const { invoke } = await import("@tauri-apps/api/core"); + await invoke("plugin:opener|open_url", { url }); + } catch (error) { + // Fallback for non-Tauri environments (e.g., web) + console.warn("Failed to open URL with Tauri opener, falling back to window.open:", error); + window.open(url, "_blank", "noopener,noreferrer"); + } + }; + return (

© {new Date().getFullYear()} Maple AI. All rights reserved. Powered by{" "} - handleExternalLink("https://opensecret.cloud")} + className="text-[hsl(var(--purple))] hover:text-[hsl(var(--purple))]/80 dark:text-[hsl(var(--blue))] dark:hover:text-[hsl(var(--blue))]/80 transition-colors underline" > OpenSecret - +

Downloads - handleExternalLink("https://opensecret.cloud/terms")} className="text-[hsl(var(--marketing-text-muted))] hover:text-foreground text-sm transition-colors" > Terms of Service - - +
From 0ba13c896995e8eef17e80c12802b22103a9d370 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 04:04:04 +0000 Subject: [PATCH 2/3] refactor: extract external link handling to shared utility - Create shared openExternalLink utility function to eliminate code duplication - Add proper error handling with try-catch around window.open fallback - Add role='link' accessibility attributes to external link buttons - Update Explainer.tsx and SimplifiedFooter.tsx to use shared utility - Addresses code review feedback for better maintainability and accessibility Co-authored-by: Marks --- frontend/src/components/Explainer.tsx | 17 +++------------ frontend/src/components/SimplifiedFooter.tsx | 23 +++++++------------- frontend/src/utils/externalLinks.ts | 21 ++++++++++++++++++ 3 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 frontend/src/utils/externalLinks.ts diff --git a/frontend/src/components/Explainer.tsx b/frontend/src/components/Explainer.tsx index 23623183..4a42b2d3 100644 --- a/frontend/src/components/Explainer.tsx +++ b/frontend/src/components/Explainer.tsx @@ -3,6 +3,7 @@ import { ArrowRight, BotIcon, LockIcon, MinusIcon, ServerIcon, SmartphoneIcon } import { useEffect, useState } from "react"; import { Loader2, CheckCircle, XCircle } from "lucide-react"; import { useOpenSecret } from "@opensecret/react"; +import { openExternalLink } from "@/utils/externalLinks"; function ArrowAndLock() { return ( @@ -91,20 +92,8 @@ export function InfoContent() {