From e7c488af63d3cabe5e6cd84718065a6fc53b62c8 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Tue, 2 Jun 2026 08:40:58 -0500 Subject: [PATCH] Add Zapstore app download nudge Prompt mobile-web visitors to install the native Android app from Zapstore. Shows a card at the bottom of the home feed and a link in the account switcher menu. Both are hidden inside the native app (Capacitor.isNativePlatform) and on desktop (sm:hidden for the banner). Adds nav.getApp and feed.getApp.* strings across all locales. --- src/components/AppDownloadNudge.tsx | 49 +++++++++++++++++++++++++ src/components/auth/AccountSwitcher.tsx | 12 +++++- src/lib/zapstore.ts | 5 +++ src/locales/ar.json | 9 ++++- src/locales/en.json | 9 ++++- src/locales/es.json | 9 ++++- src/locales/fa.json | 9 ++++- src/locales/fr.json | 9 ++++- src/locales/hi.json | 9 ++++- src/locales/id.json | 9 ++++- src/locales/km.json | 9 ++++- src/locales/ps.json | 9 ++++- src/locales/pt.json | 9 ++++- src/locales/ru.json | 9 ++++- src/locales/sn.json | 9 ++++- src/locales/sw.json | 9 ++++- src/locales/tr.json | 9 ++++- src/locales/zh-Hant.json | 9 ++++- src/locales/zh.json | 9 ++++- src/pages/Index.tsx | 8 +++- 20 files changed, 200 insertions(+), 18 deletions(-) create mode 100644 src/components/AppDownloadNudge.tsx create mode 100644 src/lib/zapstore.ts diff --git a/src/components/AppDownloadNudge.tsx b/src/components/AppDownloadNudge.tsx new file mode 100644 index 00000000..234d6f5d --- /dev/null +++ b/src/components/AppDownloadNudge.tsx @@ -0,0 +1,49 @@ +import { Capacitor } from '@capacitor/core'; +import { useTranslation } from 'react-i18next'; +import { ArrowRight } from 'lucide-react'; +import { useAppContext } from '@/hooks/useAppContext'; +import { ZAPSTORE_URL } from '@/lib/zapstore'; + +/** + * Zapstore download nudge — prompts mobile-web visitors to install the native + * Android app. Hidden inside the native app (you're already in it) and on + * desktop (`sm:hidden`), where downloading works differently. + */ +export function AppDownloadNudge() { + const { t } = useTranslation(); + const { config } = useAppContext(); + + if (Capacitor.isNativePlatform()) return null; + + return ( +
+

+ {t('feed.getApp.eyebrow')} +

+
+ {config.appName} +
+

+ {t('feed.getApp.title', { appName: config.appName })} +

+

+ {t('feed.getApp.subtitle', { appName: config.appName })} +

+
+ + {t('feed.getApp.download')} + + +
+
+ ); +} diff --git a/src/components/auth/AccountSwitcher.tsx b/src/components/auth/AccountSwitcher.tsx index 684243fd..255edec6 100644 --- a/src/components/auth/AccountSwitcher.tsx +++ b/src/components/auth/AccountSwitcher.tsx @@ -7,8 +7,10 @@ import { useState } from 'react'; import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { Activity, Bell, ChevronDown, CircleHelp, LayoutDashboard, LogOut, Search, Settings, User, UserIcon, UserPlus, Wallet } from 'lucide-react'; +import { Capacitor } from '@capacitor/core'; +import { Activity, Bell, ChevronDown, CircleHelp, Download, LayoutDashboard, LogOut, Search, Settings, User, UserIcon, UserPlus, Wallet } from 'lucide-react'; import { nip19 } from 'nostr-tools'; +import { ZAPSTORE_URL } from '@/lib/zapstore'; import { DropdownMenu, DropdownMenuContent, @@ -144,6 +146,14 @@ export function AccountSwitcher({ onAddAccountClick }: AccountSwitcherProps) { {t('nav.about')} + {!Capacitor.isNativePlatform() && ( + + + + {t('nav.getApp')} + + + )} { @@ -12,7 +13,12 @@ const Index = () => { description: t('feed.indexTagline'), }); - return ; + return ( + <> + + + + ); }; export default Index;