diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 2708d74..8b331fa 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,5 +1,5 @@ import { useAuth } from '../contexts/AuthContext' -import { Link } from 'react-router-dom' +import { Link, useNavigate } from 'react-router-dom' import { useState, useRef, useEffect } from 'react' import { createEntry } from '../lib/api' import { encryptEntry } from '../lib/crypto' @@ -32,6 +32,7 @@ const SAVE_LEAVES = [ export default function HomePage() { const { user, userId, secretKey, loading } = useAuth() + const navigate = useNavigate() const [entry, setEntry] = useState('') const [title, setTitle] = useState('') const [phase, setPhase] = useState<'idle' | 'saving' | 'book' | 'celebrate'>('idle') @@ -83,7 +84,7 @@ export default function HomePage() { const handleBookDone = () => { setPhase('celebrate') - setTimeout(() => setPhase('idle'), 2500) + setTimeout(() => navigate('/history'), 2500) } const handleTitleKeyDown = (e: React.KeyboardEvent) => {