MCPcopy
hub / github.com/stravu/crystal / handleCreateProject

Function handleCreateProject

frontend/src/components/ProjectTreeView.tsx:283–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

281 };
282
283 const handleCreateProject = async () => {
284 if (!newProject.name || !newProject.path) return;
285
286 try {
287 const response = await API.projects.create({ ...newProject, active: false });
288
289 if (!response.success) {
290 showError({
291 title: 'Failed to Create Project',
292 error: response.error || 'An error occurred while creating the project.',
293 details: response.details,
294 command: response.command
295 });
296 return;
297 }
298
299 setShowAddProjectDialog(false);
300 setNewProject({ name: '', path: '', buildScript: '', runScript: '' });
301
302 // Just reload the projects list
303 loadProjectsWithSessions();
304 } catch (error: unknown) {
305 console.error('Failed to create project:', error);
306 showError({
307 title: 'Failed to Create Project',
308 error: error instanceof Error ? error.message : 'An error occurred while creating the project.',
309 details: error instanceof Error && error.stack ? error.stack : String(error)
310 });
311 }
312 };
313
314 if (isLoading) {
315 return (

Callers

nothing calls this directly

Calls 3

createMethod · 0.80
errorMethod · 0.80
loadProjectsWithSessionsFunction · 0.70

Tested by

no test coverage detected