Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

0.7: phone Undo toast clears the tab bar, jar Settings row, /idea any case (#330)

Oleksandr Ivanchenkoe108cd5630ce
diff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsx
index 713a5ada..ea19669f 100644
--- a/frontend/src/components/MissionBoardView.tsx
+++ b/frontend/src/components/MissionBoardView.tsx
@@ -1223,9 +1223,10 @@ export const BoardToolbar: React.FC<{
</div>
);
-/** One pending card action: it waits UNDO_MS before reaching the server, so Undo can take it back. */
+/** One pending card action: it waits UNDO_MS before reaching the server, so Undo can take it back.
+ * `kw-undo-toast` sits 16px up, or 8px over the phone tab bar while one is on screen (styles/ideaShell.css). */
export const UndoToast: React.FC<{ text: string; onUndo: () => void; onClose: () => void }> = ({ text, onUndo, onClose }) => (
- <div className="fixed inset-x-0 bottom-4 z-40 flex justify-center px-4 pointer-events-none" data-undo-toast>
+ <div className="kw-undo-toast fixed inset-x-0 z-40 flex justify-center px-4 pointer-events-none" data-undo-toast>
<div role="status" aria-live="polite" className="pointer-events-auto flex items-center gap-3 max-w-md w-full sm:w-auto px-4 py-2.5 rounded-xl border border-zinc-700 bg-zinc-900 shadow-2xl shadow-black/50">
<span className="min-w-0 flex-1 text-xs text-zinc-100 break-words">{text}</span>
<button type="button" onClick={onUndo} className={`shrink-0 min-h-[36px] px-3 rounded-lg text-xs font-semibold text-sky-300 hover:bg-sky-500/10 ${focusRing}`} data-undo>
diff --git a/frontend/src/components/SettingsModal.tsx b/frontend/src/components/SettingsModal.tsx
index bdc4b5f3..fcdd543d 100644
--- a/frontend/src/components/SettingsModal.tsx
+++ b/frontend/src/components/SettingsModal.tsx
@@ -856,12 +856,15 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({ isOpen, onClose, t
</div>
)}
- {proactive && (
+ {(proactive || ideaCap !== null) && (
<fieldset className="space-y-3 pt-2 border-t border-zinc-800" data-testid="proactive-settings">
<legend className="flex items-center gap-2 text-xs font-medium text-zinc-300 pt-3">
<Sparkles size={14} className="text-violet-300" aria-hidden="true" />
<span>Bots on their own</span>
</legend>
+ {/* The jar's row stands on its own: a server without decide_first still shows it (#323 S3). */}
+ {proactive && (
+ <>
<SwitchRow
id="decide-first"
label="Bots decide reversible choices themselves"
@@ -898,6 +901,8 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({ isOpen, onClose, t
</span>
</div>
</SwitchRow>
+ </>
+ )}
{ideaCap !== null && (
<SwitchRow
id="idea-jar"
diff --git a/frontend/src/styles/ideaShell.css b/frontend/src/styles/ideaShell.css
index eaf98499..cc4d1cc8 100644
--- a/frontend/src/styles/ideaShell.css
+++ b/frontend/src/styles/ideaShell.css
@@ -21,3 +21,18 @@
animation: none;
}
}
+
+/* Floating toasts and the phone tab bar (0.7 polish, Mira S7). One value for every view: the tab bar is
+ 57px (56px tabs and a 1px top border, PhoneTabBar) plus the home-indicator inset. While it is on
+ screen, the Undo toast sits 8px above it instead of covering Jar, Inbox and Space. Without a tab bar
+ (desktop, a phone chat or the board) it stays 16px from the bottom, as before. */
+:root {
+ --kw-tabbar-h: calc(57px + env(safe-area-inset-bottom, 0px));
+ --kw-toast-bottom: 1rem;
+}
+:root:has([data-tab-bar]) {
+ --kw-toast-bottom: calc(var(--kw-tabbar-h) + 8px);
+}
+.kw-undo-toast {
+ bottom: var(--kw-toast-bottom);
+}
diff --git a/frontend/tests/ideaShell.test.mjs b/frontend/tests/ideaShell.test.mjs
index 01c075b9..e7107264 100644
--- a/frontend/tests/ideaShell.test.mjs
+++ b/frontend/tests/ideaShell.test.mjs
@@ -22,6 +22,8 @@ const m = await loadBundled(`
export { PhoneTabBar } from './src/components/PhoneTabBar';
export { IdeaJarRow } from './src/components/IdeaJarRow';
export { IdeaDropToast } from './src/components/IdeaDropToast';
+ export { isIdeaCommand } from './src/ideas';
+ export { UndoToast } from './src/components/MissionBoardView';
`);
const h = m.React.createElement;
const settle = async () => { for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0)); };
@@ -211,3 +213,38 @@ test('Wiring: App catches idea_updated, skips the bubble for /idea; ChatView dre
const settings = readFileSync(new URL('../src/components/SettingsModal.tsx', import.meta.url), 'utf8');
assert.match(settings, /idea_jar_daily_cap/);
});
+
+test('/idea in any case (Rigel #320 N2): the composer catches /IDEA and /Idea, not /ideas or /ideal', () => {
+ for (const t of ['/idea x', '/IDEA x', '/Idea x', ' /iDeA\nx', '/IDEA']) assert.equal(m.isIdeaCommand(t), true, t);
+ for (const t of ['/ideas x', '/IDEAS x', '/ideal x', 'x /idea', 'idea x']) assert.equal(m.isIdeaCommand(t), false, t);
+ assert.equal(m.ideaLength('/IDEA a dark mode '), 11);
+});
+
+test('Settings (Mira #323 S3): the jar row renders without decide_first; the proactive rows stay behind it', () => {
+ const settings = readFileSync(new URL('../src/components/SettingsModal.tsx', import.meta.url), 'utf8');
+ assert.match(settings, /\{\(proactive \|\| ideaCap !== null\) && \(\s*<fieldset[^>]*data-testid="proactive-settings"/);
+ const inner = settings.slice(settings.indexOf('data-testid="proactive-settings"'), settings.indexOf('id="idea-jar"'));
+ assert.match(inner, /\{proactive && \(\s*<>\s*<SwitchRow\s+id="decide-first"/);
+ assert.match(inner, /<\/SwitchRow>\s*<\/>\s*\)\}\s*\{ideaCap !== null && \(/);
+});
+
+test('Undo toast (Mira S7): one shared offset clears the phone tab bar; 16px without one', async () => {
+ const css = readFileSync(new URL('../src/styles/ideaShell.css', import.meta.url), 'utf8');
+ assert.match(css, /--kw-tabbar-h: calc\(57px \+ env\(safe-area-inset-bottom, 0px\)\);/);
+ assert.match(css, /:root \{[^}]*--kw-toast-bottom: 1rem;/);
+ assert.match(css, /:root:has\(\[data-tab-bar\]\) \{\s*--kw-toast-bottom: calc\(var\(--kw-tabbar-h\) \+ 8px\);/);
+ assert.match(css, /\.kw-undo-toast \{\s*bottom: var\(--kw-toast-bottom\);/);
+ const { host, done } = await mount(h(m.UndoToast, { text: 'Deleted', onUndo() {}, onClose() {} }));
+ const wrap = host.querySelector('[data-undo-toast]');
+ assert.ok(wrap.classList.contains('kw-undo-toast'));
+ assert.ok(!wrap.className.split(/\s+/).some((c) => /^bottom-/.test(c)), 'no fixed Tailwind bottom-* left to fight the variable');
+ done();
+ for (const f of ['MissionBoardView.tsx', 'ideas/IdeaJarView.tsx']) {
+ const src = readFileSync(new URL(`../src/components/${f}`, import.meta.url), 'utf8');
+ assert.match(src, /<UndoToast /, `${f} uses the shared toast`);
+ }
+ const tabs = readFileSync(new URL('../src/components/PhoneTabBar.tsx', import.meta.url), 'utf8');
+ assert.match(tabs, /data-tab-bar/);
+ assert.match(tabs, /border-t /, 'the 1px top border is the 57th pixel');
+ assert.match(tabs, /h-14/);
+});