fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.
This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).
Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
289
backend/frontend/modules/widgets/matrix_widget.py
Normal file
289
backend/frontend/modules/widgets/matrix_widget.py
Normal file
@@ -0,0 +1,289 @@
|
||||
"""
|
||||
Matrix Chat Widget fuer das Lehrer-Dashboard.
|
||||
|
||||
Zeigt die letzten Chat-Nachrichten aus dem Matrix Messenger.
|
||||
"""
|
||||
|
||||
|
||||
class MatrixWidget:
|
||||
widget_id = 'matrix'
|
||||
widget_name = 'Matrix-Chat'
|
||||
widget_icon = '💬' # Speech bubble
|
||||
widget_color = '#8b5cf6' # Purple
|
||||
default_width = 'half'
|
||||
has_settings = True
|
||||
|
||||
@staticmethod
|
||||
def get_css() -> str:
|
||||
return """
|
||||
/* ===== Matrix Widget Styles ===== */
|
||||
.widget-matrix {
|
||||
background: var(--bp-surface, #1e293b);
|
||||
border: 1px solid var(--bp-border, #475569);
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.widget-matrix .widget-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--bp-border-subtle, rgba(255,255,255,0.1));
|
||||
}
|
||||
|
||||
.widget-matrix .widget-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--bp-text, #e5e7eb);
|
||||
}
|
||||
|
||||
.widget-matrix .widget-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(139, 92, 246, 0.15);
|
||||
color: #8b5cf6;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-item {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid var(--bp-border-subtle, rgba(255,255,255,0.05));
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-item:hover {
|
||||
background: var(--bp-surface-elevated, #334155);
|
||||
margin: 0 -12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(139, 92, 246, 0.15);
|
||||
color: #8b5cf6;
|
||||
border-radius: 50%;
|
||||
font-size: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-room {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--bp-text, #e5e7eb);
|
||||
}
|
||||
|
||||
.widget-matrix .chat-time {
|
||||
font-size: 10px;
|
||||
color: var(--bp-text-muted, #9ca3af);
|
||||
}
|
||||
|
||||
.widget-matrix .chat-message {
|
||||
font-size: 12px;
|
||||
color: var(--bp-text-muted, #9ca3af);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.widget-matrix .chat-unread {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background: #8b5cf6;
|
||||
border-radius: 50%;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-empty {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
color: var(--bp-text-muted, #9ca3af);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-empty-icon {
|
||||
font-size: 32px;
|
||||
margin-bottom: 8px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-footer {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--bp-border-subtle, rgba(255,255,255,0.1));
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-all-btn {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background: transparent;
|
||||
border: 1px dashed var(--bp-border, #475569);
|
||||
border-radius: 8px;
|
||||
color: var(--bp-text-muted, #9ca3af);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.widget-matrix .matrix-all-btn:hover {
|
||||
border-color: #8b5cf6;
|
||||
color: #8b5cf6;
|
||||
}
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_html() -> str:
|
||||
return """
|
||||
<div class="widget-matrix" data-widget-id="matrix">
|
||||
<div class="widget-header">
|
||||
<div class="widget-title">
|
||||
<span class="widget-icon">💬</span>
|
||||
<span>Matrix-Chat</span>
|
||||
</div>
|
||||
<button class="widget-settings-btn" onclick="openWidgetSettings('matrix')" title="Einstellungen">⚙</button>
|
||||
</div>
|
||||
<div class="matrix-list" id="matrix-list">
|
||||
<!-- Wird dynamisch gefuellt -->
|
||||
</div>
|
||||
<div class="matrix-footer">
|
||||
<button class="matrix-all-btn" onclick="openMessenger()">+ Messenger oeffnen</button>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_js() -> str:
|
||||
return """
|
||||
// ===== Matrix Widget JavaScript =====
|
||||
|
||||
function getDefaultMatrixChats() {
|
||||
const now = Date.now();
|
||||
return [
|
||||
{
|
||||
id: 'room1',
|
||||
room: 'Kollegium Deutsch',
|
||||
lastMessage: 'Hat jemand das neue Curriculum?',
|
||||
sender: 'Fr. Becker',
|
||||
time: new Date(now - 30 * 60 * 1000).toISOString(),
|
||||
unread: true
|
||||
},
|
||||
{
|
||||
id: 'room2',
|
||||
room: 'Klassenfahrt 10a',
|
||||
lastMessage: 'Die Anmeldungen sind komplett!',
|
||||
sender: 'Hr. Klein',
|
||||
time: new Date(now - 3 * 60 * 60 * 1000).toISOString(),
|
||||
unread: false
|
||||
},
|
||||
{
|
||||
id: 'room3',
|
||||
room: 'Fachschaft',
|
||||
lastMessage: 'Termin fuer naechste Sitzung...',
|
||||
sender: 'Sie',
|
||||
time: new Date(now - 24 * 60 * 60 * 1000).toISOString(),
|
||||
unread: false
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function formatMatrixTime(timeStr) {
|
||||
const time = new Date(timeStr);
|
||||
const now = new Date();
|
||||
const diffMs = now - time;
|
||||
const diffMins = Math.floor(diffMs / (60 * 1000));
|
||||
const diffHours = Math.floor(diffMs / (60 * 60 * 1000));
|
||||
|
||||
if (diffMins < 1) return 'jetzt';
|
||||
if (diffMins < 60) return `${diffMins}m`;
|
||||
if (diffHours < 24) return `${diffHours}h`;
|
||||
return time.toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit' });
|
||||
}
|
||||
|
||||
function renderMatrixChats() {
|
||||
const list = document.getElementById('matrix-list');
|
||||
if (!list) return;
|
||||
|
||||
const chats = getDefaultMatrixChats();
|
||||
|
||||
if (chats.length === 0) {
|
||||
list.innerHTML = `
|
||||
<div class="matrix-empty">
|
||||
<div class="matrix-empty-icon">💬</div>
|
||||
<div>Keine Chats verfuegbar</div>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
list.innerHTML = chats.map(chat => `
|
||||
<div class="chat-item" onclick="openMatrixRoom('${chat.id}')">
|
||||
<div class="chat-avatar">💬</div>
|
||||
<div class="chat-content">
|
||||
<div class="chat-header">
|
||||
<span class="chat-room">${chat.room}</span>
|
||||
<span class="chat-time">${formatMatrixTime(chat.time)}</span>
|
||||
</div>
|
||||
<div class="chat-message">${chat.sender}: ${chat.lastMessage}</div>
|
||||
</div>
|
||||
${chat.unread ? '<div class="chat-unread"></div>' : ''}
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function openMatrixRoom(roomId) {
|
||||
if (typeof loadModule === 'function') {
|
||||
loadModule('messenger');
|
||||
console.log('Opening room:', roomId);
|
||||
}
|
||||
}
|
||||
|
||||
function openMessenger() {
|
||||
if (typeof loadModule === 'function') {
|
||||
loadModule('messenger');
|
||||
}
|
||||
}
|
||||
|
||||
function initMatrixWidget() {
|
||||
renderMatrixChats();
|
||||
}
|
||||
"""
|
||||
Reference in New Issue
Block a user