@@ -52,8 +52,8 @@
type="submit"
disabled={isProcessing}
className={`p-3 rounded-lg text-white font-bold transition-colors flex-shrink-0 ${isProcessing
- ? "bg-gray-400 dark:bg-gray-600 cursor-not-allowed"
- : "bg-indigo-600 hover:bg-indigo-700"
+ ? "bg-gray-400 dark:bg-gray-600 cursor-not-allowed"
+ : "bg-indigo-600 hover:bg-indigo-700"
}`}
>
Send
diff --git a/ui/client-app/src/components/SessionSidebar.js b/ui/client-app/src/components/SessionSidebar.js
index 964b02d..028a60d 100644
--- a/ui/client-app/src/components/SessionSidebar.js
+++ b/ui/client-app/src/components/SessionSidebar.js
@@ -12,6 +12,7 @@
const [sessions, setSessions] = useState([]);
const [tokenHoverData, setTokenHoverData] = useState({});
const [isLoading, setIsLoading] = useState(false);
+ const [confirmModal, setConfirmModal] = useState({ isOpen: false, title: '', message: '', onConfirm: null });
useEffect(() => {
if (isOpen) fetchSessions();
@@ -37,26 +38,39 @@
} catch (err) { /* silent */ }
};
- const handleDelete = async (e, sessionId) => {
+ const handleDelete = (e, sessionId) => {
e.stopPropagation();
- if (!window.confirm('Delete this session?')) return;
- try {
- await deleteSession(sessionId);
- fetchSessions();
- if (Number(currentSessionId) === sessionId) {
- localStorage.removeItem(`sessionId_${featureName}`);
- if (onNewSession) onNewSession();
+ setConfirmModal({
+ isOpen: true,
+ title: 'Delete Session',
+ message: 'Are you sure you want to delete this session? This action cannot be undone.',
+ onConfirm: async () => {
+ try {
+ await deleteSession(sessionId);
+ fetchSessions();
+ if (Number(currentSessionId) === sessionId) {
+ localStorage.removeItem(`sessionId_${featureName}`);
+ if (onNewSession) onNewSession();
+ }
+ } catch { alert('Failed to delete session.'); }
}
- } catch { alert('Failed to delete session.'); }
+ });
};
- const handleDeleteAll = async () => {
- if (!window.confirm('Delete ALL history for this feature?')) return;
- try {
- await deleteAllSessions(featureName);
- fetchSessions();
- if (onNewSession) onNewSession();
- } catch { alert('Failed to delete all sessions.'); }
+ const handleDeleteAll = (e) => {
+ if (e) e.stopPropagation();
+ setConfirmModal({
+ isOpen: true,
+ title: 'Clear All History',
+ message: 'Are you sure you want to delete ALL history for this feature? This action is permanent.',
+ onConfirm: async () => {
+ try {
+ await deleteAllSessions(featureName);
+ fetchSessions();
+ if (onNewSession) onNewSession();
+ } catch { alert('Failed to delete all sessions.'); }
+ }
+ });
};
const formatDate = (iso) => {
@@ -86,7 +100,7 @@
{prettyFeatureName} History
-
@@ -134,6 +148,7 @@