Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep keyboard users from changing shared skills while it is unavailable
aivsomkarbd99681c7c7b
diff --git a/src/components/ShareLearnedSkillsSettings.test.ts b/src/components/ShareLearnedSkillsSettings.test.tsnew file mode 100644index 0000000000..4143e28924--- /dev/null+++ b/src/components/ShareLearnedSkillsSettings.test.ts@@ -0,0 +1,26 @@+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it, vi } from "vitest";++const storeFixture = vi.hoisted(() => ({ config: null as unknown }));+vi.mock("@/state/store", async (importOriginal) => {+ const original = await importOriginal<typeof import("@/state/store")>();+ return { ...original, useStore: () => ({ state: { ...original.initialState, config: storeFixture.config }, dispatch: vi.fn() }) };+});++import { ShareLearnedSkillsSettings } from "./ShareLearnedSkillsSettings";++const buttonsDisabled = () => [...renderToStaticMarkup(createElement(ShareLearnedSkillsSettings)).matchAll(/<button[^>]*role="radio"[^>]*>/g)]+ .map(([button]) => button.includes('disabled=""'));++describe("share learned skills", () => {+ it("cannot be changed, by mouse or keyboard, while skill authoring is off", () => {+ storeFixture.config = { features: { skillsLibrary: true, skillAuthoring: false } };+ expect(buttonsDisabled()).toEqual([true, true, true]);+ });++ it("can be changed while skill authoring is on", () => {+ storeFixture.config = { features: { skillsLibrary: true } };+ expect(buttonsDisabled()).toEqual([false, false, false]);+ });+});diff --git a/src/components/ShareLearnedSkillsSettings.tsx b/src/components/ShareLearnedSkillsSettings.tsxindex 59b4e716b2..bf4106329b 100644--- a/src/components/ShareLearnedSkillsSettings.tsx+++ b/src/components/ShareLearnedSkillsSettings.tsx@@ -1,6 +1,5 @@import { useState } from "react";-import { cn } from "@/lib/cn";import { shareLearnedSkillsMode, skillAuthoringEnabled, skillsLibraryEnabled } from "@/lib/feature-flags";import { t } from "@/lib/i18n";import { api, useStore, type ConfigStatus } from "@/state/store";@@ -43,10 +42,8 @@ export function ShareLearnedSkillsSettings() {<SettingRow title={t("settings.experimental.shareSkills")} tag={t("settings.early.tag")}subtitle={authoring ? <MoreText short={t("settings.experimental.shareSkillsShort")} long={t("settings.experimental.shareSkillsDetail")} /> : t("settings.experimental.shareSkillsNeedsAuthoring")}message={error ? <span role="alert" className="text-danger">{error}</span> : undefined}>- <span className={cn("contents", (saving || !authoring) && "[&_button]:pointer-events-none [&_[role=radiogroup]]:opacity-40")}>- <Segmented value={mode} label={t("settings.experimental.shareSkillsAria")} onChange={(next) => void choose(next)}- options={MODES.map((option) => ({ value: option.value, label: t(option.label) }))} />- </span>+ <Segmented value={mode} label={t("settings.experimental.shareSkillsAria")} disabled={saving || !authoring} onChange={(next) => void choose(next)}+ options={MODES.map((option) => ({ value: option.value, label: t(option.label) }))} /></SettingRow></div>);