import { useCallback, useMemo } from "react"; import { useTranslation } from "react-i18next"; import { Text, View } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import { StyleSheet, useUnistyles } from "react-native-unistyles"; import { ArrowUpRight, Check, Terminal } from "lucide-react-native"; import { Button } from "@/components/ui/button"; import { useCliInstall } from "@/desktop/hooks/use-install-status"; import { SettingsSection } from "@/components/settings/headings/settings-section"; import { settingsStyles } from "@/styles/settings"; import { openExternalUrl } from "@/utils/open-external-url"; import { shouldUseDesktopDaemon } from "@/desktop/daemon/desktop-daemon"; const CLI_DOCS_URL = "https://paseo.sh/docs/cli"; export function IntegrationsSection() { const { t } = useTranslation(); const { theme } = useUnistyles(); const showSection = shouldUseDesktopDaemon(); const { status, isInstalling, install, refresh } = useCliInstall(); useFocusEffect( useCallback(() => { if (showSection) refresh(); return undefined; }, [refresh, showSection]), ); const docsIcon = useMemo( () => , [theme.iconSize.sm, theme.colors.foregroundMuted], ); const handleOpenDocs = useCallback(() => { void openExternalUrl(CLI_DOCS_URL); }, []); const trailing = useMemo( () => ( ), [docsIcon, handleOpenDocs, t], ); if (!showSection) return null; return ( {t("settings.integrations.commandLine.title")} {t("settings.integrations.commandLine.description")} {status?.installed ? ( {t("settings.integrations.actions.installed")} ) : ( )} ); } const styles = StyleSheet.create((theme) => ({ rowTitleRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] }, installedLabel: { flexDirection: "row", alignItems: "center", gap: 4 }, mutedText: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.base }, }));