返回 AiToEarn
PluginDownloadContent.tsx
根目录 / project / aitoearn-web / src / components / Plugin / PluginDownloadContent.tsx
1 /**
2 * PluginDownloadContent - 插件下载内容组件(可复用)
3 * 用于在不同弹框中显示插件下载或授权内容
4 * 兼容旧接口,根据 pluginStatus 参数显示不同状态
5 */
6
7 'use client'
8
9 import { useIsMobile } from '@/hooks/useIsMobile'
10 import { PluginNoPermission } from './PluginNoPermission'
11 import { PluginNotInstalled } from './PluginNotInstalled'
12
13 /**
14 * 组件属性
15 */
16 export interface PluginDownloadContentProps {
17 /** 插件状态 */
18 pluginStatus: 'not_installed' | 'no_permission' | 'ready'
19 /** 检查权限回调 */
20 onCheckPermission?: () => void | Promise<void>
21 }
22
23 /**
24 * 插件下载内容组件
25 */
26 export function PluginDownloadContent({ pluginStatus }: PluginDownloadContentProps) {
27 const isMobile = useIsMobile()
28
29 // 移动端:无论插件状态如何,都显示移动端提示
30 if (isMobile) {
31 return <PluginNotInstalled />
32 }
33
34 // 已安装但未授权
35 if (pluginStatus === 'no_permission') {
36 return <PluginNoPermission />
37 }
38
39 // 未安装
40 return <PluginNotInstalled />
41 }
42
42 lines Plain Text