import { useSearch } from "@tanstack/react-router"; import { useRepoStore } from "../store"; import { useEffect, useState } from "react"; import { useShallow } from "zustand/shallow"; import BuildConfig from "../components/BuildConfig"; import { CommonRepoDialog } from "../page"; import { RepoCard } from "../components/RepoCard"; export const App = () => { const params = useSearch({ strict: false }) as { repo?: string, tab?: string }; const repoStore = useRepoStore(useShallow((state) => ({ getItem: state.getItem, editRepo: state.editRepo, refresh: state.refresh, loading: state.loading, }))); const [activeTab, setActiveTab] = useState(params.tab || "build"); const tabs = [ { key: "build", label: "构建配置" }, { key: "info", label: "基本信息" }, ] useEffect(() => { if (params.repo) { repoStore.getItem(params.repo); repoStore.refresh({ search: params.repo, showTips: false }); } else { console.log('no repo param') } }, [params]) if (!repoStore.editRepo) { return
{JSON.stringify(repoStore.editRepo, null, 2)}