Lot en un seul commit: les deux features partagent les mêmes contrats (domain/settings.rs, DTO, commandes Tauri/HTTP, web-server) et les mêmes surfaces UI — la séparation par fichiers était impossible sans chirurgie de hunks risquant des états intermédiaires non compilables (convention lot des batches #310-#313 et #315). #325 — icône configurable par projet, watermark CLI custom: - domaine: ProjectIconSet (devicon, simple-icons, lucide, idea), ProjectIconRef validé (nom ASCII 1..=64, -_. internes), champ icon optionnel sur ProjectSettings; sérialisation camelCase et try_from strict - application: UpdateProjectSettings.execute accepte un patch theme_color OU icon (absent = inchangé, null = défaut produit), tests in-dependants avec store mémoire - backend/app-tauri/web-server: ProjectIconRefDto, UpdateProjectSettingsRequestDto avec icon optionnel (désérialisation additive), commandes update_project_settings alignées Tauri/HTTP, tests DTO et HTTP (défaut null, set, clear, nom invalide rejeté) - frontend: catalogue projectIcons (recherche EN), ProjectIconPicker en grille multi-lignes dans Paramètres projet, affichage de l'icône dans ProjectTabs et watermark grand format à faible opacité en fond de CLI custom; ports ProjectSettings.icon, Partial<ProjectSettings>, adapters tauri/mock/http et tests alignés #326 — localisation FR/EN et traduction des textes IdeA: - domaine: IdeaLanguage (fr | en), champ language optionnel sur IdeaUserSettings (absence = défaut produit, série additive validée) - backend/web-server: UserSettingsDto.language, update_user_settings accepte language, tests HTTP alignés; fixtures structured_launch_d3 mises à jour - frontend: i18n/ (catalogue FR/EN, I18nProvider, scan anti-régression des sources visibles), GeneralSettings avec sélecteur de langue dans les paramètres, setupI18n dans vitest; migration de l'ensemble des textes hardcodés vers le catalogue sur toutes les surfaces (agents, layout, projets, tickets, sprints, web, plugins, permissions, git, templates, skills, mémoire, model servers, embedder, first-run, devices, scheduled tasks, workstate, dialogs), FR conservé par défaut; recherche d'icônes #325 en anglais conformément au ticket QA verte sur feature/batch-325-326-project-icons-localisation. Aucun push.
89 lines
2.7 KiB
TypeScript
89 lines
2.7 KiB
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
import type { DefaultAgentTerminalInterface } from "@/ports";
|
|
import { Panel, Spinner } from "@/shared";
|
|
import { useGateways } from "@/app/di";
|
|
import { useI18n } from "@/i18n";
|
|
|
|
const choices: Array<{ value: DefaultAgentTerminalInterface; label: string }> = [
|
|
{ value: "nativeTui", label: "TUI native" },
|
|
{ value: "ideaCli", label: "CLI IdeA" },
|
|
];
|
|
|
|
export function TerminalSettings() {
|
|
const { userSettings } = useGateways();
|
|
const { t } = useI18n();
|
|
const [value, setValue] = useState<DefaultAgentTerminalInterface>("nativeTui");
|
|
const [busy, setBusy] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
let cancelled = false;
|
|
setBusy(true);
|
|
userSettings
|
|
.readUserSettings()
|
|
.then((settings) => {
|
|
if (!cancelled) {
|
|
setValue(settings.defaultAgentTerminalInterface ?? "nativeTui");
|
|
setError(null);
|
|
}
|
|
})
|
|
.catch(() => {
|
|
if (!cancelled) setError(t("settings.terminal.loadError"));
|
|
})
|
|
.finally(() => {
|
|
if (!cancelled) setBusy(false);
|
|
});
|
|
return () => {
|
|
cancelled = true;
|
|
};
|
|
}, [userSettings, t]);
|
|
|
|
async function select(next: DefaultAgentTerminalInterface) {
|
|
const previous = value;
|
|
setValue(next);
|
|
setBusy(true);
|
|
setError(null);
|
|
try {
|
|
const saved = await userSettings.updateUserSettings({
|
|
defaultAgentTerminalInterface: next,
|
|
});
|
|
setValue(saved.defaultAgentTerminalInterface ?? "nativeTui");
|
|
} catch {
|
|
setValue(previous);
|
|
setError(t("settings.terminal.saveError"));
|
|
} finally {
|
|
setBusy(false);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<Panel title="Terminal" className="flex flex-col gap-4 p-4">
|
|
<fieldset disabled={busy} className="flex flex-col gap-3">
|
|
<legend className="text-sm font-semibold text-content">
|
|
{t("settings.terminal.default")}
|
|
</legend>
|
|
<div className="flex flex-col gap-2">
|
|
{choices.map((choice) => (
|
|
<label key={choice.value} className="flex items-center gap-2 text-sm text-content">
|
|
<input
|
|
type="radio"
|
|
name="default-agent-terminal-interface"
|
|
value={choice.value}
|
|
checked={value === choice.value}
|
|
onChange={() => void select(choice.value)}
|
|
/>
|
|
{choice.label}
|
|
</label>
|
|
))}
|
|
</div>
|
|
<p className="text-xs text-muted">
|
|
{t("settings.terminal.help")}
|
|
</p>
|
|
</fieldset>
|
|
{busy && <Spinner size={14} />}
|
|
{error && <p role="alert" className="text-sm text-danger">{error}</p>}
|
|
</Panel>
|
|
);
|
|
}
|