adding chat features, admin features and bug fixes

This commit is contained in:
Matthias Hochmeister
2026-03-12 08:16:34 +01:00
parent 7b14e3d5ba
commit 31f1414e06
43 changed files with 2610 additions and 16 deletions

View File

@@ -0,0 +1,93 @@
import React from 'react';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import IconButton from '@mui/material/IconButton';
import ChatIcon from '@mui/icons-material/Chat';
import Typography from '@mui/material/Typography';
import { useLayout } from '../../contexts/LayoutContext';
import { ChatProvider, useChat } from '../../contexts/ChatContext';
import ChatRoomList from './ChatRoomList';
import ChatMessageView from './ChatMessageView';
const ChatPanelInner: React.FC = () => {
const { chatPanelOpen, setChatPanelOpen } = useLayout();
const { selectedRoomToken, connected } = useChat();
if (!chatPanelOpen) {
return (
<Paper
elevation={2}
sx={{
width: 60,
height: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
pt: 1,
flexShrink: 0,
transition: 'width 0.2s ease',
}}
>
<IconButton onClick={() => setChatPanelOpen(true)}>
<ChatIcon />
</IconButton>
</Paper>
);
}
return (
<Paper
elevation={2}
sx={{
width: 360,
height: '100%',
display: 'flex',
flexDirection: 'column',
flexShrink: 0,
transition: 'width 0.2s ease',
overflow: 'hidden',
}}
>
<Box
sx={{
px: 1.5,
py: 1,
borderBottom: 1,
borderColor: 'divider',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Typography variant="subtitle1" fontWeight={600}>
Chat
</Typography>
<IconButton size="small" onClick={() => setChatPanelOpen(false)}>
<ChatIcon fontSize="small" />
</IconButton>
</Box>
{!connected ? (
<Box sx={{ p: 2 }}>
<Typography variant="body2" color="text.secondary">
Nextcloud nicht verbunden. Bitte verbinden Sie sich in den Einstellungen.
</Typography>
</Box>
) : selectedRoomToken ? (
<ChatMessageView />
) : (
<ChatRoomList />
)}
</Paper>
);
};
const ChatPanel: React.FC = () => {
return (
<ChatProvider>
<ChatPanelInner />
</ChatProvider>
);
};
export default ChatPanel;