Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add `delete` option for project actions #223

Mergedshiroyasha9(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/223/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 79 additions and 1 deletion.

x
0 of 2 viewed, 2 left
34 additions and 0 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -1580,6 +1580,36 @@
[activeProject, persistProjectScripts],
+ const deleteProjectScript = useCallback(
+ async (scriptId: string) => {
+ if (!activeProject) return;
+ const nextScripts = activeProject.scripts.filter((script) => script.id !== scriptId);
+​
+ const deletedName = activeProject.scripts.find((s) => s.id === scriptId)?.name;
+​
+ try {
+ await persistProjectScripts({
+ projectId: activeProject.id,
+ projectCwd: activeProject.cwd,
+ previousScripts: activeProject.scripts,
+ nextScripts,
+ keybinding: null,
+ keybindingCommand: commandForProjectScript(scriptId),
+ });
+ toastManager.add({
+ type: "success",
+ title: `Deleted action "${deletedName ?? "Unknown"}"`,
+ });
+ } catch (error) {
+ toastManager.add({
+ type: "error",
+ title: "Could not delete action",
+ description: error instanceof Error ? error.message : "An unexpected error occurred.",
+ });