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

[issue-1853] Consolidate bespoke modal/drawer overlays onto shared components

[._.]/ Adam Eivyb6196a71f9cb
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 1e64de4275..cf9800a684 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -40,6 +40,7 @@
## UX & Accessibility
+- **[issue-1853] Consolidated remaining hand-rolled overlays onto the shared `Modal`/`Drawer` components** — `ConversationViewer`, the digital-twin Documents tab's "create document" and "delete document" dialogs, and the CoS task "mark as blocked" dialog had their own bespoke `fixed inset-0` backdrop markup at inconsistent opacities (`bg-black/50` vs `bg-black/70`); they now render through `<Modal>`, picking up its standardized backdrop, Esc/click-outside handling, and stacking behavior for free. The calendar event-detail panel — a bespoke right-side slide-in that duplicated `Drawer`'s mobile-full-width/desktop-~520px/backdrop/Esc behavior — now renders through `<Drawer>` directly, and `Drawer`'s close button is bumped from 40px to the project's 44px minimum touch target (#1850) so the conversion doesn't regress that fix; the bump applies to every `Drawer` consumer. (#1853)
- **[issue-1850] Calendar and message action buttons now meet the 44px minimum touch-target size** — the day/week/month calendar nav chevrons, the event-detail close button, and the message-detail action row (Reply / Voice / AI Reply / Refresh / Archive / Delete) previously rendered at ~28–31px, below the WCAG 2.5.5 / Apple HIG 44px minimum and awkward to tap on mobile. Each now enforces `min-w-[44px] min-h-[44px]` with centered icons, matching the shared `Drawer` close-button pattern, without changing the visual layout. (#1850)
## Internal
diff --git a/client/src/components/Drawer.jsx b/client/src/components/Drawer.jsx
index c735b661d3..b756ae67f5 100644
--- a/client/src/components/Drawer.jsx
+++ b/client/src/components/Drawer.jsx
@@ -47,7 +47,7 @@ export default function Drawer({
<button
type="button"
onClick={onClose}
- className="p-2 rounded-lg text-gray-400 hover:text-white hover:bg-port-border/50 min-h-[40px] min-w-[40px] flex items-center justify-center"
+ className="p-2 rounded-lg text-gray-400 hover:text-white hover:bg-port-border/50 min-h-[44px] min-w-[44px] flex items-center justify-center"
aria-label="Close settings"
>
<X className="w-5 h-5" />
diff --git a/client/src/components/brain/ConversationViewer.jsx b/client/src/components/brain/ConversationViewer.jsx
index 4911e22319..d3776c3222 100644
--- a/client/src/components/brain/ConversationViewer.jsx
+++ b/client/src/components/brain/ConversationViewer.jsx
@@ -4,6 +4,7 @@ import * as api from '../../services/api';
import Banner from '../ui/Banner';
import BrailleSpinner from '../BrailleSpinner';
import MarkdownOutput from '../cos/MarkdownOutput';
+import Modal from '../ui/Modal';
/**
* Full-transcript viewer for an imported ChatGPT conversation. The Memory
@@ -25,47 +26,38 @@ export default function ConversationViewer({ record, onClose }) {
return () => { active = false; };
}, [record.sourceRef]);
- // Close on Escape.
- useEffect(() => {
- const onKey = (e) => { if (e.key === 'Escape') onClose(); };
- window.addEventListener('keydown', onKey);
- return () => window.removeEventListener('keydown', onKey);
- }, [onClose]);
-
return (
- <div
- className="fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4"
- onClick={onClose}
+ <Modal
+ open
+ onClose={onClose}
+ size="xl"
+ ariaLabel={record.title}
+ panelClassName="bg-port-card border border-port-border rounded-lg max-h-[85vh] flex flex-col"
>
- <div
- className="bg-port-card border border-port-border rounded-lg w-full max-w-3xl max-h-[85vh] flex flex-col"
- onClick={(e) => e.stopPropagation()}
- >
- <div className="flex items-center justify-between px-4 py-3 border-b border-port-border">
- <h3 className="font-medium text-white truncate pr-4">{record.title}</h3>
- <button
- onClick={onClose}
- className="text-gray-400 hover:text-white flex-shrink-0"
- aria-label="Close conversation viewer"
- >
- <X size={18} />
- </button>
- </div>
- <div className="overflow-y-auto p-4">
- {loading && (
- <div className="text-center py-12 text-gray-400">
- <BrailleSpinner /> Loading conversation…
- </div>
- )}
- {error && (
- <Banner tone="error" size="sm">
- Couldn't load the full transcript ({error}). Showing the preview instead.
- <div className="mt-2 text-sm text-gray-300 whitespace-pre-wrap">{record.content}</div>
- </Banner>
- )}
- {archive && <MarkdownOutput content={archive.transcript || record.content} />}
- </div>
+ <div className="flex items-center justify-between px-4 py-3 border-b border-port-border">
+ <h3 className="font-medium text-white truncate pr-4">{record.title}</h3>
+ <button
+ onClick={onClose}
+ className="text-gray-400 hover:text-white flex-shrink-0"
+ aria-label="Close conversation viewer"
+ >
+ <X size={18} />
+ </button>
+ </div>
+ <div className="overflow-y-auto p-4">
+ {loading && (
+ <div className="text-center py-12 text-gray-400">
+ <BrailleSpinner /> Loading conversation…
+ </div>
+ )}
+ {error && (
+ <Banner tone="error" size="sm">
+ Couldn't load the full transcript ({error}). Showing the preview instead.
+ <div className="mt-2 text-sm text-gray-300 whitespace-pre-wrap">{record.content}</div>
+ </Banner>
+ )}
+ {archive && <MarkdownOutput content={archive.transcript || record.content} />}
</div>
- </div>
+ </Modal>
);
}
diff --git a/client/src/components/calendar/EventDetail.jsx b/client/src/components/calendar/EventDetail.jsx
index 54e381fb21..0d01ed05b0 100644
--- a/client/src/components/calendar/EventDetail.jsx
+++ b/client/src/components/calendar/EventDetail.jsx
@@ -1,5 +1,6 @@
-import { X, MapPin, Clock, Users, Repeat, CalendarDays } from 'lucide-react';
+import { MapPin, Clock, Users, Repeat, CalendarDays } from 'lucide-react';
import { formatEventDateTime } from '../../utils/formatters';
+import Drawer from '../Drawer';
const RSVP_STYLES = {
accepted: 'bg-port-success/20 text-port-success',
@@ -10,125 +11,104 @@ const RSVP_STYLES = {
export default function EventDetail({ event, onClose }) {
return (
- <div className="fixed inset-0 z-50 flex justify-end">
- <div
- role="button"
- tabIndex={0}
- aria-label="Close panel"
- className="absolute inset-0 bg-black/50"
- onClick={onClose}
- onKeyDown={(e) => (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ') && onClose()}
- />
- <div className="relative w-full max-w-md bg-port-card border-l border-port-border overflow-y-auto animate-slide-in-right">
- <div className="sticky top-0 bg-port-card border-b border-port-border p-4 flex items-center justify-between">
- <h2 className="text-lg font-semibold text-white truncate">{event.title}</h2>
- <button
- onClick={onClose}
- className="p-1 min-w-[44px] min-h-[44px] flex items-center justify-center text-gray-400 hover:text-white rounded transition-colors"
- aria-label="Close"
- >
- <X size={20} />
- </button>
+ <Drawer open onClose={onClose} title={event.title}>
+ <div className="space-y-4">
+ {/* Time */}
+ <div className="flex items-start gap-3">
+ <Clock size={16} className="text-gray-500 mt-0.5 shrink-0" />
+ <div className="text-sm text-gray-300">
+ {event.isAllDay ? (
+ <div className="flex items-center gap-2">
+ <CalendarDays size={14} className="text-port-accent" />
+ <span>All day</span>
+ </div>
+ ) : (
+ <>
+ <div>{formatEventDateTime(event.startTime)}</div>
+ <div className="text-gray-500">to</div>
+ <div>{formatEventDateTime(event.endTime)}</div>
+ </>
+ )}
+ {event.isAllDay && (
+ <div className="mt-1 text-gray-500">{formatEventDateTime(event.startTime, { allDay: true })}</div>
+ )}
+ </div>
</div>
- <div className="p-4 space-y-4">
- {/* Time */}
+ {/* Location */}
+ {event.location && (
<div className="flex items-start gap-3">
- <Clock size={16} className="text-gray-500 mt-0.5 shrink-0" />
- <div className="text-sm text-gray-300">
- {event.isAllDay ? (
- <div className="flex items-center gap-2">
- <CalendarDays size={14} className="text-port-accent" />
- <span>All day</span>
- </div>
- ) : (
- <>
- <div>{formatEventDateTime(event.startTime)}</div>
- <div className="text-gray-500">to</div>
- <div>{formatEventDateTime(event.endTime)}</div>
- </>
- )}
- {event.isAllDay && (
- <div className="mt-1 text-gray-500">{formatEventDateTime(event.startTime, { allDay: true })}</div>
- )}
- </div>
+ <MapPin size={16} className="text-gray-500 mt-0.5 shrink-0" />
+ <span className="text-sm text-gray-300">{event.location}</span>
</div>
+ )}
- {/* Location */}
- {event.location && (
- <div className="flex items-start gap-3">
- <MapPin size={16} className="text-gray-500 mt-0.5 shrink-0" />
- <span className="text-sm text-gray-300">{event.location}</span>
- </div>
- )}
-
- {/* Recurrence */}
- {event.recurrence && (
- <div className="flex items-start gap-3">
- <Repeat size={16} className="text-gray-500 mt-0.5 shrink-0" />
- <span className="text-sm text-gray-300">Recurring event</span>
- </div>
- )}
+ {/* Recurrence */}
+ {event.recurrence && (
+ <div className="flex items-start gap-3">
+ <Repeat size={16} className="text-gray-500 mt-0.5 shrink-0" />
+ <span className="text-sm text-gray-300">Recurring event</span>
+ </div>
+ )}
- {/* Description */}
- {event.description && (
- <div className="p-3 bg-port-bg rounded-lg border border-port-border">
- <p className="text-sm text-gray-400 whitespace-pre-wrap break-words">{event.description}</p>
- </div>
- )}
+ {/* Description */}
+ {event.description && (
+ <div className="p-3 bg-port-bg rounded-lg border border-port-border">
+ <p className="text-sm text-gray-400 whitespace-pre-wrap break-words">{event.description}</p>
+ </div>
+ )}
- {/* Organizer */}
- {event.organizer && (
- <div>
- <h3 className="text-xs font-medium text-gray-500 uppercase mb-2">Organizer</h3>
- <div className="text-sm text-gray-300">
- {event.organizer.name || event.organizer.email}
- {event.organizer.name && event.organizer.email && (
- <span className="text-gray-500 ml-1">({event.organizer.email})</span>
- )}
- </div>
+ {/* Organizer */}
+ {event.organizer && (
+ <div>
+ <h3 className="text-xs font-medium text-gray-500 uppercase mb-2">Organizer</h3>
+ <div className="text-sm text-gray-300">
+ {event.organizer.name || event.organizer.email}
+ {event.organizer.name && event.organizer.email && (
+ <span className="text-gray-500 ml-1">({event.organizer.email})</span>
+ )}
</div>
- )}
+ </div>
+ )}
- {/* Attendees */}
- {event.attendees?.length > 0 && (
- <div>
- <h3 className="text-xs font-medium text-gray-500 uppercase mb-2 flex items-center gap-2">
- <Users size={14} />
- Attendees ({event.attendees.length})
- </h3>
- <div className="space-y-1.5">
- {event.attendees.map((attendee, i) => (
- <div
- key={i}
- className="flex items-center justify-between p-2 bg-port-bg rounded border border-port-border"
- >
- <div className="text-sm text-gray-300 truncate">
- {attendee.name || attendee.email}
- {attendee.name && attendee.email && (
- <span className="text-gray-500 ml-1 text-xs">({attendee.email})</span>
- )}
- </div>
- <span className={`px-2 py-0.5 text-[10px] font-medium rounded shrink-0 ${RSVP_STYLES[attendee.status] || RSVP_STYLES.none}`}>
- {attendee.status || 'none'}
- </span>
+ {/* Attendees */}
+ {event.attendees?.length > 0 && (
+ <div>
+ <h3 className="text-xs font-medium text-gray-500 uppercase mb-2 flex items-center gap-2">
+ <Users size={14} />
+ Attendees ({event.attendees.length})
+ </h3>
+ <div className="space-y-1.5">
+ {event.attendees.map((attendee, i) => (
+ <div
+ key={i}
+ className="flex items-center justify-between p-2 bg-port-bg rounded border border-port-border"
+ >
+ <div className="text-sm text-gray-300 truncate">
+ {attendee.name || attendee.email}
+ {attendee.name && attendee.email && (
+ <span className="text-gray-500 ml-1 text-xs">({attendee.email})</span>
+ )}
</div>
- ))}
- </div>
+ <span className={`px-2 py-0.5 text-[10px] font-medium rounded shrink-0 ${RSVP_STYLES[attendee.status] || RSVP_STYLES.none}`}>
+ {attendee.status || 'none'}
+ </span>
+ </div>
+ ))}
</div>
- )}
+ </div>
+ )}
- {/* Response status */}
- {event.myStatus && event.myStatus !== 'none' && event.myStatus !== 'unknown' && (
- <div>
- <h3 className="text-xs font-medium text-gray-500 uppercase mb-2">Your Response</h3>
- <span className={`px-2 py-1 text-xs font-medium rounded ${RSVP_STYLES[event.myStatus] || RSVP_STYLES.none}`}>
- {event.myStatus}
- </span>
- </div>
- )}
- </div>
+ {/* Response status */}
+ {event.myStatus && event.myStatus !== 'none' && event.myStatus !== 'unknown' && (
+ <div>
+ <h3 className="text-xs font-medium text-gray-500 uppercase mb-2">Your Response</h3>
+ <span className={`px-2 py-1 text-xs font-medium rounded ${RSVP_STYLES[event.myStatus] || RSVP_STYLES.none}`}>
+ {event.myStatus}
+ </span>
+ </div>
+ )}
</div>
- </div>
+ </Drawer>
);
}
diff --git a/client/src/components/calendar/EventDetail.test.jsx b/client/src/components/calendar/EventDetail.test.jsx
index 7fbc80f99d..2cbc73efcd 100644
--- a/client/src/components/calendar/EventDetail.test.jsx
+++ b/client/src/components/calendar/EventDetail.test.jsx
@@ -13,7 +13,7 @@ const baseEvent = {
describe('EventDetail', () => {
it('renders a close button that meets the 44px minimum touch target', () => {
render(<EventDetail event={baseEvent} onClose={() => {}} />);
- const closeBtn = screen.getByRole('button', { name: 'Close' });
+ const closeBtn = screen.getByRole('button', { name: 'Close settings' });
expect(closeBtn.className).toContain('min-w-[44px]');
expect(closeBtn.className).toContain('min-h-[44px]');
// icon stays visually centered
@@ -24,7 +24,7 @@ describe('EventDetail', () => {
it('invokes onClose when the close button is clicked', () => {
const onClose = vi.fn();
render(<EventDetail event={baseEvent} onClose={onClose} />);
- fireEvent.click(screen.getByRole('button', { name: 'Close' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Close settings' }));
expect(onClose).toHaveBeenCalledTimes(1);
});
});
diff --git a/client/src/components/cos/tabs/TaskItem.jsx b/client/src/components/cos/tabs/TaskItem.jsx
index 99fc6431f3..ab8ce7bbfb 100644
--- a/client/src/components/cos/tabs/TaskItem.jsx
+++ b/client/src/components/cos/tabs/TaskItem.jsx
@@ -23,6 +23,7 @@ import { filterSelectableModels } from '../../../utils/providers';
import { formatDurationMin, formatBytes } from '../../../utils/formatters';
import ConfirmButtonPair from '../../ui/ConfirmButtonPair';
import { useConfirmDelete } from '../../../hooks/useConfirmDelete';
+import Modal from '../../ui/Modal';
const statusIcons = {
pending: <Clock size={16} aria-hidden="true" className="text-yellow-500" />,
@@ -450,50 +451,47 @@ export default function TaskItem({ task, isSystem, awaitingApproval, onRefresh,
</div>
{/* Blocked Reason Modal */}
- {showBlockedModal && (
- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50" onClick={() => setShowBlockedModal(false)}>
- <div
- className="bg-port-card border border-port-border rounded-lg p-4 w-full max-w-md mx-4"
- onClick={e => e.stopPropagation()}
- role="dialog"
- aria-labelledby="blocked-modal-title"
+ <Modal
+ open={showBlockedModal}
+ onClose={() => setShowBlockedModal(false)}
+ size="sm"
+ ariaLabelledBy="blocked-modal-title"
+ panelClassName="bg-port-card border border-port-border rounded-lg p-4"
+ >
+ <h3 id="blocked-modal-title" className="text-white font-medium mb-3 flex items-center gap-2">
+ <Ban size={18} className="text-port-error" aria-hidden="true" />
+ Mark Task as Blocked
+ </h3>
+ <p className="text-sm text-gray-400 mb-3">
+ What&apos;s blocking this task? This helps track dependencies and unblock work.
+ </p>
+ <input
+ ref={blockedInputRef}
+ type="text"
+ value={blockedReason}
+ onChange={e => setBlockedReason(e.target.value)}
+ onKeyDown={e => {
+ if (e.key === 'Enter') handleConfirmBlocked();
+ if (e.key === 'Escape') setShowBlockedModal(false);
+ }}
+ placeholder="e.g., Waiting for API access, Needs design review..."
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm mb-4"
+ />
+ <div className="flex justify-end gap-2">
+ <button
+ onClick={() => setShowBlockedModal(false)}
+ className="px-3 py-1.5 text-sm text-gray-400 hover:text-white transition-colors"
>
- <h3 id="blocked-modal-title" className="text-white font-medium mb-3 flex items-center gap-2">
- <Ban size={18} className="text-port-error" aria-hidden="true" />
- Mark Task as Blocked
- </h3>
- <p className="text-sm text-gray-400 mb-3">
- What&apos;s blocking this task? This helps track dependencies and unblock work.
- </p>
- <input
- ref={blockedInputRef}
- type="text"
- value={blockedReason}
- onChange={e => setBlockedReason(e.target.value)}
- onKeyDown={e => {
- if (e.key === 'Enter') handleConfirmBlocked();
- if (e.key === 'Escape') setShowBlockedModal(false);
- }}
- placeholder="e.g., Waiting for API access, Needs design review..."
- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm mb-4"
- />
- <div className="flex justify-end gap-2">
- <button
- onClick={() => setShowBlockedModal(false)}
- className="px-3 py-1.5 text-sm text-gray-400 hover:text-white transition-colors"
- >
- Cancel
- </button>
- <button
- onClick={handleConfirmBlocked}
- className="px-3 py-1.5 bg-port-error/20 hover:bg-port-error/30 text-port-error rounded-lg text-sm transition-colors min-h-[40px]"
- >
- Mark Blocked
- </button>
- </div>
- </div>
+ Cancel
+ </button>
+ <button
+ onClick={handleConfirmBlocked}
+ className="px-3 py-1.5 bg-port-error/20 hover:bg-port-error/30 text-port-error rounded-lg text-sm transition-colors min-h-[40px]"
+ >
+ Mark Blocked
+ </button>
</div>
- )}
+ </Modal>
</div>
);
}
diff --git a/client/src/components/digital-twin/tabs/DocumentsTab.jsx b/client/src/components/digital-twin/tabs/DocumentsTab.jsx
index caa4056b4b..94fd2f7c3c 100644
--- a/client/src/components/digital-twin/tabs/DocumentsTab.jsx
+++ b/client/src/components/digital-twin/tabs/DocumentsTab.jsx
@@ -13,6 +13,7 @@ import {
} from 'lucide-react';
import * as api from '../../../services/api';
import toast from '../../ui/Toast';
+import Modal from '../../ui/Modal';
import { DOCUMENT_CATEGORIES } from '../constants';
import { timeAgo } from '../../../utils/formatters';
@@ -306,106 +307,112 @@ export default function DocumentsTab({ onRefresh }) {
</div>
{/* Create Document Modal */}
- {showCreate && (
- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
- <div className="bg-port-card rounded-lg border border-port-border w-full max-w-lg p-4 sm:p-6 max-h-[90vh] overflow-y-auto">
- <h2 className="text-lg font-semibold text-white mb-4">Create Soul Document</h2>
+ <Modal
+ open={showCreate}
+ onClose={() => {
+ setShowCreate(false);
+ setNewDoc({ filename: '', title: '', category: 'core', content: '' });
+ }}
+ ariaLabel="Create Soul Document"
+ panelClassName="bg-port-card rounded-lg border border-port-border p-4 sm:p-6 max-h-[90vh] overflow-y-auto"
+ >
+ <h2 className="text-lg font-semibold text-white mb-4">Create Soul Document</h2>
- <div className="space-y-4">
- <div>
- <label className="block text-sm text-gray-400 mb-1">Filename</label>
- <input
- type="text"
- value={newDoc.filename}
- onChange={(e) => setNewDoc({ ...newDoc, filename: e.target.value })}
- placeholder="DOCUMENT_NAME.md"
- className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
- />
- </div>
-
- <div>
- <label className="block text-sm text-gray-400 mb-1">Title</label>
- <input
- type="text"
- value={newDoc.title}
- onChange={(e) => setNewDoc({ ...newDoc, title: e.target.value })}
- placeholder="Document title"
- className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
- />
- </div>
+ <div className="space-y-4">
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Filename</label>
+ <input
+ type="text"
+ value={newDoc.filename}
+ onChange={(e) => setNewDoc({ ...newDoc, filename: e.target.value })}
+ placeholder="DOCUMENT_NAME.md"
+ className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
+ />
+ </div>
- <div>
- <label className="block text-sm text-gray-400 mb-1">Category</label>
- <select
- value={newDoc.category}
- onChange={(e) => setNewDoc({ ...newDoc, category: e.target.value })}
- className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
- >
- {Object.entries(DOCUMENT_CATEGORIES).map(([key, config]) => (
- <option key={key} value={key}>{config.label}</option>
- ))}
- </select>
- </div>
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Title</label>
+ <input
+ type="text"
+ value={newDoc.title}
+ onChange={(e) => setNewDoc({ ...newDoc, title: e.target.value })}
+ placeholder="Document title"
+ className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
+ />
+ </div>
- <div>
- <label className="block text-sm text-gray-400 mb-1">Content</label>
- <textarea
- value={newDoc.content}
- onChange={(e) => setNewDoc({ ...newDoc, content: e.target.value })}
- placeholder="# Document Title&#10;&#10;Content here..."
- rows={8}
- className="w-full px-3 py-3 bg-port-bg border border-port-border rounded-lg text-white font-mono text-sm"
- />
- </div>
- </div>
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Category</label>
+ <select
+ value={newDoc.category}
+ onChange={(e) => setNewDoc({ ...newDoc, category: e.target.value })}
+ className="w-full px-3 py-3 min-h-[44px] bg-port-bg border border-port-border rounded-lg text-white"
+ >
+ {Object.entries(DOCUMENT_CATEGORIES).map(([key, config]) => (
+ <option key={key} value={key}>{config.label}</option>
+ ))}
+ </select>
+ </div>
- <div className="flex flex-col-reverse sm:flex-row justify-end gap-3 mt-6">
- <button
- onClick={() => {
- setShowCreate(false);
- setNewDoc({ filename: '', title: '', category: 'core', content: '' });
- }}
- className="px-4 py-3 min-h-[44px] text-gray-400 hover:text-white transition-colors"
- >
- Cancel
- </button>
- <button
- onClick={handleCreate}
- disabled={saving}
- className="px-4 py-3 min-h-[44px] bg-port-accent text-white rounded-lg hover:bg-port-accent/80 disabled:opacity-50"
- >
- {saving ? 'Creating...' : 'Create'}
- </button>
- </div>
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Content</label>
+ <textarea
+ value={newDoc.content}
+ onChange={(e) => setNewDoc({ ...newDoc, content: e.target.value })}
+ placeholder="# Document Title&#10;&#10;Content here..."
+ rows={8}
+ className="w-full px-3 py-3 bg-port-bg border border-port-border rounded-lg text-white font-mono text-sm"
+ />
</div>
</div>
- )}
+
+ <div className="flex flex-col-reverse sm:flex-row justify-end gap-3 mt-6">
+ <button
+ onClick={() => {
+ setShowCreate(false);
+ setNewDoc({ filename: '', title: '', category: 'core', content: '' });
+ }}
+ className="px-4 py-3 min-h-[44px] text-gray-400 hover:text-white transition-colors"
+ >
+ Cancel
+ </button>
+ <button
+ onClick={handleCreate}
+ disabled={saving}
+ className="px-4 py-3 min-h-[44px] bg-port-accent text-white rounded-lg hover:bg-port-accent/80 disabled:opacity-50"
+ >
+ {saving ? 'Creating...' : 'Create'}
+ </button>
+ </div>
+ </Modal>
{/* Delete Confirmation Modal */}
- {deleteConfirm && (
- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
- <div className="bg-port-card rounded-lg border border-port-border p-4 sm:p-6 w-full max-w-md">
- <h2 className="text-lg font-semibold text-white mb-2">Delete Document?</h2>
- <p className="text-gray-400 mb-6">
- This action cannot be undone. The document will be permanently deleted.
- </p>
- <div className="flex flex-col-reverse sm:flex-row justify-end gap-3">
- <button
- onClick={() => setDeleteConfirm(null)}
- className="px-4 py-3 min-h-[44px] text-gray-400 hover:text-white transition-colors"
- >
- Cancel
- </button>
- <button
- onClick={() => handleDelete(deleteConfirm)}
- className="px-4 py-3 min-h-[44px] bg-red-500 text-white rounded-lg hover:bg-red-600"
- >
- Delete
- </button>
- </div>
- </div>
+ <Modal
+ open={!!deleteConfirm}
+ onClose={() => setDeleteConfirm(null)}
+ size="sm"
+ ariaLabel="Delete Document?"
+ panelClassName="bg-port-card rounded-lg border border-port-border p-4 sm:p-6"
+ >
+ <h2 className="text-lg font-semibold text-white mb-2">Delete Document?</h2>
+ <p className="text-gray-400 mb-6">
+ This action cannot be undone. The document will be permanently deleted.
+ </p>
+ <div className="flex flex-col-reverse sm:flex-row justify-end gap-3">
+ <button
+ onClick={() => setDeleteConfirm(null)}
+ className="px-4 py-3 min-h-[44px] text-gray-400 hover:text-white transition-colors"
+ >
+ Cancel
+ </button>
+ <button
+ onClick={() => handleDelete(deleteConfirm)}
+ className="px-4 py-3 min-h-[44px] bg-red-500 text-white rounded-lg hover:bg-red-600"
+ >
+ Delete
+ </button>
</div>
- )}
+ </Modal>
</div>
);
}