2d653c962d
Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
50 lines
1.4 KiB
TypeScript
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>
|
|
);
|
|
}
|