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-pwa/backend/frontend/studio_refactored_demo.py
Benjamin Admin 21a844cb8a 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>
2026-02-09 09:51:32 +01:00

185 lines
6.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
from .components import (
base,
legal_modal,
auth_modal,
admin_panel,
admin_email,
admin_dsms,
admin_stats,
)
router = APIRouter()
@router.get("/app", response_class=HTMLResponse)
def app_ui():
"""
Refactored Studio UI - Modulare Komponenten-Architektur
REFACTORING ERFOLGREICH ABGESCHLOSSEN:
Die monolithische studio.py (11.703 Zeilen) wurde in 7 Komponenten aufgeteilt:
✓ components/base.py - CSS Variables, Base Styles, Theme Toggle
✓ components/legal_modal.py - Legal/Consent Modal (AGB, Datenschutz, etc.)
✓ components/auth_modal.py - Auth/Login/Register Modal
✓ components/admin_panel.py - Admin Panel Core (Documents, Versions)
✓ components/admin_email.py - E-Mail Template Management
✓ components/admin_dsms.py - DSMS/IPFS WebUI, Archive Management
✓ components/admin_stats.py - Statistics & GDPR Export
NÄCHSTE SCHRITTE ZUR VOLLSTÄNDIGEN INTEGRATION:
1. Kopiere studio.py.backup zu studio.py
2. Ersetze den Header (Zeilen 1-7) durch die neuen Imports (siehe unten)
3. Ändere return """ zu return f"""
4. Ersetze die extrahierten Bereiche durch Komponenten-Aufrufe:
CSS-Bereiche (im <style> Tag):
- Zeilen 17-235: {base.get_base_css()}
- Zeilen 237-437: {legal_modal.get_legal_modal_css()}
- Zeilen 438-773: {auth_modal.get_auth_modal_css()}
- Zeilen 1203-~3200: {admin_panel.get_admin_panel_css()}
- DSMS CSS: {admin_dsms.get_admin_dsms_css()}
HTML-Bereiche (im <body>):
- Legal Modal: {legal_modal.get_legal_modal_html()}
- Auth Modal: {auth_modal.get_auth_modal_html()}
- Admin Panel: {admin_panel.get_admin_panel_html()}
- DSMS WebUI: {admin_dsms.get_admin_dsms_html()}
JavaScript-Bereiche (im <script> Tag):
- Theme Toggle: {base.get_base_js()}
- Legal Modal JS: {legal_modal.get_legal_modal_js()}
- Auth Modal JS: {auth_modal.get_auth_modal_js()}
- Admin Panel JS: {admin_panel.get_admin_panel_js()}
- Email Templates: {admin_email.get_admin_email_js()}
- Statistics: {admin_stats.get_admin_stats_js()}
- DSMS Functions: {admin_dsms.get_admin_dsms_js()}
WICHTIG: Die Backup-Datei enthält den gesamten funktionierenden Code.
Die Komponenten sind vollständig extrahiert und bereit zur Integration.
"""
# Demonstration: So würde die integrierte Version aussehen
# NOTE: Dies ist eine vereinfachte Demo. Die vollständige Version
# würde alle Inhalte aus studio.py.backup + Komponenten-Aufrufe enthalten.
return f"""
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>BreakPilot Arbeitsblatt Studio</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* Base Styles: CSS Variables, Scrollbar, Layout, Theme Toggle */
{base.get_base_css()}
/* Hier würden die gemeinsamen Styles kommen (Buttons, Forms, Sidebar, etc.) */
/* Diese sind noch in studio.py.backup Zeilen ~500-1200 */
/* Legal Modal Styles */
{legal_modal.get_legal_modal_css()}
/* Auth Modal Styles */
{auth_modal.get_auth_modal_css()}
/* Admin Panel Styles */
{admin_panel.get_admin_panel_css()}
/* DSMS Styles */
{admin_dsms.get_admin_dsms_css()}
</style>
</head>
<body>
<!-- Main Application Content (Topbar, Sidebar, Content Area) -->
<!-- Dieser Bereich wird aus studio.py.backup Zeilen ~3415-6900 übernommen -->
<div class="app-root">
<header class="topbar">
<div class="brand">
<div class="brand-logo">BP</div>
<div>
<div class="brand-text-main">BreakPilot</div>
<div class="brand-text-sub">Studio (Refactored)</div>
</div>
</div>
<div class="top-actions">
<button class="theme-toggle" id="theme-toggle">
<span id="theme-icon">🌙</span>
<span id="theme-label">Dark</span>
</button>
<button class="btn btn-sm btn-ghost" id="btn-legal">⚖️</button>
<button class="btn btn-sm btn-ghost" id="btn-admin">⚙️</button>
<button class="btn btn-sm btn-ghost" id="btn-login">Login</button>
</div>
</header>
<div class="main-layout">
<aside class="sidebar">
<!-- Sidebar Content -->
</aside>
<main class="content">
<!-- Main Content -->
<h1>Refactoring erfolgreich!</h1>
<p>Die Komponenten wurden erfolgreich extrahiert.</p>
</main>
</div>
<div class="footer">
<span>© 2025 BreakPilot</span>
</div>
</div>
<!-- Legal Modal (AGB, Datenschutz, etc.) -->
{legal_modal.get_legal_modal_html()}
<!-- Auth Modal (Login/Register) -->
{auth_modal.get_auth_modal_html()}
<!-- Admin Panel Modal -->
{admin_panel.get_admin_panel_html()}
<!-- DSMS WebUI Modal -->
{admin_dsms.get_admin_dsms_html()}
<script>
/* Theme Toggle and Base JavaScript */
{base.get_base_js()}
/* Hier würde das gemeinsame JavaScript kommen (i18n, notifications, etc.) */
/* Dieses ist noch in studio.py.backup Zeilen ~3798-8000 */
/* Legal Modal JavaScript */
{legal_modal.get_legal_modal_js()}
/* Auth Modal JavaScript */
{auth_modal.get_auth_modal_js()}
/* Admin Panel JavaScript */
{admin_panel.get_admin_panel_js()}
/* E-Mail Template Management */
{admin_email.get_admin_email_js()}
/* Statistics & GDPR Export */
{admin_stats.get_admin_stats_js()}
/* DSMS Functions */
{admin_dsms.get_admin_dsms_js()}
/* Initialization Code */
// Initialize theme toggle
if (typeof initThemeToggle === 'function') {{
initThemeToggle();
}}
</script>
</body>
</html>
"""