forked from microsoft/github-copilot-vibe-coding-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.jsx
More file actions
55 lines (46 loc) · 1.49 KB
/
Copy pathApp.jsx
File metadata and controls
55 lines (46 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { useState } from 'react';
import { AppProvider } from './context/AppContext';
import ServerStatus from './components/common/ServerStatus';
import ErrorDisplay from './components/common/ErrorDisplay';
import CreatePostForm from './components/posts/CreatePostForm';
import PostsList from './components/posts/PostsList';
import { useApp } from './context/AppContext';
import './App.css';
const AppContent = () => {
const [refreshTrigger, setRefreshTrigger] = useState(0);
const { error, clearError } = useApp();
const handlePostCreated = () => {
// Trigger a refresh of the posts list
setRefreshTrigger(prev => prev + 1);
};
return (
<div className="app">
<header className="app-header">
<h1>Simple Social Media Application</h1>
<ServerStatus />
</header>
<main className="app-main">
<ErrorDisplay error={error} onDismiss={clearError} />
<div className="app-content">
<section className="create-post-section">
<CreatePostForm onPostCreated={handlePostCreated} />
</section>
<section className="posts-section">
<PostsList refreshTrigger={refreshTrigger} />
</section>
</div>
</main>
<footer className="app-footer">
<p>Built with React and Vite • Backend API: http://localhost:8000</p>
</footer>
</div>
);
};
const App = () => {
return (
<AppProvider>
<AppContent />
</AppProvider>
);
};
export default App;