Skip to content

Commit 4650ea9

Browse files
committed
fix mobile layout
1 parent 218f2d2 commit 4650ea9

15 files changed

Lines changed: 639 additions & 285 deletions

File tree

‎src/App.jsx‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Sidebar, { useSidebar } from './components/Navigation/Sidebar'
21
import { Routes, Navigate, Route, BrowserRouter as Router } from "react-router-dom";
32

43
// MUI
@@ -46,7 +45,6 @@ import Member from './Pages/StaticContent/Member';
4645
function App() {
4746
const { auth } = useAuth();
4847
const [user, setUser] = useState({ valid: false, name: "", role: "", jwt: "" });
49-
const { mode, toggleMode, restoreSidebar } = useSidebar();
5048

5149
useEffect(() => {
5250
if (auth && auth.JWT) {
@@ -72,13 +70,8 @@ function App() {
7270
return (
7371
<UserContext.Provider value={stateValue}>
7472
<AlertsContext.Provider value={alertsManagerRef}>
75-
<Box sx={{ display: 'flex', minHeight: '100vh' }}>
76-
{/* Collapsible Sidebar */}
77-
<Sidebar mode={mode} onToggleMode={toggleMode} />
78-
79-
{/* Main content area */}
80-
<Box sx={{ display: 'flex', flexDirection: 'column', flex: 1, minHeight: '100vh' }}>
81-
<Navbar sidebarHidden={mode === 'hidden'} onRestoreSidebar={restoreSidebar} />
73+
<Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}>
74+
<Navbar />
8275
<AlertsManager ref={alertsManagerRef} />
8376
<Box component="main" sx={{ flex: '1 0 auto' }}>
8477
<Routes>
@@ -120,7 +113,6 @@ function App() {
120113
</Box>
121114
<Footer />
122115
</Box>
123-
</Box>
124116
</AlertsContext.Provider>
125117
</UserContext.Provider>
126118
);

‎src/Pages/Events/Events.jsx‎

Lines changed: 97 additions & 79 deletions
Large diffs are not rendered by default.

‎src/Pages/Forum/Forum-Post.jsx‎

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Grid from '@mui/material/Grid';
88
import Typography from '@mui/material/Typography';
99
import Card from '@mui/material/Card';
1010
import CardContent from '@mui/material/CardContent';
11+
import Collapse from '@mui/material/Collapse';
1112
import Divider from '@mui/material/Divider';
1213
import Box from '@mui/material/Box';
1314
import Button from '@mui/material/Button';
@@ -143,6 +144,8 @@ export default function Forum_Post() {
143144

144145
// Poll Dialog State
145146
const [createPollOpen, setCreatePollOpen] = useState(false);
147+
const [pollsVisible, setPollsVisible] = useState(true);
148+
const [eventVisible, setEventVisible] = useState(true);
146149
const [pollQuestion, setPollQuestion] = useState('');
147150
const [pollOptions, setPollOptions] = useState(['', '']);
148151
const [pollAllowMultiple, setPollAllowMultiple] = useState(false);
@@ -409,12 +412,12 @@ export default function Forum_Post() {
409412
</AccordionSummary>
410413
<Divider />
411414
<AccordionDetails sx={{ p: 0 }}>
412-
<Post post={post} onUpdate={() => fetchData(true)} onDelete={() => navigate("/Forum/Topic/" + post.topicId)} onAddPoll={() => setCreatePollOpen(true)} />
415+
<Post post={post} onUpdate={() => fetchData(true)} onDelete={() => navigate("/Forum/Topic/" + post.topicId)} onAddPoll={() => setCreatePollOpen(true)} pollsVisible={pollsVisible} onTogglePolls={() => setPollsVisible(v => !v)} />
413416
</AccordionDetails>
414417
</Accordion>
415418

416419
{/* Render Polls if they exist in the post data */}
417-
{post.polls && post.polls.length > 0 && (
420+
{pollsVisible && post.polls && post.polls.length > 0 && (
418421
<Box sx={{ mb: 4 }}>
419422
<Grid container spacing={3}>
420423
{post.polls.map(poll => (
@@ -429,13 +432,22 @@ export default function Forum_Post() {
429432
{/* Associated Event Details & Attendance */}
430433
{associatedEvent && (
431434
<Card sx={{ mb: 4, border: '1px solid rgba(255, 255, 255, 0.08)', bgcolor: 'rgba(255, 255, 255, 0.02)', borderRadius: 2 }}>
432-
<CardContent sx={{ p: 3 }}>
433-
<Stack direction="row" spacing={1} sx={{ alignItems: 'center', mb: 2, color: 'primary.main' }}>
434-
<EventNoteIcon />
435-
<Typography variant="h6" sx={{ fontWeight: 'bold' }}>
436-
Zugehöriges Event: {associatedEvent.title}
437-
</Typography>
438-
<Typography variant="body2" color="text.secondary" sx={{ mb: 2.5 }}>
435+
<CardContent sx={{ py: eventVisible ? 3 : 1.5, px: 3 }}>
436+
<Stack direction="row" spacing={1} sx={{ alignItems: 'center', justifyContent: 'space-between' }}>
437+
<Stack direction="row" spacing={1} sx={{ alignItems: 'center', color: 'primary.main' }}>
438+
<EventNoteIcon />
439+
<Typography variant="h6" sx={{ fontWeight: 'bold' }}>
440+
Zugehöriges Event: {associatedEvent.title}
441+
</Typography>
442+
</Stack>
443+
<Tooltip title={eventVisible ? 'Event ausblenden' : 'Event einblenden'}>
444+
<IconButton size="small" onClick={() => setEventVisible(v => !v)}>
445+
{eventVisible ? <VisibilityIcon fontSize="small" /> : <VisibilityIcon fontSize="small" sx={{ opacity: 0.3 }} />}
446+
</IconButton>
447+
</Tooltip>
448+
</Stack>
449+
<Collapse in={eventVisible}>
450+
<Typography variant="body2" color="text.secondary" sx={{ mb: 2.5, mt: 1 }}>
439451
Ort: <strong>{associatedEvent.location}</strong> | Datum: <strong>{(() => {
440452
if (!associatedEvent.eventDate) return '';
441453
try {
@@ -467,7 +479,6 @@ export default function Forum_Post() {
467479
}
468480
})()}</strong>
469481
</Typography>
470-
</Stack>
471482

472483
<Grid container spacing={2} sx={{ mt: 2.5 }}>
473484
{/* YES / Zusagen */}
@@ -577,12 +588,22 @@ export default function Forum_Post() {
577588
</Box>
578589
</Grid>
579590
</Grid>
591+
</Collapse>
580592
</CardContent>
581593
</Card>
582594
)}
583595

584596
{/* Answers section */}
585-
<Typography variant="h5" sx={{ fontWeight: 'bold', mb: 3, color: 'primary.main' }}>
597+
<Typography
598+
variant="h5"
599+
sx={{
600+
fontWeight: 'bold',
601+
mb: { xs: 1, md: 2 },
602+
mt: 0,
603+
color: 'primary.main',
604+
textAlign: { xs: 'center', md: 'left' },
605+
}}
606+
>
586607
Antworten ({answers.length})
587608
</Typography>
588609

‎src/Pages/Forum/Forum-Topic.jsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ export default function Forum_Topic() {
117117

118118
const topicChips = [
119119
{ tooltip: "Ersteller", icon: <PersonOutlineIcon />, label: creator || 'Unbekannt' },
120-
{ tooltip: "Erstellungsdatum", icon: <EventNoteIcon />, label: convertTimestamp(creationDate) },
120+
{ tooltip: "Erstellungsdatum", icon: <EventNoteIcon />, label: convertTimestamp(creationDate, true) },
121121
{ tooltip: "Beiträge", icon: <ForumIcon />, label: postCount }
122122
];
123123

124124
return (
125-
<Container maxWidth="xl" sx={{ px: { xs: 1, md: 3 }, py: 3 }}>
125+
<Container maxWidth="xl" sx={{ px: { xs: 1, md: 3 }, py: 3, pb: 6 }}>
126126
<ForumBreadcrumbs
127127
categoryId={topicData.categoryId}
128128
categoryName={topicData.categoryName}
@@ -137,6 +137,7 @@ export default function Forum_Topic() {
137137
id="topic-header"
138138
sx={{
139139
cursor: 'default',
140+
py: 0.5,
140141
'& .MuiAccordionSummary-content': {
141142
width: '100%',
142143
margin: 0,
@@ -150,8 +151,10 @@ export default function Forum_Topic() {
150151
{topic}
151152
</Typography>
152153
</Grid>
153-
<Grid size={{ xs: 12, md: 8 }}>
154-
<ForumChips items={topicChips} />
154+
<Grid size={{ xs: 12, md: 8 }} sx={{ display: 'flex', justifyContent: { md: 'flex-end' } }}>
155+
<Box sx={{ display: { xs: 'none', md: 'block' }, '@media (min-width: 450px)': { display: 'block' } }}>
156+
<ForumChips items={topicChips} />
157+
</Box>
155158
</Grid>
156159
</Grid>
157160
</AccordionSummary>

‎src/Pages/Sonstige/RegestrationSucessfull.jsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,24 @@ export default function RegestrationSucessfull() {
196196

197197
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2} sx={{ width: '100%', justifyContent: 'center' }}>
198198
<Button
199-
variant="outlined"
199+
variant="contained"
200200
color="primary"
201-
onClick={goHome}
201+
type="submit"
202202
fullWidth
203203
disabled={loading}
204204
sx={{ py: 1.2, fontWeight: 'bold' }}
205205
>
206-
Startseite
206+
{loading ? <CircularProgress size={24} color="inherit" /> : "Verifizieren"}
207207
</Button>
208-
<Button
209-
variant="contained"
208+
<Button
209+
variant="outlined"
210210
color="primary"
211-
type="submit"
211+
onClick={goHome}
212212
fullWidth
213213
disabled={loading}
214214
sx={{ py: 1.2, fontWeight: 'bold' }}
215215
>
216-
{loading ? <CircularProgress size={24} color="inherit" /> : "Verifizieren"}
216+
Startseite
217217
</Button>
218218
</Stack>
219219
</Box>

‎src/components/Forum/AddCategory.jsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ import useAuth from '../../context/useAuth';
2727

2828
const style = {
2929
position: 'absolute',
30-
top: '50%',
30+
top: '10%',
3131
left: '50%',
32-
transform: 'translate(-50%, -50%)',
32+
transform: 'translate(-50%, 0)',
3333
width: { xs: '90%', sm: 450, md: 500 },
3434
maxWidth: '95%',
35+
maxHeight: '85vh',
36+
overflowY: 'auto',
3537
bgcolor: 'background.paper',
3638
border: '1px solid rgba(255, 255, 255, 0.1)',
3739
borderRadius: 2,

‎src/components/Forum/AddTopic.jsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ import useAuth from '../../context/useAuth';
2525

2626
const style = {
2727
position: 'absolute',
28-
top: '50%',
28+
top: '10%',
2929
left: '50%',
30-
transform: 'translate(-50%, -50%)',
30+
transform: 'translate(-50%, 0)',
3131
width: { xs: '90%', sm: 450, md: 500 },
3232
maxWidth: '95%',
33+
maxHeight: '85vh',
34+
overflowY: 'auto',
3335
bgcolor: 'background.paper',
3436
border: '1px solid rgba(255, 255, 255, 0.1)',
3537
borderRadius: 2,

‎src/components/Forum/Answer.jsx‎

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
1515
import EditIcon from '@mui/icons-material/Edit';
1616
import SaveIcon from '@mui/icons-material/Save';
1717
import CancelIcon from '@mui/icons-material/Cancel';
18+
import MoreVertIcon from '@mui/icons-material/MoreVert';
19+
import Menu from '@mui/material/Menu';
20+
import MenuItem from '@mui/material/MenuItem';
1821
import Box from '@mui/material/Box';
1922
import Divider from '@mui/material/Divider';
2023

@@ -39,6 +42,8 @@ export default function Answer(props) {
3942
const [isEditing, setIsEditing] = useState(false);
4043
const [editContent, setEditContent] = useState(answer.content);
4144
const [saving, setSaving] = useState(false);
45+
const [menuAnchorEl, setMenuAnchorEl] = useState(null);
46+
const menuOpen = Boolean(menuAnchorEl);
4247

4348
const isCreatorOrAdmin = auth.user === answer.creator || auth.roles === "Admin";
4449

@@ -100,26 +105,35 @@ export default function Answer(props) {
100105
<Grid container spacing={2}>
101106
<Grid size={{ xs: 12 }}>
102107
<Stack direction="row" sx={{ justifyContent: 'space-between', alignItems: 'center' }}>
103-
<Stack direction="row" spacing={1.5} sx={{ alignItems: 'center' }}>
108+
<Stack direction="row" spacing={1.5} sx={{ alignItems: 'center', minWidth: 0 }}>
104109
<Avatar
105110
alt={answer.creator ? answer.creator[0].toUpperCase() : 'U'}
106-
sx={{ bgcolor: 'secondary.main', color: 'secondary.contrastText', width: 32, height: 32, fontWeight: 'bold', fontSize: '0.9rem' }}
111+
sx={{ bgcolor: 'secondary.main', color: 'secondary.contrastText', width: 32, height: 32, fontWeight: 'bold', fontSize: '0.9rem', flexShrink: 0 }}
107112
/>
108-
<Box>
113+
<Box sx={{ minWidth: 0 }}>
109114
<Typography variant="subtitle2" sx={{ fontWeight: 'bold' }}>
110115
{answer.creator}
116+
<Box component="span" sx={{ fontWeight: 400, color: 'text.secondary', ml: 1 }}>
117+
<Box component="span" sx={{ display: 'none', '@media (min-width: 450px)': { display: 'inline' } }}>
118+
{convertTimestamp(answer.creationDate)}
119+
</Box>
120+
<Box component="span" sx={{ display: 'inline', '@media (min-width: 450px)': { display: 'none' } }}>
121+
{convertTimestamp(answer.creationDate, true)}
122+
</Box>
123+
</Box>
111124
</Typography>
112-
<Typography variant="caption" color="text.secondary">
113-
{convertTimestamp(answer.creationDate)}
114-
{answer.editDate && ` (bearbeitet am ${answer.editDate})`}
115-
</Typography>
125+
{answer.editDate && (
126+
<Typography variant="caption" color="text.secondary">
127+
bearbeitet am {answer.editDate}
128+
</Typography>
129+
)}
116130
</Box>
117131
</Stack>
118132

119133
{isCreatorOrAdmin && !saving && (
120-
<Stack direction="row" spacing={0.5}>
134+
<>
121135
{isEditing ? (
122-
<>
136+
<Stack direction="row" spacing={0.5}>
123137
<Tooltip title="Speichern">
124138
<IconButton size="small" color="primary" onClick={handleSaveEdit}>
125139
<SaveIcon fontSize="small" />
@@ -130,22 +144,32 @@ export default function Answer(props) {
130144
<CancelIcon fontSize="small" />
131145
</IconButton>
132146
</Tooltip>
133-
</>
147+
</Stack>
134148
) : (
135149
<>
136-
<Tooltip title="Antwort bearbeiten">
137-
<IconButton size="small" color="primary" onClick={() => setIsEditing(true)}>
138-
<EditIcon fontSize="small" />
139-
</IconButton>
140-
</Tooltip>
141-
<Tooltip title="Antwort löschen">
142-
<IconButton size="small" color="error" onClick={handleDelete}>
143-
<DeleteForeverIcon fontSize="small" />
144-
</IconButton>
145-
</Tooltip>
150+
<IconButton size="small" onClick={(e) => setMenuAnchorEl(e.currentTarget)}>
151+
<MoreVertIcon fontSize="small" />
152+
</IconButton>
153+
<Menu
154+
anchorEl={menuAnchorEl}
155+
open={menuOpen}
156+
onClose={() => setMenuAnchorEl(null)}
157+
onClick={() => setMenuAnchorEl(null)}
158+
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
159+
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
160+
>
161+
<MenuItem onClick={() => setIsEditing(true)}>
162+
<EditIcon fontSize="small" sx={{ mr: 1 }} />
163+
Antwort bearbeiten
164+
</MenuItem>
165+
<MenuItem onClick={handleDelete} sx={{ color: 'error.main' }}>
166+
<DeleteForeverIcon fontSize="small" sx={{ mr: 1 }} />
167+
Antwort löschen
168+
</MenuItem>
169+
</Menu>
146170
</>
147171
)}
148-
</Stack>
172+
</>
149173
)}
150174
</Stack>
151175
</Grid>

0 commit comments

Comments
 (0)