-
-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathupdate-theme-buttons.mjs
More file actions
56 lines (44 loc) · 1.89 KB
/
update-theme-buttons.mjs
File metadata and controls
56 lines (44 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import fs from 'fs';
const filePath = './components/presentation/presentation-generator.tsx';
let content = fs.readFileSync(filePath, 'utf8');
console.log('🔧 Updating theme selection buttons...\n');
// Replace the back button onClick
content = content.replace(
`onClick={() => setCurrentStep('outline')}`,
`onClick={() => setCurrentStep(slides.length > 0 ? 'generated' : 'outline')}`
);
console.log('✅ Updated back button logic');
// Replace the generate button onClick and text
content = content.replace(
`onClick={generateFullPresentation}`,
`onClick={slides.length > 0 ? applyNewThemeToSlides : generateFullPresentation}`
);
console.log('✅ Updated generate button onClick');
// Update the button text to be conditional
const oldButtonText = ` {isGenerating ? (
<>
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
Creating your presentation...
</>
) : (
<>
<Sparkles className="mr-2 h-5 w-5" />
Generate Professional Presentation
</>
)}`;
const newButtonText = ` {isGenerating ? (
<>
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
{slides.length > 0 ? 'Applying theme...' : 'Creating your presentation...'}
</>
) : (
<>
<Sparkles className="mr-2 h-5 w-5" />
{slides.length > 0 ? 'Apply This Theme' : 'Generate Professional Presentation'}
</>
)}`;
content = content.replace(oldButtonText, newButtonText);
console.log('✅ Updated button text to be conditional');
fs.writeFileSync(filePath, content, 'utf8');
console.log('\n✨ Theme buttons updated successfully!');
console.log('📝 Now the button will say "Apply This Theme" when changing styles\n');