feat: 添加仓库信息卡片和仓库页面,优化仓库路由

This commit is contained in:
2026-02-25 23:12:39 +08:00
parent bbb762db97
commit 5a769a6748
7 changed files with 177 additions and 18 deletions

View File

@@ -0,0 +1,32 @@
import { useSearch } from "@tanstack/react-router";
import { useRepoStore } from "../store";
import { useEffect } from "react";
import { useShallow } from "zustand/shallow";
import { RepoInfoCard } from "../components/RepoInfoCard";
export const App = () => {
const params = useSearch({ strict: false }) as { repo?: string };
const repoStore = useRepoStore(useShallow((state) => ({
getItem: state.getItem,
editRepo: state.editRepo,
})));
useEffect(() => {
if (params.repo) {
repoStore.getItem(params.repo);
} else {
console.log('no repo param')
}
}, [params])
if (!repoStore.editRepo) {
return <div>Loading...</div>
}
return (
<div className="p-2">
<div className="px-4">
<RepoInfoCard />
</div>
</div>
)
}
export default App;