import { useState, useEffect } from "react"; import { useSettings } from "../../hooks/useSettings"; import * as commands from "../../lib/tauri-commands"; export default function AwsSettings() { const { appSettings, saveSettings } = useSettings(); const [profiles, setProfiles] = useState([]); const [detecting, setDetecting] = useState(false); const globalAws = appSettings?.global_aws ?? { aws_config_path: null, aws_profile: null, aws_region: null, }; // Load profiles when component mounts or aws_config_path changes useEffect(() => { commands.listAwsProfiles().then(setProfiles).catch(() => setProfiles([])); }, [globalAws.aws_config_path]); const handleDetect = async () => { setDetecting(true); try { const path = await commands.detectAwsConfig(); if (path && appSettings) { const updated = { ...appSettings, global_aws: { ...globalAws, aws_config_path: path }, }; await saveSettings(updated); // Refresh profiles after detection const p = await commands.listAwsProfiles(); setProfiles(p); } } finally { setDetecting(false); } }; const handleChange = async (field: string, value: string | null) => { if (!appSettings) return; await saveSettings({ ...appSettings, global_aws: { ...globalAws, [field]: value || null }, }); }; return (

Global AWS defaults for Bedrock projects. Per-project settings override these.

{/* AWS Config Path */}
AWS Config Path
handleChange("aws_config_path", e.target.value)} placeholder="~/.aws" className="flex-1 px-2 py-1.5 text-xs bg-[var(--bg-primary)] border border-[var(--border-color)] rounded focus:outline-none focus:border-[var(--accent)]" />
{globalAws.aws_config_path && ( Found )}
{/* AWS Profile */}
Default Profile
{/* AWS Region */}
Default Region handleChange("aws_region", e.target.value)} placeholder="e.g., us-east-1" className="w-full px-2 py-1.5 text-xs bg-[var(--bg-primary)] border border-[var(--border-color)] rounded focus:outline-none focus:border-[var(--accent)]" />
); }