Open project in ide (#25)
* Task attempt a92c0626-bdf1-4325-9d85-fdec9dbb46c1 - Final changes * Task attempt a92c0626-bdf1-4325-9d85-fdec9dbb46c1 - Final changes * Prettier fix
This commit is contained in:
committed by
GitHub
parent
76277b279a
commit
97af4d3f30
@@ -22,6 +22,7 @@ import {
|
||||
Loader2,
|
||||
MoreHorizontal,
|
||||
ExternalLink,
|
||||
FolderOpen,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -83,6 +84,28 @@ export function ProjectList() {
|
||||
setShowForm(true);
|
||||
};
|
||||
|
||||
const handleOpenInIDE = async (projectId: string) => {
|
||||
try {
|
||||
const response = await makeRequest(
|
||||
`/api/projects/${projectId}/open-editor`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(null),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to open project in IDE');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to open project in IDE:', error);
|
||||
setError('Failed to open project in IDE');
|
||||
}
|
||||
};
|
||||
|
||||
const handleFormSuccess = () => {
|
||||
setShowForm(false);
|
||||
setEditingProject(null);
|
||||
@@ -172,6 +195,15 @@ export function ProjectList() {
|
||||
<ExternalLink className="mr-2 h-4 w-4" />
|
||||
View Project
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleOpenInIDE(project.id);
|
||||
}}
|
||||
>
|
||||
<FolderOpen className="mr-2 h-4 w-4" />
|
||||
Open in IDE
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Plus, Settings } from 'lucide-react';
|
||||
import { Plus, Settings, FolderOpen } from 'lucide-react';
|
||||
import { makeRequest } from '@/lib/api';
|
||||
import { TaskFormDialog } from '@/components/tasks/TaskFormDialog';
|
||||
import { ProjectForm } from '@/components/projects/project-form';
|
||||
@@ -55,6 +55,30 @@ export function ProjectTasks() {
|
||||
setIsTaskDialogOpen(true);
|
||||
};
|
||||
|
||||
const handleOpenInIDE = async () => {
|
||||
if (!projectId) return;
|
||||
|
||||
try {
|
||||
const response = await makeRequest(
|
||||
`/api/projects/${projectId}/open-editor`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(null),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to open project in IDE');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to open project in IDE:', error);
|
||||
setError('Failed to open project in IDE');
|
||||
}
|
||||
};
|
||||
|
||||
// Setup keyboard shortcuts
|
||||
useKeyboardShortcuts({
|
||||
navigate,
|
||||
@@ -359,11 +383,21 @@ export function ProjectTasks() {
|
||||
{project.current_branch}
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={handleOpenInIDE}
|
||||
className="h-8 w-8 p-0"
|
||||
title="Open in IDE"
|
||||
>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsProjectSettingsOpen(true)}
|
||||
className="h-8 w-8 p-0"
|
||||
title="Project Settings"
|
||||
>
|
||||
<Settings className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user