Commit ·
bdefe29
1
Parent(s): 9b1773a
Add delete confirmation dialog and sidebar spacing tweaks
Browse filesShow a confirmation dialog before deleting a conversation. Add
spacing between sidebar chat items and below the section header.
Show fun placeholder in output panel for running tools.
1 unmodified line234567891011121343 unmodified lines57585960616254556364655758596061626366676568697071727374757677787980818283848586110 unmodified lines19719819920020120220369 unmodified lines27327427525927627727827965 unmodified lines3453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244251 unmodified lineimport { Alert, Box, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Typography, CircularProgress,43 unmodified lines } }, [isCreatingSession, createSession, setPlan, clearPanel, onClose]);
// -- Delete with dialog confirmation ------------------------------------ const [confirmDeleteId, setConfirmDeleteId] = useState<string | null>(null);
const handleDelete = useCallback( async (sessionId: string, e: React.MouseEvent) => { const handleDeleteClick = useCallback( (sessionId: string, e: React.MouseEvent) => { e.stopPropagation(); useAgentStore.getState().clearSessionState(sessionId); try { await apiFetch(`/api/session/${sessionId}`, { method: 'DELETE' }); deleteSession(sessionId); } catch { deleteSession(sessionId); } setConfirmDeleteId(sessionId); }, [deleteSession], [], );
const handleDeleteConfirm = useCallback(async () => { if (!confirmDeleteId) return; const sessionId = confirmDeleteId; setConfirmDeleteId(null); useAgentStore.getState().clearSessionState(sessionId); try { await apiFetch(`/api/session/${sessionId}`, { method: 'DELETE' }); deleteSession(sessionId); } catch { deleteSession(sessionId); } }, [deleteSession, confirmDeleteId]);
const handleSelect = useCallback( (sessionId: string) => { switchSession(sessionId);110 unmodified lines px: 1.5, py: 0.875, mx: 0.75, mb: 0.2, borderRadius: '10px', cursor: 'pointer', transition: 'background-color 0.12s ease',69 unmodified lines <IconButton className="delete-btn" size="small" onClick={(e) => handleDelete(session.id, e)} onClick={(e) => handleDeleteClick(session.id, e)} sx={{ color: 'var(--muted-text)', width: 26,65 unmodified lines </Box>
</Box> {/* Delete confirmation dialog */} <Dialog open={!!confirmDeleteId} onClose={() => setConfirmDeleteId(null)} slotProps={{ backdrop: { sx: { backgroundColor: 'rgba(0,0,0,0.5)', backdropFilter: 'blur(4px)' } }, }} PaperProps={{ sx: { bgcolor: 'var(--panel)', border: '1px solid var(--border)', borderRadius: 'var(--radius-md)', boxShadow: 'var(--shadow-1)', maxWidth: 340, mx: 2, }, }} > <DialogTitle sx={{ color: 'var(--text)', fontWeight: 700, fontSize: '0.95rem', pb: 0, pt: 2.5, px: 3, }} > Delete conversation? </DialogTitle> <DialogContent sx={{ px: 3, pt: 1 }}> <DialogContentText sx={{ color: 'var(--muted-text)', fontSize: '0.82rem', lineHeight: 1.6, }} > This will permanently remove this conversation and its history. </DialogContentText> </DialogContent> <DialogActions sx={{ px: 3, pb: 2.5, gap: 1 }}> <Button onClick={() => setConfirmDeleteId(null)} size="small" sx={{ color: 'var(--muted-text)', fontSize: '0.82rem', px: 2, '&:hover': { bgcolor: 'var(--hover-bg)' }, }} > Cancel </Button> <Button onClick={handleDeleteConfirm} variant="contained" size="small" sx={{ fontSize: '0.82rem', px: 2.5, bgcolor: 'var(--accent-red)', color: '#fff', boxShadow: 'none', '&:hover': { bgcolor: 'var(--accent-red)', filter: 'brightness(1.15)', boxShadow: 'none', }, }} > Delete </Button> </DialogActions> </Dialog> </Box> );}frontend/src/components/SessionSidebar/SessionSidebar.tsx+103-11