import { useQueryClient } from '@tanstack/react-query'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { User } from '@app/auth/components/user'; import { updateLastLogin } from '@libs/storage'; import { LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon } from '@shared/icons/arrowRightCircle'; import { useAccount } from '@utils/hooks/useAccount'; import { useNostr } from '@utils/hooks/useNostr'; export function ImportStep3Screen() { const navigate = useNavigate(); const queryClient = useQueryClient(); const [loading, setLoading] = useState(false); const { status, account } = useAccount(); const { fetchNotes, fetchChats } = useNostr(); const submit = async () => { try { // show loading indicator setLoading(true); const now = Math.floor(Date.now() / 1000); await fetchNotes(); await fetchChats(); await updateLastLogin(now); queryClient.invalidateQueries(['currentAccount']); navigate('/', { replace: true }); } catch (e) { console.log('error: ', e); setLoading(false); } }; return (

{loading ? 'Prefetching data...' : 'Continue with'}

{status === 'loading' ? (
) : (
)}
); }