diff --git a/routes/__pycache__/main.cpython-313.pyc b/routes/__pycache__/main.cpython-313.pyc index 249de6a..b122c38 100644 Binary files a/routes/__pycache__/main.cpython-313.pyc and b/routes/__pycache__/main.cpython-313.pyc differ diff --git a/routes/main.py b/routes/main.py index 2f426f8..328db53 100644 --- a/routes/main.py +++ b/routes/main.py @@ -45,6 +45,12 @@ def init_routes(main_bp): active_count = User.query.filter_by(is_active=True).count() inactive_count = User.query.filter_by(is_active=False).count() + # Get recent events (last 7) + if current_user.is_admin: + recent_events = Event.query.order_by(Event.timestamp.desc()).limit(7).all() + else: + recent_events = Event.query.filter_by(user_id=current_user.id).order_by(Event.timestamp.desc()).limit(7).all() + # Room count and size logic if current_user.is_admin: logger.info("Loading admin dashboard...") @@ -261,7 +267,9 @@ def init_routes(main_bp): oldest_trash_date=oldest_trash_date, trash_size=trash_size, pending_deletion=pending_deletion, - trash_by_type=trash_by_type) + trash_by_type=trash_by_type, + recent_events=recent_events, + is_admin=current_user.is_admin) UPLOAD_FOLDER = os.path.join(os.getcwd(), 'uploads', 'profile_pics') if not os.path.exists(UPLOAD_FOLDER): diff --git a/templates/components/recent_activity.html b/templates/components/recent_activity.html index bbb32e3..94ceb3e 100644 --- a/templates/components/recent_activity.html +++ b/templates/components/recent_activity.html @@ -1,58 +1,71 @@ -{% macro recent_activity(activities) %} +{% macro recent_activity(events, is_admin=False) %}
No recent activity
+