auto-claude: subtask-1-2 - Create useFeatureArchive hook in hooks.ts
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cda21b2056
commit
3a5a9dbca9
@@ -114,6 +114,30 @@ export function useFeatureDelete(projectId: string) {
|
||||
return { deleteFeature: handleDeleteFeature };
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to archive features from roadmap (removes from view)
|
||||
*/
|
||||
export function useFeatureArchive(projectId: string) {
|
||||
const deleteFeature = useRoadmapStore((state) => state.deleteFeature);
|
||||
|
||||
const handleArchiveFeature = async (featureId: string) => {
|
||||
// Remove from store
|
||||
deleteFeature(featureId);
|
||||
|
||||
// Persist to file
|
||||
const roadmap = useRoadmapStore.getState().roadmap;
|
||||
if (roadmap) {
|
||||
try {
|
||||
await window.electronAPI.saveRoadmap(projectId, roadmap);
|
||||
} catch (error) {
|
||||
console.error('Failed to save roadmap after archive:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return { archiveFeature: handleArchiveFeature };
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to manage roadmap generation actions
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user