Seth commited on
Commit ·
3fdd55d
1
Parent(s): 5df542b
update
Browse files
frontend/src/components/prompts/PromptEditor.jsx
CHANGED
|
@@ -315,7 +315,7 @@ Best,
|
|
| 315 |
{{sender_name}}`,
|
| 316 |
};
|
| 317 |
|
| 318 |
-
export default function PromptEditor({ selectedProducts, prompts, onPromptsChange }) {
|
| 319 |
const [activeTab, setActiveTab] = useState(selectedProducts[0]?.name || '');
|
| 320 |
const [savedStatus, setSavedStatus] = useState({});
|
| 321 |
const [localPrompts, setLocalPrompts] = useState({});
|
|
@@ -365,6 +365,14 @@ export default function PromptEditor({ selectedProducts, prompts, onPromptsChang
|
|
| 365 |
[productName]: false
|
| 366 |
}));
|
| 367 |
}, 2000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
};
|
| 369 |
|
| 370 |
const handleReset = (productName) => {
|
|
|
|
| 315 |
{{sender_name}}`,
|
| 316 |
};
|
| 317 |
|
| 318 |
+
export default function PromptEditor({ selectedProducts, prompts, onPromptsChange, onSaveComplete }) {
|
| 319 |
const [activeTab, setActiveTab] = useState(selectedProducts[0]?.name || '');
|
| 320 |
const [savedStatus, setSavedStatus] = useState({});
|
| 321 |
const [localPrompts, setLocalPrompts] = useState({});
|
|
|
|
| 365 |
[productName]: false
|
| 366 |
}));
|
| 367 |
}, 2000);
|
| 368 |
+
|
| 369 |
+
// Scroll to Generate Sequences button after saving
|
| 370 |
+
if (onSaveComplete) {
|
| 371 |
+
// Small delay to ensure save status is visible
|
| 372 |
+
setTimeout(() => {
|
| 373 |
+
onSaveComplete();
|
| 374 |
+
}, 100);
|
| 375 |
+
}
|
| 376 |
};
|
| 377 |
|
| 378 |
const handleReset = (productName) => {
|
frontend/src/pages/EmailSequenceGenerator.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import React, { useState } from 'react';
|
| 2 |
import { Sparkles, ArrowRight, ArrowLeft, Mail, Zap } from 'lucide-react';
|
| 3 |
import { Button } from "@/components/ui/button";
|
| 4 |
import { motion, AnimatePresence } from 'framer-motion';
|
|
@@ -15,10 +15,20 @@ export default function EmailSequenceGenerator() {
|
|
| 15 |
const [prompts, setPrompts] = useState({});
|
| 16 |
const [isGenerating, setIsGenerating] = useState(false);
|
| 17 |
const [generationComplete, setGenerationComplete] = useState(false);
|
|
|
|
| 18 |
|
| 19 |
const canProceedToStep2 = uploadedFile && selectedProducts.length > 0;
|
| 20 |
const canProceedToStep3 = Object.keys(prompts).length > 0;
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
const handleGenerate = async () => {
|
| 23 |
if (!uploadedFile?.fileId || selectedProducts.length === 0 || Object.keys(prompts).length === 0) {
|
| 24 |
alert('Please complete all steps before generating sequences.');
|
|
@@ -199,6 +209,7 @@ export default function EmailSequenceGenerator() {
|
|
| 199 |
selectedProducts={selectedProducts}
|
| 200 |
prompts={prompts}
|
| 201 |
onPromptsChange={setPrompts}
|
|
|
|
| 202 |
/>
|
| 203 |
|
| 204 |
<div className="flex justify-between pt-4">
|
|
@@ -211,6 +222,7 @@ export default function EmailSequenceGenerator() {
|
|
| 211 |
Back
|
| 212 |
</Button>
|
| 213 |
<Button
|
|
|
|
| 214 |
onClick={handleGenerate}
|
| 215 |
disabled={!canProceedToStep3}
|
| 216 |
className="bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700
|
|
|
|
| 1 |
+
import React, { useState, useRef } from 'react';
|
| 2 |
import { Sparkles, ArrowRight, ArrowLeft, Mail, Zap } from 'lucide-react';
|
| 3 |
import { Button } from "@/components/ui/button";
|
| 4 |
import { motion, AnimatePresence } from 'framer-motion';
|
|
|
|
| 15 |
const [prompts, setPrompts] = useState({});
|
| 16 |
const [isGenerating, setIsGenerating] = useState(false);
|
| 17 |
const [generationComplete, setGenerationComplete] = useState(false);
|
| 18 |
+
const generateButtonRef = useRef(null);
|
| 19 |
|
| 20 |
const canProceedToStep2 = uploadedFile && selectedProducts.length > 0;
|
| 21 |
const canProceedToStep3 = Object.keys(prompts).length > 0;
|
| 22 |
|
| 23 |
+
const scrollToGenerateButton = () => {
|
| 24 |
+
if (generateButtonRef.current) {
|
| 25 |
+
generateButtonRef.current.scrollIntoView({
|
| 26 |
+
behavior: 'smooth',
|
| 27 |
+
block: 'center'
|
| 28 |
+
});
|
| 29 |
+
}
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
const handleGenerate = async () => {
|
| 33 |
if (!uploadedFile?.fileId || selectedProducts.length === 0 || Object.keys(prompts).length === 0) {
|
| 34 |
alert('Please complete all steps before generating sequences.');
|
|
|
|
| 209 |
selectedProducts={selectedProducts}
|
| 210 |
prompts={prompts}
|
| 211 |
onPromptsChange={setPrompts}
|
| 212 |
+
onSaveComplete={scrollToGenerateButton}
|
| 213 |
/>
|
| 214 |
|
| 215 |
<div className="flex justify-between pt-4">
|
|
|
|
| 222 |
Back
|
| 223 |
</Button>
|
| 224 |
<Button
|
| 225 |
+
ref={generateButtonRef}
|
| 226 |
onClick={handleGenerate}
|
| 227 |
disabled={!canProceedToStep3}
|
| 228 |
className="bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700
|