* feat(projects): add keyboard-driven project setup * test(app): update add project loading assertion * fix(projects): harden GitHub project setup
28 lines
601 B
TypeScript
28 lines
601 B
TypeScript
import { create } from "zustand";
|
|
|
|
export interface AddProjectFlowRequest {
|
|
id: number;
|
|
preferredHostId?: string;
|
|
}
|
|
|
|
interface AddProjectFlowStoreState {
|
|
request: AddProjectFlowRequest | null;
|
|
open: (preferredHostId?: string) => void;
|
|
close: () => void;
|
|
}
|
|
|
|
let nextRequestId = 1;
|
|
|
|
export const useAddProjectFlowStore = create<AddProjectFlowStoreState>((set) => ({
|
|
request: null,
|
|
open: (preferredHostId) => {
|
|
set({
|
|
request: {
|
|
id: nextRequestId++,
|
|
...(preferredHostId ? { preferredHostId } : {}),
|
|
},
|
|
});
|
|
},
|
|
close: () => set({ request: null }),
|
|
}));
|