Files
kandev/apps/web/components/app-sidebar/sections/settings/agents-group.tsx
T
João Salavisa b6848712f8 feat(i18n): localize Settings → Agents (#2193)
Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 12:16:25 +02:00

52 lines
1.6 KiB
TypeScript

"use client";
import { useTranslation } from "react-i18next";
import { IconRobot } from "@tabler/icons-react";
import { AgentLogo } from "@/components/agent-logo";
import { useAppStore } from "@/components/state-provider";
import { useAvailableAgents } from "@/hooks/domains/settings/use-available-agents";
import { SettingsGroup, SettingsLeaf } from "./settings-nav-primitives";
const ROOT_HREF = "/settings/agents";
type AgentsGroupProps = {
pathname: string;
expanded?: boolean;
onToggle?: () => void;
};
export function AgentsGroup({ pathname, expanded, onToggle }: AgentsGroupProps) {
const { t } = useTranslation();
const agents = useAppStore((s) => s.settingsAgents.items);
useAvailableAgents();
return (
<SettingsGroup
label={t("common:agents")}
icon={IconRobot}
href={ROOT_HREF}
isActive={pathname === ROOT_HREF}
expanded={expanded}
onToggle={onToggle}
>
{agents.flatMap((agent) =>
agent.profiles.map((profile) => {
const encodedAgent = encodeURIComponent(agent.name);
const profilePath = `${ROOT_HREF}/${encodedAgent}/profiles/${profile.id}`;
const agentLabel = profile.agentDisplayName || agent.name;
return (
<SettingsLeaf
key={profile.id}
href={profilePath}
label={`${agentLabel} • ${profile.name}`}
leadingIcon={<AgentLogo agentName={agent.name} className="h-3.5 w-3.5 shrink-0" />}
isActive={pathname === profilePath}
depth={1}
/>
);
}),
)}
</SettingsGroup>
);
}