["t"],
): string {
const fallback = channelDisplayName(feature);
return channelTranslator(t, channelUiOwner(feature.name))("displayName", fallback);
}
export function channelIsRunning(feature: NanobotFeatureInfo): boolean {
return feature.runtime_status === "running";
}
export function channelStatusLabel(
feature: NanobotFeatureInfo,
tx: (key: string, fallback: string) => string,
): string {
if (feature.runtime_status === "failed") {
return tx("settings.channels.runtimeFailed", "Failed");
}
if (feature.runtime_status === "starting") {
return tx("settings.channels.runtimeStarting", "Starting");
}
if (channelIsRunning(feature)) return tx("settings.values.on", "On");
if (feature.enabled) return tx("settings.channels.runtimeStopped", "Not running");
if (feature.configured === false) return tx("settings.channels.needsConfig", "Needs setup");
if (feature.configured === true) return tx("settings.nanobotFeatures.ready", "Ready");
return tx("settings.values.off", "Off");
}
export function ChannelStatusBadge({
children,
status,
}: {
children: ReactNode;
status?: ChannelRuntimeStatus;
}) {
return (
{children}
);
}
export function ChannelRuntimeError({
message,
className = "mt-3",
}: {
message?: string;
className?: string;
}) {
const { t } = useTranslation();
if (!message) return null;
return (
{channelValidationMessage(message, t)}
);
}