/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ /** @jsxRuntime automatic */ /** @jsxImportSource hono/jsx */ import {DevicesIcon} from '@fluxer/marketing/src/components/icons/DevicesIcon'; import type {MarketingContext} from '@fluxer/marketing/src/MarketingContext'; export function renderPwaInstallTrigger(ctx: MarketingContext): JSX.Element { return ( ); } export function renderPwaInstallModal(ctx: MarketingContext): JSX.Element { return (

{ctx.i18n.getMessage('platform_support.mobile.install_as_app.install_fluxer_as_app', ctx.locale)}

{renderTabButton( 'android', ctx.i18n.getMessage('platform_support.platforms.android.name', ctx.locale), true, )} {renderTabButton( 'ios', ctx.i18n.getMessage('platform_support.platforms.ios.ios_ipados', ctx.locale), false, )} {renderTabButton('desktop', ctx.i18n.getMessage('platform_support.desktop.label', ctx.locale), false)}
{renderAndroidSteps(ctx)}

{ctx.i18n.getMessage('download.screenshots_courtesy_of', ctx.locale)} installpwa.com

); } function renderTabButton(id: string, label: string, active: boolean): JSX.Element { const className = active ? 'pwa-tab flex-1 px-4 py-2 text-sm font-medium rounded-lg transition-colors bg-white text-gray-900 shadow-sm' : 'pwa-tab flex-1 px-4 py-2 text-sm font-medium rounded-lg transition-colors text-gray-600 hover:text-gray-900'; return ( ); } function renderAndroidSteps(ctx: MarketingContext): JSX.Element { return (
{renderImage(ctx, 'android', '240', '320', '480')}
    {renderStep( '1', {ctx.i18n.getMessage('app.open.open_web_app', ctx.locale)} {ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.in_chrome', ctx.locale)} , )} {renderStep( '2', ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.steps.press_more_menu', ctx.locale), )} {renderStep( '3', ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.steps.press_install_app', ctx.locale), )} {renderStep('4', ctx.i18n.getMessage('platform_support.mobile.install_as_app.done_mobile', ctx.locale))}
); } function renderIosSteps(ctx: MarketingContext): JSX.Element { return (
{renderImage(ctx, 'ios', '320', '480', '640')}
    {renderStep( '1', {ctx.i18n.getMessage('app.open.open_web_app', ctx.locale)} {ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.in_safari', ctx.locale)} , )} {renderStep( '2', ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.steps.press_share_button', ctx.locale), )} {renderStep( '3', ctx.i18n.getMessage( 'platform_support.mobile.install_as_app.guides.steps.press_add_to_home_screen', ctx.locale, ), )} {renderStep( '4', ctx.i18n.getMessage( 'platform_support.mobile.install_as_app.guides.steps.press_add_upper_right', ctx.locale, ), )} {renderStep('5', ctx.i18n.getMessage('platform_support.mobile.install_as_app.done_mobile', ctx.locale))}
); } function renderDesktopSteps(ctx: MarketingContext): JSX.Element { return (
{renderImage(ctx, 'desktop', '320', '480', '640')}
    {renderStep( '1', {ctx.i18n.getMessage('app.open.open_web_app', ctx.locale)} {ctx.i18n.getMessage( 'platform_support.mobile.install_as_app.guides.in_chrome_or_another_browser', ctx.locale, )} , )} {renderStep( '2', ctx.i18n.getMessage( 'platform_support.mobile.install_as_app.guides.steps.press_install_button_address_bar', ctx.locale, ), )} {renderStep( '3', ctx.i18n.getMessage( 'platform_support.mobile.install_as_app.guides.steps.press_install_in_popup', ctx.locale, ), )} {renderStep('4', ctx.i18n.getMessage('platform_support.mobile.install_as_app.done_desktop', ctx.locale))}
); } function renderStep(number: string, content: JSX.Element | string): JSX.Element { return (
  • {number}
    {content}
  • ); } function renderImage(ctx: MarketingContext, name: string, small: string, medium: string, large: string): JSX.Element { const basePath = `${ctx.staticCdnEndpoint}/marketing/pwa-install/${name}`; const srcsetAvif = `${basePath}-${small}w.avif 1x, ${basePath}-${medium}w.avif 1.5x, ${basePath}-${large}w.avif 2x`; const srcsetWebp = `${basePath}-${small}w.webp 1x, ${basePath}-${medium}w.webp 1.5x, ${basePath}-${large}w.webp 2x`; const srcsetPng = `${basePath}-${small}w.png 1x, ${basePath}-${medium}w.png 1.5x, ${basePath}-${large}w.png 2x`; return ( {ctx.i18n.getMessage('platform_support.mobile.install_as_app.guides.pwa_installation_guide', ); }