()
| 5 | import ScriptInstallView from "./components/ScriptInstallView"; |
| 6 | |
| 7 | function App() { |
| 8 | const data = useInstallData(); |
| 9 | const { t } = useTranslation(); |
| 10 | |
| 11 | // Skill ZIP 安装 |
| 12 | if (data.skillPreview) { |
| 13 | return ( |
| 14 | <SkillInstallView |
| 15 | metadata={data.skillPreview.metadata} |
| 16 | prompt={data.skillPreview.prompt} |
| 17 | scripts={data.skillPreview.scripts} |
| 18 | references={data.skillPreview.references} |
| 19 | isUpdate={data.skillPreview.isUpdate} |
| 20 | installUrl={data.skillPreview.installUrl} |
| 21 | onInstall={data.handleSkillInstall} |
| 22 | onClose={data.handleSkillCancel} |
| 23 | /> |
| 24 | ); |
| 25 | } |
| 26 | |
| 27 | // URL 加载中 / 错误 / 无效页面 |
| 28 | if (!data.hasValidSourceParam) { |
| 29 | return data.urlHref ? ( |
| 30 | <div className="tw-flex tw-justify-center tw-items-center tw-h-screen"> |
| 31 | <Space direction="vertical" align="center"> |
| 32 | {data.fetchingState.loadingStatus && ( |
| 33 | <> |
| 34 | <Typography.Title heading={3}>{t("install_page_loading")}</Typography.Title> |
| 35 | <div className="downloading"> |
| 36 | <Typography.Text style={{ fontFamily: "monospace" }}> |
| 37 | {data.fetchingState.loadingStatus} |
| 38 | </Typography.Text> |
| 39 | <div className="loader"></div> |
| 40 | </div> |
| 41 | </> |
| 42 | )} |
| 43 | {data.fetchingState.errorStatus && ( |
| 44 | <> |
| 45 | <Typography.Title heading={3}>{t("install_page_load_failed")}</Typography.Title> |
| 46 | <div className="error-message">{data.fetchingState.errorStatus}</div> |
| 47 | </> |
| 48 | )} |
| 49 | </Space> |
| 50 | </div> |
| 51 | ) : ( |
| 52 | <div className="tw-flex tw-justify-center tw-items-center tw-h-screen"> |
| 53 | <Space direction="vertical" align="center"> |
| 54 | <Typography.Title heading={3}>{t("invalid_page")}</Typography.Title> |
| 55 | </Space> |
| 56 | </div> |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | // UserScript / Subscribe 安装 |
| 61 | return <ScriptInstallView data={data} />; |
| 62 | } |
| 63 | |
| 64 | export default App; |
nothing calls this directly
no test coverage detected