import { useState } from 'react'; import { useUsername } from './context/UsernameContext'; import PostList from './components/PostList'; import PostDetail from './components/PostDetail'; import CreatePostModal from './components/CreatePostModal'; import UsernameModal from './components/UsernameModal'; import APIStatusIndicator from './components/APIStatusIndicator'; import './App.css'; function App() { const { username } = useUsername(); const [selectedPost, setSelectedPost] = useState(null); const [showCreatePost, setShowCreatePost] = useState(false); const [apiAvailable, setApiAvailable] = useState(true); const [showUsernameModal, setShowUsernameModal] = useState(!username); const handlePostCreated = () => { setShowCreatePost(false); window.location.reload(); }; return (
The application cannot connect to the backend API at http://localhost:8000. Please ensure the API server is running and try again.