mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-03-29 16:53:09 +00:00
feat: fix tooltip shortcuts and add dev server config dialog
Tooltip fixes (PR #177 follow-up): - Remove duplicate title attr on Settings button that caused double-tooltip - Restore keyboard shortcut hints in tooltip text: Settings (,), Reset (R) - Clean up spurious peer markers in package-lock.json Dev server config dialog: - Add DevServerConfigDialog component for custom dev commands - Open config dialog automatically when start fails with "no dev command" - Add useDevServerConfig/useUpdateDevServerConfig hooks - Add updateDevServerConfig API function - Add config gear button next to dev server start Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import * as api from '../lib/api'
|
||||
import type { FeatureCreate, FeatureUpdate, ModelsResponse, ProjectSettingsUpdate, ProvidersResponse, Settings, SettingsUpdate } from '../lib/types'
|
||||
import type { DevServerConfig, FeatureCreate, FeatureUpdate, ModelsResponse, ProjectSettingsUpdate, ProvidersResponse, Settings, SettingsUpdate } from '../lib/types'
|
||||
|
||||
// ============================================================================
|
||||
// Projects
|
||||
@@ -345,3 +345,36 @@ export function useUpdateSettings() {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Dev Server Config
|
||||
// ============================================================================
|
||||
|
||||
// Default config for placeholder (until API responds)
|
||||
const DEFAULT_DEV_SERVER_CONFIG: DevServerConfig = {
|
||||
detected_type: null,
|
||||
detected_command: null,
|
||||
custom_command: null,
|
||||
effective_command: null,
|
||||
}
|
||||
|
||||
export function useDevServerConfig(projectName: string | null) {
|
||||
return useQuery({
|
||||
queryKey: ['dev-server-config', projectName],
|
||||
queryFn: () => api.getDevServerConfig(projectName!),
|
||||
enabled: !!projectName,
|
||||
staleTime: 30_000,
|
||||
placeholderData: DEFAULT_DEV_SERVER_CONFIG,
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateDevServerConfig(projectName: string) {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (customCommand: string | null) =>
|
||||
api.updateDevServerConfig(projectName, customCommand),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['dev-server-config', projectName] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user