This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BreakPilot Dev 19855efacc
Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
feat: BreakPilot PWA - Full codebase (clean push without large binaries)
All services: admin-v2, studio-v2, website, ai-compliance-sdk,
consent-service, klausur-service, voice-service, and infrastructure.
Large PDFs and compiled binaries excluded via .gitignore.
2026-02-11 13:25:58 +01:00

273 lines
6.5 KiB
Python

"""
Alerts Widget fuer das Lehrer-Dashboard.
Zeigt Google Alerts und andere Benachrichtigungen.
"""
class AlertsWidget:
widget_id = 'alerts'
widget_name = 'Alerts'
widget_icon = '🔔' # Bell
widget_color = '#f59e0b' # Orange
default_width = 'half'
has_settings = True
@staticmethod
def get_css() -> str:
return """
/* ===== Alerts Widget Styles ===== */
.widget-alerts {
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-alerts .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-alerts .widget-title {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 600;
color: var(--bp-text, #e5e7eb);
}
.widget-alerts .widget-icon {
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(245, 158, 11, 0.15);
color: #f59e0b;
border-radius: 8px;
font-size: 14px;
}
.widget-alerts .alerts-list {
flex: 1;
overflow-y: auto;
}
.widget-alerts .alert-item {
display: flex;
gap: 12px;
padding: 12px 0;
border-bottom: 1px solid var(--bp-border-subtle, rgba(255,255,255,0.05));
cursor: pointer;
transition: background 0.2s;
}
.widget-alerts .alert-item:last-child {
border-bottom: none;
}
.widget-alerts .alert-item:hover {
background: var(--bp-surface-elevated, #334155);
margin: 0 -12px;
padding: 12px;
border-radius: 8px;
}
.widget-alerts .alert-icon {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(245, 158, 11, 0.15);
color: #f59e0b;
border-radius: 8px;
font-size: 14px;
flex-shrink: 0;
}
.widget-alerts .alert-content {
flex: 1;
min-width: 0;
}
.widget-alerts .alert-title {
font-size: 13px;
font-weight: 500;
color: var(--bp-text, #e5e7eb);
margin-bottom: 4px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.widget-alerts .alert-meta {
font-size: 11px;
color: var(--bp-text-muted, #9ca3af);
display: flex;
gap: 8px;
}
.widget-alerts .alert-source {
color: #f59e0b;
}
.widget-alerts .alerts-empty {
text-align: center;
padding: 24px;
color: var(--bp-text-muted, #9ca3af);
font-size: 13px;
}
.widget-alerts .alerts-empty-icon {
font-size: 32px;
margin-bottom: 8px;
opacity: 0.5;
}
.widget-alerts .alerts-footer {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--bp-border-subtle, rgba(255,255,255,0.1));
}
.widget-alerts .alerts-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-alerts .alerts-all-btn:hover {
border-color: #f59e0b;
color: #f59e0b;
}
"""
@staticmethod
def get_html() -> str:
return """
<div class="widget-alerts" data-widget-id="alerts">
<div class="widget-header">
<div class="widget-title">
<span class="widget-icon">&#128276;</span>
<span>Google Alerts</span>
</div>
<button class="widget-settings-btn" onclick="openWidgetSettings('alerts')" title="Einstellungen">&#9881;</button>
</div>
<div class="alerts-list" id="alerts-widget-list">
<!-- Wird dynamisch gefuellt -->
</div>
<div class="alerts-footer">
<button class="alerts-all-btn" onclick="openAlertsModule()">+ Alle Alerts anzeigen</button>
</div>
</div>
"""
@staticmethod
def get_js() -> str:
return """
// ===== Alerts Widget JavaScript =====
function getDefaultAlerts() {
const now = Date.now();
return [
{
id: 1,
title: 'Neue Mathelehrer-Studie zeigt verbesserte Lernergebnisse durch digitale Tools',
source: 'Google Alert: Digitales Lernen',
url: '#',
time: new Date(now - 60 * 60 * 1000).toISOString()
},
{
id: 2,
title: 'Kultusministerium kuendigt neue Fortbildungsreihe an',
source: 'Google Alert: Bildungspolitik NI',
url: '#',
time: new Date(now - 5 * 60 * 60 * 1000).toISOString()
},
{
id: 3,
title: 'Best Practices: Differenzierter Deutschunterricht',
source: 'Google Alert: Deutschunterricht',
url: '#',
time: new Date(now - 24 * 60 * 60 * 1000).toISOString()
}
];
}
function formatAlertTime(timeStr) {
const time = new Date(timeStr);
const now = new Date();
const diffMs = now - time;
const diffHours = Math.floor(diffMs / (60 * 60 * 1000));
const diffDays = Math.floor(diffMs / (24 * 60 * 60 * 1000));
if (diffHours < 1) return 'gerade eben';
if (diffHours < 24) return `vor ${diffHours} Std.`;
if (diffDays === 1) return 'gestern';
return `vor ${diffDays} Tagen`;
}
function renderAlertsWidget() {
const list = document.getElementById('alerts-widget-list');
if (!list) return;
const alerts = getDefaultAlerts();
if (alerts.length === 0) {
list.innerHTML = `
<div class="alerts-empty">
<div class="alerts-empty-icon">&#128276;</div>
<div>Keine neuen Alerts</div>
</div>
`;
return;
}
list.innerHTML = alerts.map(alert => `
<div class="alert-item" onclick="openAlert('${alert.url}')">
<div class="alert-icon">&#128240;</div>
<div class="alert-content">
<div class="alert-title">${alert.title}</div>
<div class="alert-meta">
<span class="alert-source">${alert.source}</span>
<span>${formatAlertTime(alert.time)}</span>
</div>
</div>
</div>
`).join('');
}
function openAlert(url) {
if (url && url !== '#') {
window.open(url, '_blank');
}
}
function openAlertsModule() {
if (typeof loadModule === 'function') {
loadModule('alerts');
}
}
function initAlertsWidget() {
renderAlertsWidget();
}
"""