import { Braces, ChevronRight, Cookie, Network, Radio, ShieldCheck, UserRoundCog } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Switch } from '@/components/ui/switch'; import { request } from '@/platform/messaging/runtime'; import { READ_CAPABILITY_SCOPES } from '@/protocol/capabilities'; import type { ActiveTabInfo, ExtensionState, UserAgentResolution } from '@/types/models'; type PopupView = 'home' | 'proxy' | 'cookies' | 'user-agent'; type RunTask = (task: () => Promise, success?: string) => Promise; interface OverviewQuickViewProps { state: ExtensionState; tab?: ActiveTabInfo; grantActive: boolean; busy: boolean; run: RunTask; setState: (state: ExtensionState) => void; cookieCount: number; uaResolution?: UserAgentResolution; onNavigate: (view: PopupView) => void; onOpenContext: () => void; onCapture: () => void; } export function OverviewQuickView({ state, tab, grantActive, busy, run, setState, cookieCount, uaResolution, onNavigate, onOpenContext, onCapture, }: OverviewQuickViewProps) { const activeProxy = state.activeProxyId === 'auto' ? '自动切换' : state.proxyProfiles.find((profile) => profile.id === state.activeProxyId)?.name || '未选择'; const targetAvailable = Boolean(tab?.url?.startsWith('http')); return
共享当前标签页 {grantActive ? `只读会话 ${new Date(state.activeGrant!.expiresAt).toLocaleTimeString()} 到期` : '创建 30 分钟只读会话'}
void run(async () => { const updated = checked ? await request('grant.create', { targets: [{ tabId: tab!.id, frameId: 0 }], scopes: READ_CAPABILITY_SCOPES, durationMinutes: 30 }) : await request('grant.revoke'); setState(updated); })} />
{targetAvailable ? '页面已就绪' : '页面不可访问'}{targetAvailable ? '从这里快速查看和调整当前标签页' : '切换到 HTTP(S) 页面后可使用浏览器工具'}
; }