Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat([inline-confirm-row-primitive]): extract InlineConfirmRow primitive
[._.]/ Adam Eivy466842f3bcbf
diff --git a/client/src/components/brain/tabs/InboxTab.jsx b/client/src/components/brain/tabs/InboxTab.jsxindex 55a4c01581..da8b9f4392 100644--- a/client/src/components/brain/tabs/InboxTab.jsx+++ b/client/src/components/brain/tabs/InboxTab.jsx@@ -18,6 +18,7 @@ import {} from 'lucide-react';import BrailleSpinner from '../../BrailleSpinner';import toast from '../../ui/Toast';+import InlineConfirmRow from '../../ui/InlineConfirmRow';import {DESTINATIONS,@@ -384,23 +385,13 @@ export default function InboxTab({ onRefresh, settings }) {)}{confirmingDeleteId === entry.id ? (- <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded">- <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>- <button- onClick={() => handleDelete(entry.id)}- className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"- title="Confirm delete"- >- Delete- </button>- <button- onClick={() => setConfirmingDeleteId(null)}- className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"- title="Cancel delete"- >- Cancel- </button>- </div>+ <InlineConfirmRow+ question="Delete this entry? This cannot be undone."+ confirmTitle="Confirm delete"+ cancelTitle="Cancel delete"+ onConfirm={() => handleDelete(entry.id)}+ onCancel={() => setConfirmingDeleteId(null)}+ />) : editingId !== entry.id && (<div className="flex items-center gap-2 flex-wrap"><span className="text-xs text-gray-500">Route to:</span>@@ -509,23 +500,13 @@ export default function InboxTab({ onRefresh, settings }) {</div><p className="text-xs text-port-error mb-2">{entry.error?.message || 'Unknown error'}</p>{confirmingDeleteId === entry.id ? (- <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded">- <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>- <button- onClick={() => handleDelete(entry.id)}- className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"- title="Confirm delete"- >- Delete- </button>- <button- onClick={() => setConfirmingDeleteId(null)}- className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"- title="Cancel delete"- >- Cancel- </button>- </div>+ <InlineConfirmRow+ question="Delete this entry? This cannot be undone."+ confirmTitle="Confirm delete"+ cancelTitle="Cancel delete"+ onConfirm={() => handleDelete(entry.id)}+ onCancel={() => setConfirmingDeleteId(null)}+ />) : editingId !== entry.id && (<buttononClick={() => handleRetry(entry.id)}@@ -603,23 +584,14 @@ export default function InboxTab({ onRefresh, settings }) {</div>{confirmingDeleteId === entry.id && (- <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded mb-2">- <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>- <button- onClick={() => handleDelete(entry.id)}- className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"- title="Confirm delete"- >- Delete- </button>- <button- onClick={() => setConfirmingDeleteId(null)}- className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"- title="Cancel delete"- >- Cancel- </button>- </div>+ <InlineConfirmRow+ question="Delete this entry? This cannot be undone."+ className="mb-2"+ confirmTitle="Confirm delete"+ cancelTitle="Cancel delete"+ onConfirm={() => handleDelete(entry.id)}+ onCancel={() => setConfirmingDeleteId(null)}+ />)}<div className="flex items-center gap-2 flex-wrap">@@ -762,23 +734,14 @@ export default function InboxTab({ onRefresh, settings }) {</div>{confirmingDeleteId === entry.id && (- <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded mb-2">- <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>- <button- onClick={() => handleDelete(entry.id)}- className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"- title="Confirm delete"- >- Delete- </button>- <button- onClick={() => setConfirmingDeleteId(null)}- className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"- title="Cancel delete"- >- Cancel- </button>- </div>+ <InlineConfirmRow+ question="Delete this entry? This cannot be undone."+ className="mb-2"+ confirmTitle="Confirm delete"+ cancelTitle="Cancel delete"+ onConfirm={() => handleDelete(entry.id)}+ onCancel={() => setConfirmingDeleteId(null)}+ />)}<div className="flex items-center gap-2">diff --git a/client/src/components/brain/tabs/LinksTab.jsx b/client/src/components/brain/tabs/LinksTab.jsxindex 5d9c3664e4..12244dfa22 100644--- a/client/src/components/brain/tabs/LinksTab.jsx+++ b/client/src/components/brain/tabs/LinksTab.jsx@@ -24,6 +24,7 @@ import {} from 'lucide-react';import BrailleSpinner from '../../BrailleSpinner';import toast from '../../ui/Toast';+import InlineConfirmRow from '../../ui/InlineConfirmRow';import { timeAgo } from '../../../utils/formatters';import { useAutoRefetch } from '../../../hooks/useAutoRefetch';import BucketBoard from '../links/BucketBoard';@@ -596,21 +597,12 @@ export default function LinksTab({ onRefresh }) {{/* Delete confirmation */}{confirmingDeleteId === link.id && (- <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded mb-2">- <span className="text-xs text-white flex-1">Delete this link? This cannot be undone.</span>- <button- onClick={() => handleDelete(link.id)}- className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"- >- Delete- </button>- <button- onClick={() => setConfirmingDeleteId(null)}- className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"- >- Cancel- </button>- </div>+ <InlineConfirmRow+ question="Delete this link? This cannot be undone."+ className="mb-2"+ onConfirm={() => handleDelete(link.id)}+ onCancel={() => setConfirmingDeleteId(null)}+ />)}{/* Footer row */}diff --git a/client/src/components/ui/InlineConfirmRow.jsx b/client/src/components/ui/InlineConfirmRow.jsxnew file mode 100644index 0000000000..0d0d55efcf--- /dev/null+++ b/client/src/components/ui/InlineConfirmRow.jsx@@ -0,0 +1,53 @@+// Inline "question + confirm + cancel" row for destructive actions — the+// inline-confirmation pattern PortOS prefers over a two-click-arm button or a+// window.confirm() modal. Shaped for confirm/cancel prompts, which is why these+// don't reuse <Banner> (that's "icon + content + actions" alerts).+//+// Tones pre-compose full Tailwind class names — the JIT scans for complete+// tokens, so `bg-port-${tone}/10` would NOT generate the utility. Spell it out.+const TONES = {+ error: {+ wrapper: 'bg-port-error/10 border-port-error/30',+ confirm: 'bg-port-error text-white hover:bg-port-error/80',+ },+ warning: {+ wrapper: 'bg-port-warning/10 border-port-warning/30',+ confirm: 'bg-port-warning text-black hover:bg-port-warning/80',+ },+};++export default function InlineConfirmRow({+ question,+ confirmText = 'Delete',+ cancelText = 'Cancel',+ confirmTitle,+ cancelTitle,+ onConfirm,+ onCancel,+ tone = 'error',+ className = '',+}) {+ const t = TONES[tone] || TONES.error;++ return (+ <div className={`flex items-center gap-2 p-2 border rounded ${t.wrapper} ${className}`.trim()}>+ <span className="text-xs text-white flex-1">{question}</span>+ <button+ type="button"+ onClick={onConfirm}+ title={confirmTitle}+ className={`px-2 py-1 text-xs rounded transition-colors ${t.confirm}`}+ >+ {confirmText}+ </button>+ <button+ type="button"+ onClick={onCancel}+ title={cancelTitle}+ className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"+ >+ {cancelText}+ </button>+ </div>+ );+}diff --git a/client/src/components/ui/InlineConfirmRow.test.jsx b/client/src/components/ui/InlineConfirmRow.test.jsxnew file mode 100644index 0000000000..161319036d--- /dev/null+++ b/client/src/components/ui/InlineConfirmRow.test.jsx@@ -0,0 +1,67 @@+import { describe, it, expect, vi } from 'vitest';+import { render, screen, fireEvent } from '@testing-library/react';++import InlineConfirmRow from './InlineConfirmRow';++describe('InlineConfirmRow', () => {+ it('renders the question with default Delete/Cancel labels and error tone', () => {+ render(<InlineConfirmRow question="Delete this? This cannot be undone." />);+ expect(screen.getByText('Delete this? This cannot be undone.')).toBeTruthy();+ const wrapper = screen.getByText('Delete this? This cannot be undone.').closest('div');+ expect(wrapper.className).toContain('bg-port-error/10');+ expect(wrapper.className).toContain('border-port-error/30');+ const confirm = screen.getByRole('button', { name: 'Delete' });+ expect(confirm.className).toContain('bg-port-error');+ expect(screen.getByRole('button', { name: 'Cancel' })).toBeTruthy();+ });++ it('fires onConfirm and onCancel for the respective buttons', () => {+ const onConfirm = vi.fn();+ const onCancel = vi.fn();+ render(<InlineConfirmRow question="x" onConfirm={onConfirm} onCancel={onCancel} />);+ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ expect(onConfirm).toHaveBeenCalledTimes(1);+ expect(onCancel).toHaveBeenCalledTimes(1);+ });++ it('honors custom labels and button titles', () => {+ render(+ <InlineConfirmRow+ question="x"+ confirmText="Remove"+ cancelText="Keep"+ confirmTitle="Confirm delete"+ cancelTitle="Cancel delete"+ />,+ );+ const confirm = screen.getByRole('button', { name: 'Remove' });+ expect(confirm.getAttribute('title')).toBe('Confirm delete');+ expect(screen.getByRole('button', { name: 'Keep' }).getAttribute('title')).toBe('Cancel delete');+ });++ it('omits the title attribute when no title prop is supplied', () => {+ render(<InlineConfirmRow question="x" />);+ expect(screen.getByRole('button', { name: 'Delete' }).getAttribute('title')).toBeNull();+ });++ it('merges passthrough className after tone classes', () => {+ render(<InlineConfirmRow question="x" className="mb-2" />);+ const wrapper = screen.getByText('x').closest('div');+ expect(wrapper.className).toContain('mb-2');+ expect(wrapper.className).toContain('bg-port-error/10');+ });++ it('applies the warning tone when requested', () => {+ render(<InlineConfirmRow question="x" tone="warning" />);+ const wrapper = screen.getByText('x').closest('div');+ expect(wrapper.className).toContain('bg-port-warning/10');+ expect(screen.getByRole('button', { name: 'Delete' }).className).toContain('bg-port-warning');+ });++ it('renders buttons as type=button so they never submit a surrounding form', () => {+ render(<InlineConfirmRow question="x" />);+ expect(screen.getByRole('button', { name: 'Delete' }).getAttribute('type')).toBe('button');+ expect(screen.getByRole('button', { name: 'Cancel' }).getAttribute('type')).toBe('button');+ });+});