Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(ui): rename pinned panels
skygunner9801af3dc21e
diff --git a/apps/docs/content/docs/features/chat-and-teams.mdx b/apps/docs/content/docs/features/chat-and-teams.mdxindex 0f90a28511..14b4500752 100644--- a/apps/docs/content/docs/features/chat-and-teams.mdx+++ b/apps/docs/content/docs/features/chat-and-teams.mdx@@ -10,6 +10,12 @@ A bot is a durable agent identity. A thread is one conversation with that bot anUse separate threads when you want fresh context or independent work without duplicating the bot. Messages sent to a busy thread are queued, and supported providers can be steered while they work. Other threads can continue independently. See [Bots, folders, and threads](/docs/features/bots-and-tasks) for limits and shared-resource behavior.+## Keep a chat page close++In Advanced mode, choose **Pin to sidebar** on a bot's page in a one-to-one chat. Open it from the sidebar without finding the original message; it shows the latest version as the bot updates it. The pin stays on this device after a restart and does not publish the page or change who can access the conversation.++To rename or remove a pin, open **Settings → Appearance → Pinned panels**. You can also remove it with **Unpin** on the page. Up to six pages can be pinned.+## ReactionsPoint at a bot's message (or press and hold it on a touch screen) and choose the smiley to react with 👍, 👎, ❤️, 😂, 🎉 or 👀. Everyone in that conversation or group sees the reaction under the message, with who chose it. Each person has one reaction per message: picking another replaces yours, and choosing yours again takes it away.diff --git a/src/components/PinnedPanelsSettings.dom.test.ts b/src/components/PinnedPanelsSettings.dom.test.tsnew file mode 100644index 0000000000..590d586050--- /dev/null+++ b/src/components/PinnedPanelsSettings.dom.test.ts@@ -0,0 +1,84 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { setLocale } from "@/lib/i18n";+import { WEB_PANELS_KEY, setWebPanels } from "@/lib/web-panel-preferences";+import { parseWebPanels } from "@/lib/web-panels";+import { PinnedPanelsSettings } from "./PinnedPanelsSettings";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+const page = { botId: "b1", threadId: "t1", messageId: "m1" };+let root: Root;+const byLabel = (label: string) => document.querySelector<HTMLButtonElement>(`button[aria-label="${label}"]`)!;+const dialog = () => document.querySelector<HTMLElement>('[role="dialog"]')!;+const click = async (button: HTMLButtonElement) => { expect(button).toBeTruthy(); await act(async () => button.click()); };+const inputName = async (value: string) => {+ const input = dialog().querySelector<HTMLInputElement>("input")!;+ await act(async () => {+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(input, value);+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+};+const saved = () => parseWebPanels(localStorage.getItem(WEB_PANELS_KEY));++beforeEach(async () => {+ setLocale("en");+ localStorage.clear();+ setWebPanels([{ id: "panel-1", name: "Report", page }, { id: "panel-2", name: "CI", url: "https://ci.example/" }]);+ const host = document.createElement("div"); document.body.append(host);+ root = createRoot(host);+ await act(async () => root.render(createElement(PinnedPanelsSettings)));+});+afterEach(async () => { await act(async () => root.unmount()); document.body.innerHTML = ""; });++describe("renaming a pinned panel", () => {+ it("keeps the existing add-page flow working", async () => {+ await click([...document.querySelectorAll("button")].find((button) => button.textContent === "Add page")!);+ const [name, url] = [...dialog().querySelectorAll("input")];+ await act(async () => {+ for (const [input, value] of [[name!, "Dashboard"], [url!, "https://dashboard.example/"]] as const) {+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(input, value);+ input.dispatchEvent(new Event("input", { bubbles: true }));+ }+ });+ await click([...dialog().querySelectorAll("button")].find((button) => button.textContent === "Pin page")!);+ expect(saved().at(-1)).toMatchObject({ name: "Dashboard", url: "https://dashboard.example/" });+ });++ it("saves a new name and retains the chat page reference and other panels", async () => {+ await click(byLabel("Rename Report"));+ expect(dialog().querySelector<HTMLInputElement>("input")!.value).toBe("Report");+ await inputName(" Delivery ");+ await click([...dialog().querySelectorAll("button")].find((button) => button.textContent === "Rename")!);+ expect(saved()).toEqual([{ id: "panel-1", name: "Delivery", page }, { id: "panel-2", name: "CI", url: "https://ci.example/" }]);+ expect(byLabel("Rename Delivery")).toBeTruthy();+ await act(async () => { root.unmount(); });+ const host = document.createElement("div"); document.body.append(host); root = createRoot(host);+ await act(async () => root.render(createElement(PinnedPanelsSettings)));+ expect(byLabel("Rename Delivery")).toBeTruthy();+ });++ it("renames a web URL without losing an edit made while the dialog was open", async () => {+ await click(byLabel("Rename CI"));+ await act(async () => setWebPanels([...saved(), { id: "panel-3", name: "Notes", url: "https://notes.example/" }]));+ await inputName("Builds");+ await click([...dialog().querySelectorAll("button")].find((button) => button.textContent === "Rename")!);+ expect(saved()).toEqual([+ { id: "panel-1", name: "Report", page },+ { id: "panel-2", name: "Builds", url: "https://ci.example/" },+ { id: "panel-3", name: "Notes", url: "https://notes.example/" },+ ]);+ });++ it("keeps the old name on invalid input or cancel", async () => {+ await click(byLabel("Rename Report"));+ await inputName(" ");+ await click([...dialog().querySelectorAll("button")].find((button) => button.textContent === "Rename")!);+ expect(dialog().querySelector('[role="alert"]')).toBeTruthy();+ expect(saved()[0]).toEqual({ id: "panel-1", name: "Report", page });+ await inputName("Discard this");+ await click([...dialog().querySelectorAll("button")].find((button) => button.textContent === "Cancel")!);+ expect(saved()[0]).toEqual({ id: "panel-1", name: "Report", page });+ });+});diff --git a/src/components/PinnedPanelsSettings.tsx b/src/components/PinnedPanelsSettings.tsxindex c510dc80d7..fdfc4622f3 100644--- a/src/components/PinnedPanelsSettings.tsx+++ b/src/components/PinnedPanelsSettings.tsx@@ -1,7 +1,7 @@import { useState } from "react";import { t } from "@/lib/i18n";-import { setWebPanels, useWebPanels } from "@/lib/web-panel-preferences";+import { latestWebPanels, setWebPanels, useWebPanels } from "@/lib/web-panel-preferences";import { MAX_WEB_PANELS, MAX_WEB_PANEL_NAME, newWebPanelId, validateWebPanel } from "@/lib/web-panels";import { cn } from "@/lib/cn";@@ -17,6 +17,7 @@ export function PinnedPanelsSettings() {const full = panels.length >= MAX_WEB_PANELS;const [adding, setAdding] = useState(false);+ const [renaming, setRenaming] = useState<string | null>(null);const add = (): boolean => {const check = validateWebPanel({ name, url }, window.location.origin);if (!check.ok) {@@ -30,7 +31,13 @@ export function PinnedPanelsSettings() {return true;};- const close = () => { setAdding(false); setName(""); setUrl(""); setError(""); };+ const close = () => { setAdding(false); setRenaming(null); setName(""); setUrl(""); setError(""); };+ const rename = () => {+ const next = name.trim();+ if (!next || next.length > MAX_WEB_PANEL_NAME) { setError("name"); return; }+ setWebPanels(latestWebPanels().map((panel) => panel.id === renaming ? { ...panel, name: next } : panel));+ close();+ };return (<SettingsGroup label={t("webPanels.settings.title")} block="pinned-panels" description={t("webPanels.settings.short")}actions={<button type="button" className="ui-button" disabled={full} onClick={() => setAdding(true)}>{t("webPanels.settings.addPage")}</button>}@@ -39,12 +46,29 @@ export function PinnedPanelsSettings() {{panels.length === 0 && <SettingsEmptyRow>{t("webPanels.settings.empty")}</SettingsEmptyRow>}{panels.map((panel) => (<SettingRow key={panel.id} title={panel.name} subtitle={<span className="block truncate" title={panel.url}>{panel.url ?? t("webPanels.settings.chatPage")}</span>}>+ <button type="button" className="settings-quiet cursor-pointer" aria-label={`${t("rename.aria")} ${panel.name}`}+ onClick={() => { setName(panel.name); setRenaming(panel.id); }}>+ {t("rename.aria")}+ </button><button type="button" data-danger="" className="settings-quiet cursor-pointer" onClick={() => setWebPanels(panels.filter((entry) => entry.id !== panel.id))}>{t("webPanels.settings.remove")}</button></SettingRow>))}</SettingsRows>+ {renaming && (+ <SettingsDialog title={t("webPanels.settings.renamePage")} onClose={close}+ footer={<>+ <button type="button" className="ui-button" onClick={close}>{t("common.cancel")}</button>+ <button type="button" className="ui-button ui-button-primary" onClick={rename}>{t("rename.aria")}</button>+ </>}>+ <SettingsField label={t("webPanels.settings.renameName")}>+ <input value={name} maxLength={MAX_WEB_PANEL_NAME} aria-invalid={error === "name"} onChange={(event) => { setName(event.target.value); setError(""); }}+ onKeyDown={(event) => { if (event.key === "Enter") rename(); }} className={cn(SETTINGS_INPUT, error === "name" && "border-danger/60")} />+ </SettingsField>+ {error === "name" && <p role="alert" className="text-[12px] leading-4 text-danger">{t("webPanels.settings.nameInvalid", { max: MAX_WEB_PANEL_NAME })}</p>}+ </SettingsDialog>+ )}{adding && (<SettingsDialog title={t("webPanels.settings.addPage")} onClose={close}footer={<>diff --git a/src/locales/en.json b/src/locales/en.jsonindex e59d5631a7..c406d4a13b 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -7348,6 +7348,8 @@"webPanels.settings.url": "Page address","webPanels.settings.add": "Pin page","webPanels.settings.remove": "Remove",+ "webPanels.settings.renamePage": "Rename panel",+ "webPanels.settings.renameName": "New name","webPanels.settings.nameInvalid": "Give the panel a name of up to {max} characters.","webPanels.settings.urlInvalid": "Use a full http:// or https:// address without a user name or password.","webPanels.settings.urlSelf": "That's this app's own address. Pin a different page.",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 3a4225c3b5..68ad5987a7 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -6959,6 +6959,8 @@"webPanels.settings.url": "Endereço da página","webPanels.settings.add": "Fixar página","webPanels.settings.remove": "Remover",+ "webPanels.settings.renamePage": "Renomear painel",+ "webPanels.settings.renameName": "Novo nome","webPanels.settings.nameInvalid": "Dê ao painel um nome com até {max} caracteres.","webPanels.settings.urlInvalid": "Use um endereço http:// ou https:// completo, sem nome de usuário nem senha.","webPanels.settings.urlSelf": "Esse é o endereço deste app. Fixe outra página.",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex 2e355b71dd..4dfe389b1a 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -11473,6 +11473,8 @@"settings.threadDisplay.short": "在侧边栏显示线程列表。隐藏后历史记录仍会保留。","settings.pinnedCircles.short": "在侧边栏顶部以大头像显示固定的机器人。","settings.toolCalls.short": "在聊天中显示机器人运行的每个工具。错误总会显示。",+ "webPanels.settings.renamePage": "重命名面板",+ "webPanels.settings.renameName": "新名称","webPanels.settings.short": "把几个网页(例如本地仪表板)放在侧边栏中,一键即可打开。","webPanels.settings.addPage": "添加页面","webPanels.settings.empty": "还没有固定的页面。",