generated from kevisual/vite-react-template
feat: enhance repository management UI and functionality
- Added navigation to repository details in RepoCard component. - Implemented a new BuildConfig component for managing build configurations. - Integrated build configuration initialization and saving logic in the store. - Updated RepoInfoCard to include workspace management features. - Improved repository editing dialog with better state handling. - Enhanced repository list fetching with search capabilities. - Added support for creating and managing development configurations. - Refactored code for better readability and maintainability.
This commit is contained in:
@@ -1,18 +1,27 @@
|
||||
import { useSearch } from "@tanstack/react-router";
|
||||
import { useRepoStore } from "../store";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { RepoInfoCard } from "../components/RepoInfoCard";
|
||||
import BuildConfig from "../components/BuildConfig";
|
||||
import { CommonRepoDialog } from "../page";
|
||||
|
||||
export const App = () => {
|
||||
const params = useSearch({ strict: false }) as { repo?: string };
|
||||
const repoStore = useRepoStore(useShallow((state) => ({
|
||||
getItem: state.getItem,
|
||||
editRepo: state.editRepo,
|
||||
refresH: state.refresh,
|
||||
})));
|
||||
const [activeTab, setActiveTab] = useState("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')
|
||||
}
|
||||
@@ -21,10 +30,30 @@ export const App = () => {
|
||||
return <div>Loading...</div>
|
||||
}
|
||||
return (
|
||||
<div className="p-2">
|
||||
<div className="p-2 flex-col flex gap-2 h-full">
|
||||
<div className="px-4">
|
||||
<RepoInfoCard />
|
||||
</div>
|
||||
<div className="px-4 h-[calc(100%-200px)] scrollbar flex-col flex gap-4 overflow-hidden">
|
||||
<div className="flex border-b mb-4">
|
||||
{tabs.map(tab => (
|
||||
<div
|
||||
key={tab.key}
|
||||
className={`px-4 py-2 cursor-pointer ${activeTab === tab.key ? 'border-b-2 border-gray-500' : ''}`}
|
||||
onClick={() => setActiveTab(tab.key)}
|
||||
>
|
||||
{tab.label}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{activeTab === 'build' && <BuildConfig />}
|
||||
{activeTab === 'info' && (
|
||||
<div className="p-4 border rounded bg-white h-full overflow-auto scrollbar">
|
||||
<pre className="whitespace-pre-wrap break-all">{JSON.stringify(repoStore.editRepo, null, 2)}</pre>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<CommonRepoDialog />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user