Add event colors (Catppuccin Mocha) and read-only week view for users
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 20s

Admins can now pick a color per event from a Catppuccin Mocha palette;
existing events default to blue. Colors flow through to both the admin
timeline and the new "Неделя" tab in the user view, which reuses the
admin's weekly grid in a read-only mode. Also reworks event blocks to
show a single-line "start–end title" so short events no longer overflow,
tidies the admin toolbar, and expands mobile responsiveness across both
frontends.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
vrubel 2026-07-12 18:03:21 +00:00
parent fc66954c03
commit c40a6569b4
10 changed files with 685 additions and 64 deletions

View file

@ -25,7 +25,7 @@ class Task(Base):
class Event(Base):
__tablename__ = "events"
id = Column(Integer, primary_key=True, index=True)
date = Column(String, index=True) # YYYY-MM-DD
start_time = Column(String) # HH:MM
@ -33,6 +33,7 @@ class Event(Base):
title = Column(String, nullable=False)
repeat_weekly = Column(Boolean, default=False)
weekday = Column(Integer) # 0=Monday, 6=Sunday, только для weekly events
color = Column(String, default="blue") # ключ цвета из палитры Catppuccin Mocha
class WeeklyTaskException(Base):
@ -58,6 +59,7 @@ class EventException(Base):
replacement_date = Column(String)
replacement_start_time = Column(String)
replacement_duration_min = Column(Integer)
replacement_color = Column(String)
class TelegramUser(Base):
@ -85,6 +87,9 @@ async def _run_migrations(conn):
await conn.execute(text("ALTER TABLE events ADD COLUMN repeat_weekly BOOLEAN DEFAULT 0"))
if "weekday" not in event_columns:
await conn.execute(text("ALTER TABLE events ADD COLUMN weekday INTEGER"))
if "color" not in event_columns:
await conn.execute(text("ALTER TABLE events ADD COLUMN color TEXT DEFAULT 'blue'"))
await conn.execute(text("UPDATE events SET color = 'blue' WHERE color IS NULL"))
exception_columns = table_columns.get("weekly_task_exceptions", set())
if "task_id" not in exception_columns:
@ -92,6 +97,10 @@ async def _run_migrations(conn):
if "replacement_date" not in exception_columns:
await conn.execute(text("ALTER TABLE weekly_task_exceptions ADD COLUMN replacement_date TEXT"))
event_exception_columns = table_columns.get("event_exceptions", set())
if "replacement_color" not in event_exception_columns:
await conn.execute(text("ALTER TABLE event_exceptions ADD COLUMN replacement_color TEXT"))
async def _get_table_columns(conn):
table_names = ["tasks", "events", "weekly_task_exceptions", "event_exceptions"]