@@ -136,6 +136,25 @@ export default function App() {
136136 }
137137 }
138138
139+ const applyPresetImmediately = async ( presetName ) => {
140+ setForm ( ( f ) => ( { ...f , preset : presetName } ) )
141+ if ( ! pptPath ) return
142+
143+ setLoading ( true )
144+ try {
145+ const data = await api ( '/api/theme/apply-preset' , {
146+ method : 'POST' ,
147+ body : JSON . stringify ( { path : pptPath , preset : presetName } ) ,
148+ } )
149+ await loadPPT ( data . output_path )
150+ setNotice ( `Preset switched to ${ presetName } and applied immediately.` )
151+ } catch ( e ) {
152+ setNotice ( `Apply preset failed: ${ e . message } ` )
153+ } finally {
154+ setLoading ( false )
155+ }
156+ }
157+
139158 const generatePPT = async ( ) => {
140159 if ( ! form . topic . trim ( ) ) return
141160 setLoading ( true )
@@ -322,27 +341,6 @@ export default function App() {
322341 </ label >
323342
324343 < div className = "field-grid" >
325- < label >
326- Theme preset
327- < div className = "theme-cards" >
328- { PRESET_OPTIONS . map ( ( option ) => (
329- < button
330- type = "button"
331- key = { option . name }
332- data-testid = { `preset-${ option . name . toLowerCase ( ) } ` }
333- className = { `theme-card ${ form . preset === option . name ? 'active' : '' } ` }
334- onClick = { ( ) => setForm ( ( f ) => ( { ...f , preset : option . name } ) ) }
335- >
336- < div className = "theme-swatches" >
337- < span style = { { background : option . colors [ 0 ] } } />
338- < span style = { { background : option . colors [ 1 ] } } />
339- </ div >
340- < strong > { option . name } </ strong >
341- < small > { option . desc } </ small >
342- </ button >
343- ) ) }
344- </ div >
345- </ label >
346344 < label >
347345 < span className = "label-row" >
348346 Audience
@@ -411,6 +409,28 @@ export default function App() {
411409 </ div >
412410 </ div >
413411
412+ < div className = "preset-inline" >
413+ < span > Theme preset:</ span >
414+ < div className = "theme-cards compact" >
415+ { PRESET_OPTIONS . map ( ( option ) => (
416+ < button
417+ type = "button"
418+ key = { option . name }
419+ data-testid = { `preset-${ option . name . toLowerCase ( ) } ` }
420+ className = { `theme-card ${ form . preset === option . name ? 'active' : '' } ` }
421+ onClick = { ( ) => applyPresetImmediately ( option . name ) }
422+ disabled = { loading }
423+ >
424+ < div className = "theme-swatches" >
425+ < span style = { { background : option . colors [ 0 ] } } />
426+ < span style = { { background : option . colors [ 1 ] } } />
427+ </ div >
428+ < strong > { option . name } </ strong >
429+ </ button >
430+ ) ) }
431+ </ div >
432+ </ div >
433+
414434 { ! doc && < div className = "skeleton" > Start by entering a topic and generating a PPT from the left panel.</ div > }
415435 { doc && (
416436 < div className = "editor-layout" >
0 commit comments