mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 10:33:25 +08:00
feat(skills): add skill deletion and improve UI/UX
- Add skill deletion functionality with confirmation dialog - Protect builtin skills from deletion - Optimize skill card layout (badge and enable button near menu) - Change enable button to icon-only with theme color - Improve card selection and hover states - Fix skill hub installation state tracking (per-skill) - Add proper i18n for delete feature (en/zh) - Add loading states to delete confirmation dialog - Remove manual refetch calls (use query invalidation)
This commit is contained in:
@@ -215,15 +215,53 @@ export function useToggleSkill(): UseToggleSkillReturn {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for deleting a skill
|
||||
*/
|
||||
export function useDeleteSkill() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async ({
|
||||
skillName,
|
||||
location,
|
||||
projectPath,
|
||||
cliType,
|
||||
}: {
|
||||
skillName: string;
|
||||
location: 'project' | 'user';
|
||||
projectPath?: string;
|
||||
cliType: 'claude' | 'codex';
|
||||
}) => {
|
||||
const { deleteSkill } = await import('@/lib/api');
|
||||
return deleteSkill(skillName, location, projectPath, cliType);
|
||||
},
|
||||
onSuccess: () => {
|
||||
// Invalidate skills queries to refresh the list
|
||||
queryClient.invalidateQueries({ queryKey: skillsKeys.all });
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
deleteSkill: (skillName: string, location: 'project' | 'user', projectPath?: string, cliType: 'claude' | 'codex' = 'claude') =>
|
||||
mutation.mutateAsync({ skillName, location, projectPath, cliType }),
|
||||
isDeleting: mutation.isPending,
|
||||
error: mutation.error,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Combined hook for all skill mutations
|
||||
*/
|
||||
export function useSkillMutations() {
|
||||
const toggle = useToggleSkill();
|
||||
const deleteSkillHook = useDeleteSkill();
|
||||
|
||||
return {
|
||||
toggleSkill: toggle.toggleSkill,
|
||||
isToggling: toggle.isToggling,
|
||||
isMutating: toggle.isToggling,
|
||||
deleteSkill: deleteSkillHook.deleteSkill,
|
||||
isDeleting: deleteSkillHook.isDeleting,
|
||||
isMutating: toggle.isToggling || deleteSkillHook.isDeleting,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user