// DailyQuote Component - Displays motivational quote of the day function DailyQuote() { const [quoteData, setQuoteData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { fetchDailyQuote(); }, []); const fetchDailyQuote = async () => { try { setLoading(true); // Using Quotable API const response = await fetch('https://api.quotable.io/random?tags=inspirational|wisdom|success'); const data = await response.json(); setQuoteData({ quote: data.content, author: data.author }); } catch (err) { console.error('Error fetching daily quote:', err); // Set fallback quote on error setQuoteData({ quote: 'The only way to do great work is to love what you do.', author: 'Steve Jobs' }); } finally { setLoading(false); } }; const getNewQuote = () => { fetchDailyQuote(); }; if (loading) { return (

💭 Daily Quote

Loading...

); } if (error || !quoteData) { return (

💭 Daily Quote

Failed to load quote of the day

); } return (

💭 Daily Quote

"
"

{quoteData.quote}

— {quoteData.author}

); } // Export to global registry window.DailyQuote = DailyQuote;