Files
automaker/apps/ui/src/components/views/settings-view/providers/cursor-settings-tab.tsx
webdevcody 03436103d1 feat: implement backlog plan management and UI enhancements
- Added functionality to save, clear, and load backlog plans within the application.
- Introduced a new API endpoint for clearing saved backlog plans.
- Enhanced the backlog plan dialog to allow users to review and apply changes to their features.
- Integrated dependency management features in the UI, allowing users to select parent and child dependencies for features.
- Improved the graph view with options to manage plans and visualize dependencies effectively.
- Updated the sidebar and settings to include provider visibility toggles for better user control over model selection.

These changes aim to enhance the user experience by providing robust backlog management capabilities and improving the overall UI for feature planning.
2026-01-15 22:21:46 -05:00

111 lines
3.1 KiB
TypeScript

import { useState } from 'react';
import { toast } from 'sonner';
import { useAppStore } from '@/store/app-store';
import type { CursorModelId } from '@automaker/types';
import {
CursorCliStatus,
CursorCliStatusSkeleton,
CursorPermissionsSkeleton,
ModelConfigSkeleton,
} from '../cli-status/cursor-cli-status';
import { useCursorStatus } from '../hooks/use-cursor-status';
import { useCursorPermissions } from '../hooks/use-cursor-permissions';
import { CursorPermissionsSection } from './cursor-permissions-section';
import { CursorModelConfiguration } from './cursor-model-configuration';
import { ProviderToggle } from './provider-toggle';
export function CursorSettingsTab() {
// Global settings from store
const {
enabledCursorModels,
cursorDefaultModel,
setCursorDefaultModel,
toggleCursorModel,
currentProject,
} = useAppStore();
// Custom hooks for data fetching
const { status, isLoading, loadData } = useCursorStatus();
const {
permissions,
isLoadingPermissions,
isSavingPermissions,
copiedConfig,
loadPermissions,
applyProfile,
copyConfig,
} = useCursorPermissions(currentProject?.path);
// Local state for model configuration saving
const [isSaving, setIsSaving] = useState(false);
const handleDefaultModelChange = (model: CursorModelId) => {
setIsSaving(true);
try {
setCursorDefaultModel(model);
toast.success('Default model updated');
} catch (error) {
toast.error('Failed to update default model');
} finally {
setIsSaving(false);
}
};
const handleModelToggle = (model: CursorModelId, enabled: boolean) => {
setIsSaving(true);
try {
toggleCursorModel(model, enabled);
} catch (error) {
toast.error('Failed to update models');
} finally {
setIsSaving(false);
}
};
if (isLoading) {
return (
<div className="space-y-6">
<CursorCliStatusSkeleton />
<CursorPermissionsSkeleton />
<ModelConfigSkeleton />
</div>
);
}
return (
<div className="space-y-6">
{/* Provider Visibility Toggle */}
<ProviderToggle provider="cursor" providerLabel="Cursor" />
{/* CLI Status */}
<CursorCliStatus status={status} isChecking={isLoading} onRefresh={loadData} />
{/* CLI Permissions Section */}
<CursorPermissionsSection
status={status}
permissions={permissions}
isLoadingPermissions={isLoadingPermissions}
isSavingPermissions={isSavingPermissions}
copiedConfig={copiedConfig}
currentProject={currentProject}
onApplyProfile={applyProfile}
onCopyConfig={copyConfig}
onLoadPermissions={loadPermissions}
/>
{/* Model Configuration - Always show (global settings) */}
{status?.installed && (
<CursorModelConfiguration
enabledCursorModels={enabledCursorModels}
cursorDefaultModel={cursorDefaultModel}
isSaving={isSaving}
onDefaultModelChange={handleDefaultModelChange}
onModelToggle={handleModelToggle}
/>
)}
</div>
);
}
export default CursorSettingsTab;