diff --git a/apps/android/src/screens/bot-sidebar-section.tsx b/apps/android/src/screens/bot-sidebar-section.tsx index ef8d0de..e1bdb33 100644 --- a/apps/android/src/screens/bot-sidebar-section.tsx +++ b/apps/android/src/screens/bot-sidebar-section.tsx @@ -1,7 +1,6 @@ import { useEffect, useMemo, useState } from 'react' import { ActivityIndicator, - Alert, Modal, Pressable, ScrollView, @@ -35,6 +34,7 @@ import { Users, X, } from 'lucide-react-native' +import { isVisibleSession } from '../lib/session-visibility' import { strings as s } from '../locales/i18n' import { browseScope } from '../services/browse-memory' import { @@ -56,6 +56,7 @@ import { useTheme, type ThemeColors } from '../ui/theme-context' import { useResponsiveLayout } from '../ui/responsive' import { useThemedStyles } from '../ui/use-themed-styles' import { ModalSurface } from './chat/modal' +import { ConfirmDialog } from './chat/confirm-dialog' import { resolveSessionDisplayTitle } from './session-title' import { BotAgentBadge, engineOfModel } from './bot/agent-badge' import { BotAvatar, BotAvatarWithBadge } from './bot/avatar' @@ -148,7 +149,7 @@ function formatBotListTimestamp(updatedAt?: number): string { return `${hh}:${mm}` } if (date.getFullYear() === now.getFullYear()) { - return `${date.getMonth() + 1}月${date.getDate()}日` + return date.toLocaleDateString(s.time.locale, { month: 'short', day: 'numeric' }) } return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}` } @@ -554,8 +555,9 @@ export function BotSidebarSection({ {state !== undefined && showAgents && agents.map(agent => agent.sessions .filter(sid => { - if (!query) return true const matched = sessionMap.get(sid) + if (matched && !isVisibleSession(matched, selectedId, query)) return false + if (!query) return true const title = (matched ? resolveSessionDisplayTitle(matched) : undefined) ?? s.sessions.untitled return title.toLocaleLowerCase().includes(query) }) @@ -661,16 +663,8 @@ export function BotModalsHost() { const performAdapter: BotPerform = (operation, payload) => perform(operation, payload) - const confirmDelete = (kind: 'bot' | 'room', id: string) => { - Alert.alert(s.bots.delete, s.bots.deleteHint, [ - { text: s.bots.cancel, style: 'cancel' }, - { - text: s.bots.delete, - style: 'destructive', - onPress: () => void perform(kind === 'bot' ? 'delete-bot' : 'delete-room', { id }), - }, - ]) - } + const [deleteConfirm, setDeleteConfirm] = useState<{ kind: 'bot' | 'room'; id: string } | undefined>() + const confirmDelete = (kind: 'bot' | 'room', id: string) => setDeleteConfirm({ kind, id }) const menuBot = contextMenu?.kind === 'bot' ? state?.bots.find(b => b.id === contextMenu.id) : undefined const menuRoom = contextMenu?.kind === 'room' ? state?.rooms.find(r => r.id === contextMenu.id) : undefined @@ -773,6 +767,31 @@ export function BotModalsHost() { return ( <> + 0} + actions={contextActions} + onClose={() => setContextMenu(undefined)} + anchor="top-right" + topOffset={120} + /> + + {state !== undefined && ( + setDetailsOpen(false)} + onEdit={() => setEditor({ kind: detailBot ? 'bot' : 'room', id: (detailBot ?? detailRoom)?.id ?? selectedId })} + perform={performAdapter} + /> + )} + {editor !== undefined && state !== undefined && clientInstance !== undefined && ( )} - 0} - actions={contextActions} - onClose={() => setContextMenu(undefined)} - anchor="top-right" - topOffset={120} - /> - - {state !== undefined && ( - setDetailsOpen(false)} - onEdit={() => setEditor({ kind: detailBot ? 'bot' : 'room', id: selectedId })} - perform={performAdapter} - /> - )} - {report !== undefined && ( )} + + setDeleteConfirm(undefined)} + buttons={[ + { label: s.bots.cancel }, + { + label: s.bots.delete, + danger: true, + onPress: () => { + if (!deleteConfirm) return + void perform(deleteConfirm.kind === 'bot' ? 'delete-bot' : 'delete-room', { id: deleteConfirm.id }) + }, + }, + ]} + /> ) } @@ -889,7 +902,7 @@ export function DsBotInstallCard({ error, loading = false, onRetry }: { error?: const rows = [ { label: s.plugins.installDesktop, value: 'ds-bot' }, { label: s.plugins.installCli, value: 'dsh plugin --profile web add -w ds-bot' }, - { label: 'GitHub 安装地址(无法连接 npm 时填入)', value: 'github:Fei2411/DS-Bot#main&path:/ds-bot' }, + { label: s.plugins.installGithub, value: 'github:Fei2411/DS-Bot#main&path:/ds-bot' }, ] return (