feat(domain,application,infrastructure,backend,web-server,app-tauri,frontend): lot utilisateur #325 #326 — icônes projet avec watermark CLI custom et localisation FR/EN (QA verte)
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.
This commit is contained in:
@ -166,7 +166,7 @@ class HttpUserSettingsGateway implements UserSettingsGateway {
|
||||
return this.http.invoke<UserSettings>("read_user_settings");
|
||||
}
|
||||
|
||||
updateUserSettings(settings: UserSettings): Promise<UserSettings> {
|
||||
updateUserSettings(settings: Partial<UserSettings>): Promise<UserSettings> {
|
||||
return this.http.invoke<UserSettings>("update_user_settings", { request: settings });
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,9 +141,9 @@ export class HttpProjectGateway implements ProjectGateway {
|
||||
readProjectSettings(projectId: string): Promise<ProjectSettings> {
|
||||
return this.http.invoke<ProjectSettings>("read_project_settings", { projectId });
|
||||
}
|
||||
updateProjectSettings(projectId: string, settings: ProjectSettings): Promise<ProjectSettings> {
|
||||
updateProjectSettings(projectId: string, settings: Partial<ProjectSettings>): Promise<ProjectSettings> {
|
||||
return this.http.invoke<ProjectSettings>("update_project_settings", {
|
||||
request: { projectId, themeColor: settings.themeColor },
|
||||
request: { projectId, ...settings },
|
||||
});
|
||||
}
|
||||
listProjectFiles(projectId: string, path: string): Promise<ProjectFileListing> {
|
||||
|
||||
@ -1466,20 +1466,26 @@ export class MockProjectGateway implements ProjectGateway {
|
||||
if (!this.projects.some((project) => project.id === projectId)) {
|
||||
throw { code: "NOT_FOUND", message: `project ${projectId} not found` };
|
||||
}
|
||||
return this.settings.get(projectId) ?? { themeColor: null };
|
||||
return this.settings.get(projectId) ?? { themeColor: null, icon: null };
|
||||
}
|
||||
|
||||
async updateProjectSettings(
|
||||
projectId: string,
|
||||
settings: ProjectSettings,
|
||||
settings: Partial<ProjectSettings>,
|
||||
): Promise<ProjectSettings> {
|
||||
if (!this.projects.some((project) => project.id === projectId)) {
|
||||
throw { code: "NOT_FOUND", message: `project ${projectId} not found` };
|
||||
}
|
||||
if (settings.themeColor !== null && !/^#[0-9A-Fa-f]{6}$/.test(settings.themeColor)) {
|
||||
if (settings.themeColor !== undefined && settings.themeColor !== null && !/^#[0-9A-Fa-f]{6}$/.test(settings.themeColor)) {
|
||||
throw { code: "INVALID", message: "themeColor must use #RRGGBB" };
|
||||
}
|
||||
const stored = { themeColor: settings.themeColor?.toUpperCase() ?? null };
|
||||
const previous = this.settings.get(projectId) ?? { themeColor: null, icon: null };
|
||||
const stored = {
|
||||
themeColor: settings.themeColor === undefined
|
||||
? previous.themeColor
|
||||
: settings.themeColor?.toUpperCase() ?? null,
|
||||
icon: settings.icon === undefined ? (previous.icon ?? null) : settings.icon,
|
||||
};
|
||||
this.settings.set(projectId, stored);
|
||||
return stored;
|
||||
}
|
||||
@ -5015,14 +5021,14 @@ export function createMockGateways(): Gateways {
|
||||
}
|
||||
|
||||
export class MockUserSettingsGateway implements UserSettingsGateway {
|
||||
private settings: UserSettings = { defaultAgentTerminalInterface: null };
|
||||
private settings: UserSettings = { defaultAgentTerminalInterface: null, language: null };
|
||||
|
||||
async readUserSettings(): Promise<UserSettings> {
|
||||
return { ...this.settings };
|
||||
}
|
||||
|
||||
async updateUserSettings(settings: UserSettings): Promise<UserSettings> {
|
||||
this.settings = { ...settings };
|
||||
async updateUserSettings(settings: Partial<UserSettings>): Promise<UserSettings> {
|
||||
this.settings = { ...this.settings, ...settings };
|
||||
return { ...this.settings };
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,4 +63,17 @@ describe("TauriProjectGateway invoke payloads", () => {
|
||||
request: { projectId: "proj-1" },
|
||||
});
|
||||
});
|
||||
|
||||
it("passes project icon updates through the additive settings request", async () => {
|
||||
const gateway = new TauriProjectGateway();
|
||||
await gateway.updateProjectSettings("proj-1", {
|
||||
icon: { set: "devicon", name: "typescript" },
|
||||
});
|
||||
expect(invoke).toHaveBeenCalledWith("update_project_settings", {
|
||||
request: {
|
||||
projectId: "proj-1",
|
||||
icon: { set: "devicon", name: "typescript" },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -84,10 +84,10 @@ export class TauriProjectGateway implements ProjectGateway {
|
||||
|
||||
updateProjectSettings(
|
||||
projectId: string,
|
||||
settings: ProjectSettings,
|
||||
settings: Partial<ProjectSettings>,
|
||||
): Promise<ProjectSettings> {
|
||||
return invoke<ProjectSettings>("update_project_settings", {
|
||||
request: { projectId, themeColor: settings.themeColor },
|
||||
request: { projectId, ...settings },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
15
frontend/src/adapters/userSettings.test.ts
Normal file
15
frontend/src/adapters/userSettings.test.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const invoke = vi.fn();
|
||||
vi.mock("@tauri-apps/api/core", () => ({ invoke: (...args: unknown[]) => invoke(...args) }));
|
||||
|
||||
import { TauriUserSettingsGateway } from "./userSettings";
|
||||
|
||||
describe("TauriUserSettingsGateway", () => {
|
||||
beforeEach(() => invoke.mockReset().mockResolvedValue({ defaultAgentTerminalInterface: null, language: "en" }));
|
||||
|
||||
it("persists language without overwriting unrelated user settings", async () => {
|
||||
await new TauriUserSettingsGateway().updateUserSettings({ language: "en" });
|
||||
expect(invoke).toHaveBeenCalledWith("update_user_settings", { request: { language: "en" } });
|
||||
});
|
||||
});
|
||||
@ -7,7 +7,7 @@ export class TauriUserSettingsGateway implements UserSettingsGateway {
|
||||
return invoke<UserSettings>("read_user_settings");
|
||||
}
|
||||
|
||||
updateUserSettings(settings: UserSettings): Promise<UserSettings> {
|
||||
updateUserSettings(settings: Partial<UserSettings>): Promise<UserSettings> {
|
||||
return invoke<UserSettings>("update_user_settings", { request: settings });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user