Files
kandev/apps/web/components/app-sidebar/sections/settings/executors-group.tsx
T
João Salavisa 2d653c962d feat(i18n): localize the app sidebar, settings nav tree and status bar (#2214)
Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 18:02:58 +02:00

50 lines
1.4 KiB
TypeScript

"use client";
import { IconCpu } from "@tabler/icons-react";
import { useTranslation } from "react-i18next";
import { useAppStore } from "@/components/state-provider";
import { getExecutorIcon } from "@/lib/executor-icons";
import { SettingsGroup, SettingsLeaf } from "./settings-nav-primitives";
const ROOT_HREF = "/settings/executors";
type ExecutorsGroupProps = {
pathname: string;
expanded?: boolean;
onToggle?: () => void;
};
export function ExecutorsGroup({ pathname, expanded, onToggle }: ExecutorsGroupProps) {
const { t } = useTranslation();
const executors = useAppStore((s) => s.executors.items);
const allProfiles = executors.flatMap((executor) =>
(executor.profiles ?? []).map((profile) => ({ ...profile, executorType: executor.type })),
);
return (
<SettingsGroup
label={t("common:executors")}
icon={IconCpu}
href={ROOT_HREF}
isActive={pathname === ROOT_HREF}
expanded={expanded}
onToggle={onToggle}
>
{allProfiles.map((profile) => {
const Icon = getExecutorIcon(profile.executorType);
const profilePath = `${ROOT_HREF}/${profile.id}`;
return (
<SettingsLeaf
key={profile.id}
href={profilePath}
label={profile.name}
icon={Icon}
isActive={pathname === profilePath}
depth={1}
/>
);
})}
</SettingsGroup>
);
}