refactor: update ideation dashboard and prompt list to use project-specific job retrieval

- Modified IdeationDashboard and PromptList components to fetch generation jobs specific to the current project.
- Updated addGenerationJob function to include projectPath as a parameter for better job management.
- Introduced getJobsForProject function in the ideation store to streamline job filtering by project.
This commit is contained in:
webdevcody
2026-01-04 14:16:39 -05:00
parent 32f859b927
commit 4ac1edf314
3 changed files with 32 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ export type GenerationJobStatus = 'generating' | 'ready' | 'error';
export interface GenerationJob {
id: string;
projectPath: string;
prompt: IdeationPrompt;
status: GenerationJobStatus;
suggestions: AnalysisSuggestion[];
@@ -76,7 +77,8 @@ interface IdeationActions {
getSelectedIdea: () => Idea | null;
// Generation Jobs
addGenerationJob: (prompt: IdeationPrompt) => string;
addGenerationJob: (projectPath: string, prompt: IdeationPrompt) => string;
getJobsForProject: (projectPath: string) => GenerationJob[];
updateJobStatus: (
jobId: string,
status: GenerationJobStatus,
@@ -172,10 +174,11 @@ export const useIdeationStore = create<IdeationState & IdeationActions>()(
},
// Generation Jobs
addGenerationJob: (prompt) => {
addGenerationJob: (projectPath, prompt) => {
const jobId = `job-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
const job: GenerationJob = {
id: jobId,
projectPath,
prompt,
status: 'generating',
suggestions: [],
@@ -189,6 +192,11 @@ export const useIdeationStore = create<IdeationState & IdeationActions>()(
return jobId;
},
getJobsForProject: (projectPath) => {
const state = get();
return state.generationJobs.filter((job) => job.projectPath === projectPath);
},
updateJobStatus: (jobId, status, suggestions, error) =>
set((state) => ({
generationJobs: state.generationJobs.map((job) =>