Skip to content

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

fix: demote Archive/Delete on app rows into a '…' menu behind an inline confirm (#3286)

[._.]/ Adam Eivy1312dfda418e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index e69e548c70..c55ae4ff4a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -112,3 +112,6 @@
## Data Manager
- **[issue-3285] Every directory on the Data Manager now says what it holds and whether it is safe to remove.** Seven of the thirteen biggest rows — including the single largest one — were labelled "Unknown category", and because an unrecognised directory also fell back to "not archivable, not deletable", the cleanup page silently refused to act on the very things filling the disk. All ~65 directories PortOS creates under `data/` are now classified with a real description and honest archive/purge flags: LoRA training checkpoints and the managed Python virtualenv are purgeable and say what survives, while generated sprite art, training datasets and 3D meshes are explicitly protected as the only copy. A directory that genuinely has no classification now reads "Not classified — PortOS does not know if this is safe to remove" and explains that Archive and Purge are being withheld on purpose, and a new test fails the build if a future data directory ships without an entry.
+## Apps
+
+- **[issue-3286] Delete is no longer the loudest button on an app row.** Every app card rendered `Archive`, `Manage` and a red-tinted `Delete` as three equal-weight buttons, so the most destructive and rarest action was the highest-contrast control on the page — sixteen permanently-armed Delete buttons stacked down the list, sitting a thumb's width from `Manage` once the row wrapped on a phone. `Archive` and `Delete` now live behind a per-row "…" menu (arrow keys, Escape, and 40px touch targets included), `Manage` is the row's single filled primary, the app name reads as an actual link, and deleting asks for an inline confirmation naming the app before anything is removed.
\ No newline at end of file
diff --git a/client/src/components/ui/OverflowMenu.jsx b/client/src/components/ui/OverflowMenu.jsx
new file mode 100644
index 0000000000..f062038dc3
--- /dev/null
+++ b/client/src/components/ui/OverflowMenu.jsx
@@ -0,0 +1,103 @@
+import { useCallback, useEffect, useRef, useState } from 'react';
+import { MoreHorizontal } from 'lucide-react';
+import useClickOutside from '../../hooks/useClickOutside';
+import useEscapeKey from '../../hooks/useEscapeKey';
+
+// "…" overflow menu for demoting rare/destructive row actions out of the
+// always-visible control set, so the row keeps a single primary affordance.
+// Keyboard: ArrowDown from the trigger opens and focuses the first item,
+// ArrowUp/ArrowDown cycle, Escape closes and returns focus to the trigger.
+// Items are >=40px tall so they stay tappable on a phone.
+//
+// Tones pre-compose full Tailwind class names — the JIT scans for complete
+// tokens, so `text-port-${tone}` would NOT generate the utility.
+const TONES = {
+ default: 'text-gray-300 hover:bg-port-border hover:text-white',
+ danger: 'text-port-error hover:bg-port-error/15',
+};
+
+const ITEM_SELECTOR = '[role="menuitem"]:not(:disabled)';
+
+export default function OverflowMenu({ label, items = [], className = '' }) {
+ const [open, setOpen] = useState(false);
+ const wrapperRef = useRef(null);
+ const triggerRef = useRef(null);
+ const menuRef = useRef(null);
+
+ const close = useCallback((refocus) => {
+ setOpen(false);
+ if (refocus) triggerRef.current?.focus();
+ }, []);
+
+ useClickOutside(wrapperRef, open, () => setOpen(false));
+ useEscapeKey(open, () => close(true));
+
+ useEffect(() => {
+ if (open) menuRef.current?.querySelector(ITEM_SELECTOR)?.focus();
+ }, [open]);
+
+ // Nothing to demote (e.g. a row whose destructive actions are all withheld) —
+ // render no trigger rather than an empty menu.
+ if (items.length === 0) return null;
+
+ const moveFocus = (dir) => {
+ const nodes = Array.from(menuRef.current?.querySelectorAll(ITEM_SELECTOR) || []);
+ if (!nodes.length) return;
+ const idx = nodes.indexOf(document.activeElement);
+ const next = idx === -1 ? nodes[dir > 0 ? 0 : nodes.length - 1] : nodes[(idx + dir + nodes.length) % nodes.length];
+ next?.focus();
+ };
+
+ const handleMenuKeyDown = (e) => {
+ if (e.key === 'ArrowDown') {
+ e.preventDefault();
+ moveFocus(1);
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ moveFocus(-1);
+ } else if (e.key === 'Tab') {
+ setOpen(false);
+ }
+ };
+
+ return (
+ <div className={`relative ${className}`.trim()} ref={wrapperRef}>
+ <button
+ type="button"
+ ref={triggerRef}
+ onClick={() => setOpen(v => !v)}
+ onKeyDown={(e) => { if (e.key === 'ArrowDown') { e.preventDefault(); setOpen(true); } }}
+ aria-haspopup="menu"
+ aria-expanded={open}
+ aria-label={label}
+ title={label}
+ className="px-2 py-1.5 min-h-[40px] sm:min-h-0 inline-flex items-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-border transition-colors focus:outline-hidden focus:ring-2 focus:ring-port-accent"
+ >
+ <MoreHorizontal size={16} aria-hidden="true" />
+ </button>
+ {open && (
+ <div
+ ref={menuRef}
+ role="menu"
+ aria-label={label}
+ onKeyDown={handleMenuKeyDown}
+ className="absolute right-0 top-full mt-1 z-30 min-w-[11rem] rounded-lg border border-port-border bg-port-card shadow-lg py-1"
+ >
+ {items.map(item => (
+ <button
+ key={item.id}
+ type="button"
+ role="menuitem"
+ disabled={item.disabled}
+ onClick={() => { close(true); item.onSelect?.(); }}
+ className={`w-full px-3 py-2 min-h-[40px] text-left text-xs flex items-center gap-2 transition-colors disabled:opacity-50 focus:outline-hidden focus:bg-port-border/70 ${TONES[item.tone] || TONES.default}`}
+ >
+ {item.icon ? <item.icon size={14} aria-hidden="true" /> : null}
+ <span>{item.label}</span>
+ </button>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/client/src/components/ui/OverflowMenu.test.jsx b/client/src/components/ui/OverflowMenu.test.jsx
new file mode 100644
index 0000000000..18c3b78e78
--- /dev/null
+++ b/client/src/components/ui/OverflowMenu.test.jsx
@@ -0,0 +1,94 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import OverflowMenu from './OverflowMenu';
+
+const items = (overrides = {}) => ([
+ { id: 'archive', label: 'Archive', onSelect: vi.fn(), ...overrides.archive },
+ { id: 'delete', label: 'Delete', tone: 'danger', onSelect: vi.fn(), ...overrides.delete },
+]);
+
+describe('OverflowMenu', () => {
+ it('renders nothing when there are no items', () => {
+ const { container } = render(<OverflowMenu label="More actions" items={[]} />);
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it('keeps items hidden until the trigger is clicked', async () => {
+ const user = userEvent.setup();
+ render(<OverflowMenu label="More actions" items={items()} />);
+
+ expect(screen.queryByRole('menu')).toBeNull();
+ expect(screen.queryByRole('menuitem', { name: 'Delete' })).toBeNull();
+
+ const trigger = screen.getByRole('button', { name: 'More actions' });
+ expect(trigger.getAttribute('aria-expanded')).toBe('false');
+ await user.click(trigger);
+
+ expect(screen.getByRole('menu')).toBeTruthy();
+ expect(trigger.getAttribute('aria-expanded')).toBe('true');
+ expect(screen.getByRole('menuitem', { name: 'Archive' })).toBeTruthy();
+ expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeTruthy();
+ });
+
+ it('invokes onSelect and closes the menu when an item is chosen', async () => {
+ const user = userEvent.setup();
+ const list = items();
+ render(<OverflowMenu label="More actions" items={list} />);
+
+ await user.click(screen.getByRole('button', { name: 'More actions' }));
+ await user.click(screen.getByRole('menuitem', { name: 'Delete' }));
+
+ expect(list[1].onSelect).toHaveBeenCalledTimes(1);
+ expect(list[0].onSelect).not.toHaveBeenCalled();
+ expect(screen.queryByRole('menu')).toBeNull();
+ expect(document.activeElement).toBe(screen.getByRole('button', { name: 'More actions' }));
+ });
+
+ it('is keyboard operable: ArrowDown opens and focuses the first item, arrows cycle, Escape closes', async () => {
+ const user = userEvent.setup();
+ render(<OverflowMenu label="More actions" items={items()} />);
+
+ const trigger = screen.getByRole('button', { name: 'More actions' });
+ trigger.focus();
+ await user.keyboard('{ArrowDown}');
+ expect(document.activeElement).toBe(screen.getByRole('menuitem', { name: 'Archive' }));
+
+ await user.keyboard('{ArrowDown}');
+ expect(document.activeElement).toBe(screen.getByRole('menuitem', { name: 'Delete' }));
+ await user.keyboard('{ArrowUp}');
+ expect(document.activeElement).toBe(screen.getByRole('menuitem', { name: 'Archive' }));
+
+ await user.keyboard('{Escape}');
+ expect(screen.queryByRole('menu')).toBeNull();
+ expect(document.activeElement).toBe(trigger);
+ });
+
+ it('skips disabled items when moving focus and never fires their handler', async () => {
+ const user = userEvent.setup();
+ const list = items({ archive: { disabled: true } });
+ render(<OverflowMenu label="More actions" items={list} />);
+
+ await user.click(screen.getByRole('button', { name: 'More actions' }));
+ expect(document.activeElement).toBe(screen.getByRole('menuitem', { name: 'Delete' }));
+
+ await user.click(screen.getByRole('menuitem', { name: 'Archive' }));
+ expect(list[0].onSelect).not.toHaveBeenCalled();
+ });
+
+ it('closes on an outside click', async () => {
+ const user = userEvent.setup();
+ render(
+ <div>
+ <button type="button">outside</button>
+ <OverflowMenu label="More actions" items={items()} />
+ </div>
+ );
+
+ await user.click(screen.getByRole('button', { name: 'More actions' }));
+ expect(screen.getByRole('menu')).toBeTruthy();
+
+ await user.click(screen.getByRole('button', { name: 'outside' }));
+ expect(screen.queryByRole('menu')).toBeNull();
+ });
+});
diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsx
index 9be304b071..82816f3880 100644
--- a/client/src/pages/Apps.jsx
+++ b/client/src/pages/Apps.jsx
@@ -1,8 +1,9 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router-dom';
-import { ExternalLink, Gamepad2, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore, Ticket, Download, Hammer, Smartphone } from 'lucide-react';
+import { ExternalLink, Gamepad2, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore, Ticket, Download, Hammer, Smartphone, Trash2 } from 'lucide-react';
import toast from '../components/ui/Toast';
-import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
+import InlineConfirmRow from '../components/ui/InlineConfirmRow';
+import OverflowMenu from '../components/ui/OverflowMenu';
import AppIcon from '../components/AppIcon';
import BrailleSpinner from '../components/BrailleSpinner';
import PageSkeleton from '../components/ui/PageSkeleton';
@@ -228,7 +229,16 @@ export default function Apps() {
</div>
<div className="min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-2">
- <Link to={`/apps/${app.id}`} className={`font-medium hover:underline ${app.archived ? 'text-gray-400' : 'text-white'}`}>{app.name}</Link>
+ <Link
+ to={`/apps/${app.id}`}
+ className={`font-medium underline decoration-dotted underline-offset-4 hover:decoration-solid transition-colors ${
+ app.archived
+ ? 'text-gray-400 decoration-gray-600 hover:text-gray-200'
+ : 'text-port-accent decoration-port-accent/50 hover:text-white'
+ }`}
+ >
+ {app.name}
+ </Link>
{app.archived && (
<span className="px-1.5 py-0.5 bg-port-warning/20 text-port-warning text-xs rounded">
Archived
@@ -364,56 +374,54 @@ export default function Apps() {
</div>
)}
- {/* Edit/Delete Actions */}
- {confirmingDelete === app.id ? (
- <ConfirmButtonPair
- prompt="Remove?"
- confirmText="Yes"
- cancelText="No"
- ariaLabel={`Confirm deletion of ${app.name}`}
- onConfirm={() => handleDelete(app)}
- onCancel={() => setConfirmingDelete(null)}
- />
- ) : (
- <div className="flex items-center gap-2">
- {/* Archive/Unarchive button (hidden for PortOS baseline) */}
- {app.id !== api.PORTOS_APP_ID && (
- <button
- onClick={() => app.archived ? handleUnarchive(app) : handleArchive(app)}
- disabled={archiving[app.id]}
- className={`px-3 py-1.5 min-h-[40px] sm:min-h-0 rounded-lg text-xs flex items-center gap-1 transition-colors disabled:opacity-50 border ${
- app.archived
- ? 'bg-port-success/20 text-port-success border-port-success/30 hover:bg-port-success/30'
- : 'bg-port-border text-gray-400 border-port-border hover:text-white hover:bg-port-border/80'
- }`}
- aria-label={app.archived ? `Unarchive ${app.name}` : `Archive ${app.name}`}
- >
- {app.archived ? <ArchiveRestore size={14} /> : <Archive size={14} />}
- {archiving[app.id] ? '...' : app.archived ? 'Unarchive' : 'Archive'}
- </button>
- )}
- <div className="inline-flex rounded-lg overflow-hidden border border-port-border">
- <Link
- to={`/apps/${app.id}/overview`}
- className="px-3 py-1.5 min-h-[40px] sm:min-h-0 inline-flex items-center bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors text-xs focus:outline-hidden focus:ring-2 focus:ring-port-accent"
- aria-label={`Manage ${app.name}`}
- >
- Manage
- </Link>
- {app.id !== api.PORTOS_APP_ID && (
- <button
- onClick={() => setConfirmingDelete(app.id)}
- className="px-3 py-1.5 min-h-[40px] sm:min-h-0 bg-port-error/10 text-port-error hover:bg-port-error/20 transition-colors text-xs border-l border-port-border focus:outline-hidden focus:ring-2 focus:ring-port-error"
- aria-label={`Delete ${app.name}`}
- >
- Delete
- </button>
- )}
- </div>
- </div>
- )}
+ {/* Manage is the row's single primary action; the rare and
+ destructive ones (Archive/Delete) live behind the "…"
+ menu so Delete isn't the loudest control on the card. */}
+ <div className="flex items-center gap-2">
+ <Link
+ to={`/apps/${app.id}/overview`}
+ className="px-4 py-1.5 min-h-[40px] sm:min-h-0 inline-flex items-center rounded-lg bg-port-accent text-white hover:bg-port-accent/80 transition-colors text-xs font-medium focus:outline-hidden focus:ring-2 focus:ring-port-accent"
+ aria-label={`Manage ${app.name}`}
+ >
+ Manage
+ </Link>
+ {/* Archive + Delete are withheld for the PortOS baseline app */}
+ {app.id !== api.PORTOS_APP_ID && (
+ <OverflowMenu
+ label={`More actions for ${app.name}`}
+ items={[
+ {
+ id: 'archive',
+ label: archiving[app.id] ? 'Working…' : app.archived ? 'Unarchive' : 'Archive',
+ icon: app.archived ? ArchiveRestore : Archive,
+ disabled: !!archiving[app.id],
+ onSelect: () => (app.archived ? handleUnarchive(app) : handleArchive(app)),
+ },
+ {
+ id: 'delete',
+ label: 'Delete',
+ icon: Trash2,
+ tone: 'danger',
+ onSelect: () => setConfirmingDelete(app.id),
+ },
+ ]}
+ />
+ )}
+ </div>
</div>
</div>
+
+ {confirmingDelete === app.id && (
+ <InlineConfirmRow
+ className="mt-3"
+ question={`Delete ${app.name}? This removes it from PortOS and cannot be undone.`}
+ confirmText="Delete"
+ cancelText="Cancel"
+ aria-label={`Confirm deletion of ${app.name}`}
+ onConfirm={() => handleDelete(app)}
+ onCancel={() => setConfirmingDelete(null)}
+ />
+ )}
</div>
{/* Expanded Details */}
diff --git a/client/src/pages/Apps.test.jsx b/client/src/pages/Apps.test.jsx
new file mode 100644
index 0000000000..26f7c709b9
--- /dev/null
+++ b/client/src/pages/Apps.test.jsx
@@ -0,0 +1,130 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { MemoryRouter } from 'react-router-dom';
+
+const APPS = [
+ {
+ id: 'app-alpha',
+ name: 'Example App',
+ type: 'node',
+ icon: 'package',
+ repoPath: '/srv/example-app',
+ overallStatus: 'online',
+ pm2ProcessNames: ['example-server'],
+ processes: [{ name: 'example-server', ports: { http: 4000 } }],
+ },
+];
+
+vi.mock('../services/api', () => ({
+ PORTOS_APP_ID: 'portos-default',
+ getApps: vi.fn(() => Promise.resolve(APPS)),
+ deleteApp: vi.fn(() => Promise.resolve({})),
+ archiveApp: vi.fn(() => Promise.resolve({})),
+ unarchiveApp: vi.fn(() => Promise.resolve({})),
+ startApp: vi.fn(() => Promise.resolve({})),
+ stopApp: vi.fn(() => Promise.resolve({})),
+ restartApp: vi.fn(() => Promise.resolve({})),
+ launchNativeApp: vi.fn(() => Promise.resolve({})),
+ buildApp: vi.fn(() => Promise.resolve({})),
+ refreshAppConfig: vi.fn(() => Promise.resolve({})),
+ getMySprintTickets: vi.fn(() => Promise.resolve([])),
+ openAppInEditor: vi.fn(() => Promise.resolve({})),
+ openAppFolder: vi.fn(() => Promise.resolve({})),
+ handleSelfRestart: vi.fn(),
+}));
+
+vi.mock('../services/socket', () => ({
+ default: { on: vi.fn(), off: vi.fn(), emit: vi.fn() },
+}));
+
+import * as api from '../services/api';
+import Apps from './Apps';
+
+const renderApps = async () => {
+ render(<MemoryRouter><Apps /></MemoryRouter>);
+ await screen.findByRole('link', { name: 'Example App' });
+};
+
+const openRowMenu = async (user) => {
+ await user.click(screen.getByRole('button', { name: 'More actions for Example App' }));
+};
+
+describe('Apps row action hierarchy', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ api.getApps.mockResolvedValue(APPS);
+ });
+
+ it('keeps Archive and Delete out of the resting row, leaving Manage as the visible action', async () => {
+ await renderApps();
+
+ expect(screen.getByRole('link', { name: 'Manage Example App' })).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Stop Example App' })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: /^Delete$/ })).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Archive$/ })).toBeNull();
+ });
+
+ it('renders the app name as a link to its detail route', async () => {
+ await renderApps();
+
+ const nameLink = screen.getByRole('link', { name: 'Example App' });
+ expect(nameLink.getAttribute('href')).toBe('/apps/app-alpha');
+ // Underlined so the name reads as a link, not plain text.
+ expect(nameLink.className).toContain('underline');
+ });
+
+ it('exposes Archive and Delete only through the overflow menu', async () => {
+ const user = userEvent.setup();
+ await renderApps();
+
+ await openRowMenu(user);
+ expect(screen.getByRole('menuitem', { name: 'Archive' })).toBeTruthy();
+ expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeTruthy();
+ });
+
+ it('requires an inline confirm before deleting, and cancelling leaves the app alone', async () => {
+ const user = userEvent.setup();
+ await renderApps();
+
+ await openRowMenu(user);
+ await user.click(screen.getByRole('menuitem', { name: 'Delete' }));
+
+ expect(api.deleteApp).not.toHaveBeenCalled();
+ const confirm = screen.getByLabelText('Confirm deletion of Example App');
+ expect(confirm.textContent).toContain('cannot be undone');
+
+ await user.click(screen.getByRole('button', { name: 'Cancel' }));
+ expect(api.deleteApp).not.toHaveBeenCalled();
+ expect(screen.queryByLabelText('Confirm deletion of Example App')).toBeNull();
+ });
+
+ it('deletes only after the inline confirm is accepted', async () => {
+ const user = userEvent.setup();
+ await renderApps();
+
+ await openRowMenu(user);
+ await user.click(screen.getByRole('menuitem', { name: 'Delete' }));
+ await user.click(screen.getByRole('button', { name: 'Delete' }));
+
+ await waitFor(() => expect(api.deleteApp).toHaveBeenCalledWith('app-alpha'));
+ });
+
+ it('archives from the overflow menu', async () => {
+ const user = userEvent.setup();
+ await renderApps();
+
+ await openRowMenu(user);
+ await user.click(screen.getByRole('menuitem', { name: 'Archive' }));
+
+ await waitFor(() => expect(api.archiveApp).toHaveBeenCalledWith('app-alpha'));
+ });
+
+ it('withholds the overflow menu for the PortOS baseline app', async () => {
+ api.getApps.mockResolvedValue([{ ...APPS[0], id: 'portos-default', name: 'PortOS' }]);
+ render(<MemoryRouter><Apps /></MemoryRouter>);
+ await screen.findByRole('link', { name: 'Manage PortOS' });
+
+ expect(screen.queryByRole('button', { name: /More actions/ })).toBeNull();
+ });
+});