import { Button } from '@/components/ui/button' import { DESKTOP_APP_DOWNLOAD_URL_DEFAULT } from '@/constants' import { cn } from '@/lib/utils' import { Download } from 'lucide-react' import { useTranslation } from 'react-i18next' function resolveDesktopDownloadUrl(): string | null { if (typeof window === 'undefined') return DESKTOP_APP_DOWNLOAD_URL_DEFAULT const fromConfig = window.__RUNTIME_CONFIG__?.DESKTOP_DOWNLOAD_URL if (fromConfig !== undefined) { const trimmed = fromConfig.trim() return trimmed.length > 0 ? trimmed : null } return DESKTOP_APP_DOWNLOAD_URL_DEFAULT } /** Bottom-of-sidebar link to native (Electron) builds; hidden in the packaged app and when URL is disabled. */ export default function DownloadDesktopSidebarButton() { const { t } = useTranslation() if (typeof window !== 'undefined' && window.imwaldElectron?.isElectron) { return null } const href = resolveDesktopDownloadUrl() if (!href) return null return ( ) }