-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathDashboard.jsx
More file actions
112 lines (107 loc) · 2.94 KB
/
Dashboard.jsx
File metadata and controls
112 lines (107 loc) · 2.94 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { useNavigate } from 'react-router-dom';
import { Box, Typography, Grid, Paper, Button } from '@mui/material';
import { Add as AddIcon } from '@mui/icons-material';
import TripList from '../components/trips/TripList';
import { useAuth } from '../context/AuthContext';
import travelingSvg from '../assets/undraw_traveling_yhxq.svg';
const Dashboard = () => {
const { user } = useAuth();
const navigate = useNavigate();
const WelcomeMessage = () => (
<Box
sx={{
textAlign: 'center',
py: 6,
px: 2,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 3
}}
>
<img
src={travelingSvg}
alt="Start your journey"
style={{
maxWidth: '300px',
width: '100%',
height: 'auto',
marginBottom: '1rem'
}}
/>
<Typography variant="h4" component="h2" gutterBottom>
Welcome to Planventure!
</Typography>
<Typography variant="body1" color="text.secondary" sx={{ maxWidth: '600px', mb: 3 }}>
Ready to start planning your next adventure? Create your first trip and let us help you organize everything from destinations to activities.
</Typography>
<Button
variant="contained"
size="large"
startIcon={<AddIcon />}
onClick={() => navigate('/trips/new')}
>
Plan Your First Trip
</Button>
</Box>
);
const ErrorState = () => (
<Box
sx={{
textAlign: 'center',
py: 6,
px: 2,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 3
}}
>
<img
src={travelingSvg}
alt="Error loading trips"
style={{
maxWidth: '300px',
width: '100%',
height: 'auto',
marginBottom: '1rem',
opacity: 0.7
}}
/>
<Typography variant="h5" component="h2" gutterBottom>
Oops! Looks like our compass is spinning! 🧭
</Typography>
<Typography variant="body1" color="text.secondary" sx={{ maxWidth: '600px', mb: 3 }}>
We're having trouble loading your adventures. Don't worry, even the best travelers sometimes lose their way! Try refreshing the page or come back later.
</Typography>
<Button
variant="contained"
onClick={() => window.location.reload()}
>
Try Again
</Button>
</Box>
);
return (
<Box sx={{ maxWidth: 1200, mx: 'auto', p: { xs: 2, sm: 3 } }}>
<Typography variant="h4" component="h1" gutterBottom>
My Trips
</Typography>
<Paper
elevation={2}
sx={{
p: 3,
display: 'flex',
flexDirection: 'column',
minHeight: '60vh'
}}
>
<TripList
WelcomeMessage={WelcomeMessage}
ErrorState={ErrorState}
/>
</Paper>
</Box>
);
};
export default Dashboard;