From 93170cb5137a4c831f4f6e384161f40836ef2493 Mon Sep 17 00:00:00 2001 From: HuiMi24 Date: Sat, 14 Mar 2026 20:22:02 +0800 Subject: [PATCH 01/10] feat: switch to vertical slide preview with click-to-edit single slide --- frontend/src/App.jsx | 58 +++++++++++++++++++++++++++-------------- frontend/src/styles.css | 53 ++++++++++++++++++++++++++++++------- 2 files changed, 81 insertions(+), 30 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 22d915c..4c5850e 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -42,6 +42,7 @@ export default function App() { const [loading, setLoading] = useState(false) const [notice, setNotice] = useState('') const [previewImages, setPreviewImages] = useState([]) + const [selectedSlideIndex, setSelectedSlideIndex] = useState(0) const [chatInput, setChatInput] = useState('') const [messages, setMessages] = useState([ { role: 'assistant', text: 'Enter a topic and click "Generate PPT". Then continue editing through chat.' }, @@ -55,11 +56,17 @@ export default function App() { })) }, [doc]) + const selectedSlide = useMemo( + () => titleAndBody.find((s) => s.slide_index === selectedSlideIndex) || titleAndBody[0] || null, + [titleAndBody, selectedSlideIndex], + ) + const loadPPT = async (path = pptPath) => { setLoading(true) try { const data = await api(`/api/ppt?path=${encodeURIComponent(path)}`) setDoc(data) + setSelectedSlideIndex(0) setPptPath(path) const preview = await api(`/api/ppt/preview?path=${encodeURIComponent(path)}`) setPreviewImages(preview.images || []) @@ -254,28 +261,39 @@ export default function App() { - {previewImages.length > 0 && ( -
- {previewImages.map((img, idx) => ( - {`Slide - ))} -
- )} - {!doc &&
Start by entering a topic and generating a PPT from the left panel.
} {doc && ( -
- {titleAndBody.map((slide) => ( -
-

Slide {slide.slide_index + 1}

- {slide.editableShapes.map((sh) => ( -