- 新增发布到GitHub功能(scan/init/commit/push/register全流程) - 新增WSL发行版检测与UNC路径自动转换,路径存储改为Windows可访问格式 - 修复libgit2访问WSL UNC路径的owner验证问题(启动时全局禁用) - ProjectCard新增本地项目/本地仓库/远程仓库三灯状态指示 - ProjectModal重构为基本信息+部署信息双标签页,固定高度稳定切换 - 添加项目支持顶部快速选择文件夹并自动填充ID和名称 - 设置页WSL区块改为下拉检测选择发行版 - Dialog组件支持fixedHeight固定高度模式
26 lines
716 B
TypeScript
26 lines
716 B
TypeScript
import { create } from "zustand";
|
|
import type { Project } from "../lib/commands";
|
|
|
|
interface UIState {
|
|
// Toast
|
|
toast: string | null;
|
|
showToast: (msg: string, duration?: number) => void;
|
|
|
|
// Project modal
|
|
editTarget: Project | null | undefined; // undefined = closed, null = new, obj = edit
|
|
openEdit: (project?: Project | null) => void;
|
|
closeEdit: () => void;
|
|
}
|
|
|
|
export const useUIStore = create<UIState>((set) => ({
|
|
toast: null,
|
|
showToast: (msg, duration = 2500) => {
|
|
set({ toast: msg });
|
|
setTimeout(() => set({ toast: null }), duration);
|
|
},
|
|
|
|
editTarget: undefined,
|
|
openEdit: (project) => set({ editTarget: project ?? null }),
|
|
closeEdit: () => set({ editTarget: undefined }),
|
|
}));
|