import React, { useState, useEffect } from 'react'; const PromptDisplay = () => { const [prompts, setPrompts] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [selectedPrompt, setSelectedPrompt] = useState(null); // Mock data for demonstration const mockPrompts = [ "Write about a time when you felt completely at peace with yourself and the world around you. What were the circumstances that led to this feeling, and how did it change your perspective on life?", "Imagine you could have a conversation with your future self 10 years from now. What questions would you ask, and what advice do you think your future self would give you?", "Describe a place from your childhood that holds special meaning to you. What made this place so significant, and how does remembering it make you feel now?", "Write about a skill or hobby you've always wanted to learn but never had the chance to pursue. What has held you back, and what would be the first step to starting?", "Reflect on a mistake you made that ultimately led to personal growth. What did you learn from the experience, and how has it shaped who you are today?", "Imagine you wake up tomorrow with the ability to understand and speak every language in the world. How would this change your life, and what would you do with this newfound ability?" ]; useEffect(() => { // Simulate API call setTimeout(() => { setPrompts(mockPrompts); setLoading(false); }, 1000); }, []); const handleSelectPrompt = (index) => { setSelectedPrompt(index); }; const handleDrawPrompts = async () => { setLoading(true); setError(null); try { // TODO: Replace with actual API call // const response = await fetch('/api/v1/prompts/draw'); // const data = await response.json(); // setPrompts(data.prompts); // For now, use mock data setTimeout(() => { setPrompts(mockPrompts); setSelectedPrompt(null); setLoading(false); }, 1000); } catch (err) { setError('Failed to draw prompts. Please try again.'); setLoading(false); } }; const handleAddToHistory = async () => { if (selectedPrompt === null) { setError('Please select a prompt first'); return; } try { // TODO: Replace with actual API call // await fetch(`/api/v1/prompts/select/${selectedPrompt}`, { method: 'POST' }); // For now, just show success message alert(`Prompt ${selectedPrompt + 1} added to history!`); setSelectedPrompt(null); } catch (err) { setError('Failed to add prompt to history'); } }; if (loading) { return (
Loading prompts...
The prompt pool is empty. Please fill the pool to get started.
{prompt}
Select a prompt by clicking on it, then add it to your history. The AI will use your history to generate more relevant prompts in the future.