UI-Verbesserungen: Favicon, Tab-Titel, Kalender umbenennen, Avatar-Crop, Farbpalette

- SVG-Favicon hinzugefügt
- Dynamischer Tab-Titel (z.B. "Calendarr - März 2026")
- Kalender per Doppelklick umbenennen (Backend + Frontend)
- Avatar-Anzeige im Topbar gefixt (onerror Fallback, robustes Laden)
- Avatar-Upload mit Cropper.js Bildausschnitt-Wahl
- Avatar-Limit auf 5 MB erhöht, Thumbnail auf 512px
- Farbpalette statt nativem Color-Picker für Kalenderfarben
This commit is contained in:
2026-03-26 15:14:34 +01:00
parent 77d6e20f86
commit 1bbabd6c4d
7 changed files with 256 additions and 43 deletions

View File

@@ -27,6 +27,7 @@ class AccountCreate(BaseModel):
class CalendarUpdate(BaseModel):
enabled: Optional[bool] = None
color: Optional[str] = None
name: Optional[str] = None
class EventCreate(BaseModel):
@@ -221,6 +222,8 @@ def update_calendar(
calendar.enabled = data.enabled
if data.color is not None:
calendar.color = data.color
if data.name is not None:
calendar.name = data.name
db.commit()
return {"ok": True}

View File

@@ -19,7 +19,7 @@ router = APIRouter()
AVATAR_DIR = DATA_DIR / "avatars"
AVATAR_DIR.mkdir(parents=True, exist_ok=True)
MAX_AVATAR_SIZE = 2 * 1024 * 1024 # 2 MB
MAX_AVATAR_SIZE = 5 * 1024 * 1024 # 5 MB
ALLOWED_TYPES = {"image/jpeg", "image/png", "image/webp"}
@@ -78,12 +78,12 @@ async def upload_avatar(
data = await file.read()
if len(data) > MAX_AVATAR_SIZE:
raise HTTPException(400, "Datei zu groß (max. 2 MB)")
raise HTTPException(400, "Datei zu groß (max. 5 MB)")
# Resize to 256x256
img = Image.open(io.BytesIO(data))
img = img.convert("RGB")
img.thumbnail((256, 256))
img.thumbnail((512, 512))
filename = f"user_{current_user.id}.jpg"
path = AVATAR_DIR / filename