Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
0.7: the jar's Undo toast says Undo once (#332)
Oleksandr Ivanchenko3eb52b5a6b06
diff --git a/frontend/src/components/ideas/IdeaJarView.tsx b/frontend/src/components/ideas/IdeaJarView.tsxindex f79036e4..0cc9f50d 100644--- a/frontend/src/components/ideas/IdeaJarView.tsx+++ b/frontend/src/components/ideas/IdeaJarView.tsx@@ -326,7 +326,7 @@ export const IdeaJarView: React.FC<IdeaJarViewProps> = ({ spaceId, onOpenMissionleaving(idea.id);setN(idea.id, null);replace({ ...idea, status: 'later', updated_at: new Date().toISOString() });- setToast({ kind: 'later', id: idea.id, text: 'Moved to Later · Undo' });+ setToast({ kind: 'later', id: idea.id, text: 'Moved to Later' });try {const r = await ideasApi.later(idea.id);replace(r);@@ -386,7 +386,7 @@ export const IdeaJarView: React.FC<IdeaJarViewProps> = ({ spaceId, onOpenMissionleaving(idea.id);if (toastRef.current?.kind === 'delete') commitDelete(toastRef.current.id);setHidden((h) => new Set(h).add(idea.id));- setToast({ kind: 'delete', id: idea.id, text: 'Idea deleted · Undo' });+ setToast({ kind: 'delete', id: idea.id, text: 'Idea deleted' });if (phoneTake === idea.id) setPhoneTake(null);};diff --git a/frontend/tests/ideaJar.test.mjs b/frontend/tests/ideaJar.test.mjsindex d556d183..4bda5897 100644--- a/frontend/tests/ideaJar.test.mjs+++ b/frontend/tests/ideaJar.test.mjs@@ -353,7 +353,18 @@ test('Do it error: rose alert, nothing created, the button comes back', async ()// ---------------------------------------------------------------------------------------------------// Later, Restore, Edit, Delete-test('Later is optimistic with "Moved to Later · Undo"; Undo calls restore', async () => {+/** The toast's live text is just the message, and "Undo" is said once: by the button (S8). */+const assertOneUndo = (toast, message) => {+ assert.ok(toast, 'the Undo toast shows');+ const live = toast.querySelector('[role="status"]');+ assert.equal(text(live.querySelector('span')), message);+ assert.equal((live.textContent.match(/Undo/g) || []).length, 1, 'Undo is announced once');+ const undo = toast.querySelector('[data-undo]');+ assert.equal(text(undo), 'Undo', 'sighted users still see the one Undo button');+ assert.equal(undo.tagName, 'BUTTON');+};++test('Later is optimistic with "Moved to Later" and one Undo; Undo calls restore', async () => {reset();const readyIdea = FIX.ideas.find((i) => i.status === 'ready');routes[`POST /api/ideas/${ID.ready}/later`] = [200, { idea: { ...readyIdea, status: 'later' } }];@@ -363,7 +374,7 @@ test('Later is optimistic with "Moved to Later · Undo"; Undo calls restore', asassert.equal(sectionOfCard(host, ID.ready), null, 'Later is folded, so the card is out of view');assert.ok(!host.querySelector('[data-section="ready"]'));const toast = host.querySelector('[data-undo-toast]');- assert.match(text(toast), /^Moved to Later · Undo/);+ assertOneUndo(toast, 'Moved to Later');assert.ok(document.activeElement && document.activeElement !== document.body, 'focus never drops to body');await click(toast.querySelector('[data-undo]'));assert.ok(calls.some((c) => c.method === 'POST' && c.path.endsWith('/restore')));@@ -413,7 +424,7 @@ test('Edit opens in place; Save and put back PATCHes and the idea is back in theassert.equal(sectionOfCard(host, ID.ready), 'jar');});-test('Delete hides it with "Idea deleted · Undo" and only calls DELETE when the toast ends; Undo keeps it', async () => {+test('Delete hides it with "Idea deleted" and one Undo, and only calls DELETE when the toast ends; Undo keeps it', async () => {reset();routes[`DELETE /api/ideas/${ID.fresh}`] = () => new Response(null, { status: 204 });const host = await jar();@@ -421,7 +432,7 @@ test('Delete hides it with "Idea deleted · Undo" and only calls DELETE when theawait click(card(host, ID.fresh).querySelector('[data-menu-item="delete"]'));assert.equal(card(host, ID.fresh), null);let toast = host.querySelector('[data-undo-toast]');- assert.match(text(toast), /^Idea deleted · Undo/);+ assertOneUndo(toast, 'Idea deleted');assert.ok(!calls.some((c) => c.method === 'DELETE'), 'not yet');await click(toast.querySelector('[data-undo]'));assert.ok(card(host, ID.fresh), 'Undo brings it back');