From 3c0e774050ad03a9299e424744f2fbe96da07833 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 22 Jun 2026 03:21:53 -0700 Subject: [PATCH] [eric] apps: card History action + grid-level branch toast --- frontend/src/app/pages/Views/ViewCard.tsx | 18 ++++++++++- frontend/src/app/pages/Views/Views.tsx | 37 +++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/pages/Views/ViewCard.tsx b/frontend/src/app/pages/Views/ViewCard.tsx index c8d564d9..ba7f2815 100644 --- a/frontend/src/app/pages/Views/ViewCard.tsx +++ b/frontend/src/app/pages/Views/ViewCard.tsx @@ -6,6 +6,7 @@ import Tooltip from '@mui/material/Tooltip'; import EditIcon from '@mui/icons-material/Edit'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; +import HistoryIcon from '@mui/icons-material/History'; import Icon from '@mui/material/Icon'; import { Output } from '@/shared/state/outputsSlice'; import { useClaudeTokens } from '@/shared/styles/ThemeContext'; @@ -16,9 +17,10 @@ interface Props { onClick: () => void; onDelete: () => void; onRun: () => void; + onHistory: () => void; } -const ViewCard: React.FC = ({ output, onClick, onDelete, onRun }) => { +const ViewCard: React.FC = ({ output, onClick, onDelete, onRun, onHistory }) => { const c = useClaudeTokens(); return ( @@ -108,6 +110,20 @@ const ViewCard: React.FC = ({ output, onClick, onDelete, onRun }) => { + + { e.stopPropagation(); onHistory(); }} + sx={{ + bgcolor: c.bg.surface, + color: c.text.secondary, + boxShadow: c.shadow.sm, + '&:hover': { bgcolor: c.bg.elevated }, + }} + > + + + import('./ViewEditor')); @@ -27,6 +31,10 @@ const Views: React.FC = () => { const [editorOpen, setEditorOpen] = useState(false); const [editingOutput, setEditingOutput] = useState(null); const [runOutput, setRunOutput] = useState(null); + const [historyOutput, setHistoryOutput] = useState(null); + // Branch closes the history modal, which would unmount the panel before its own + // flash renders; surface the confirmation at the grid level so it survives. + const [branchToast, setBranchToast] = useState(false); useEffect(() => { dispatch(fetchOutputs()); @@ -161,6 +169,7 @@ const Views: React.FC = () => { onClick={() => handleEditView(output)} onDelete={() => handleDeleteView(output.id)} onRun={() => setRunOutput(output)} + onHistory={() => setHistoryOutput(output)} /> ))} @@ -174,6 +183,34 @@ const Views: React.FC = () => { onClose={() => setRunOutput(null)} /> )} + + {historyOutput && ( + setHistoryOutput(null)} + PaperProps={{ sx: { borderRadius: 3, bgcolor: c.bg.surface, width: 480, maxWidth: '92vw', height: '72vh' } }} + > + { setHistoryOutput(null); setBranchToast(true); }} + /> + + )} + + setBranchToast(false)} + anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} + > + setBranchToast(false)} + severity="success" + sx={{ bgcolor: c.status.successBg, color: c.status.success, border: `1px solid rgba(38,91,25,0.25)` }} + > + Saved as a new app. Find it at the top of your apps. + + ); };