diff --git a/routes/__pycache__/main.cpython-313.pyc b/routes/__pycache__/main.cpython-313.pyc index 599ff98..fcba5ca 100644 Binary files a/routes/__pycache__/main.cpython-313.pyc and b/routes/__pycache__/main.cpython-313.pyc differ diff --git a/routes/__pycache__/room_files.cpython-313.pyc b/routes/__pycache__/room_files.cpython-313.pyc index 68acc76..6167f99 100644 Binary files a/routes/__pycache__/room_files.cpython-313.pyc and b/routes/__pycache__/room_files.cpython-313.pyc differ diff --git a/routes/main.py b/routes/main.py index 02e419b..0a049f8 100644 --- a/routes/main.py +++ b/routes/main.py @@ -57,6 +57,9 @@ 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 notifications + recent_notifications = Notif.query.filter_by(user_id=current_user.id).order_by(Notif.timestamp.desc()).limit(5).all() + # Get recent events (last 7) if current_user.is_admin: recent_events = Event.query.order_by(Event.timestamp.desc()).limit(7).all() @@ -314,7 +317,8 @@ def init_routes(main_bp): message_count=message_count, attachment_count=attachment_count, conversation_total_size=conversation_total_size, # Conversation storage size - recent_conversations=recent_conversations) + recent_conversations=recent_conversations, + recent_notifications=recent_notifications) UPLOAD_FOLDER = os.path.join(os.getcwd(), 'uploads', 'profile_pics') if not os.path.exists(UPLOAD_FOLDER): diff --git a/templates/components/notification_overview.html b/templates/components/notification_overview.html new file mode 100644 index 0000000..f358002 --- /dev/null +++ b/templates/components/notification_overview.html @@ -0,0 +1,48 @@ +{% macro notification_overview(unread_count, recent_notifications) %} +
+
+
+
+
Notifications
+ View All +
+
+
+
+ + Unread: +
+
{{ unread_count }}
+
+
+ + {% if recent_notifications %} +
+
+
Recent Notifications
+
+
+ {% for notification in recent_notifications %} +
+
+
+
{{ notification.title }}
+ + {{ notification.message }} + • {{ notification.created_at.strftime('%Y-%m-%d %H:%M') }} + +
+ {% if not notification.read %} + New + {% endif %} +
+
+ {% endfor %} +
+ {% else %} +
No recent notifications
+ {% endif %} +
+
+
+{% endmacro %} \ No newline at end of file diff --git a/templates/dashboard/dashboard.html b/templates/dashboard/dashboard.html index 4f79bb4..4ab82a2 100644 --- a/templates/dashboard/dashboard.html +++ b/templates/dashboard/dashboard.html @@ -25,6 +25,7 @@ {% from 'components/trash_type.html' import trash_type %} {% from 'components/recent_activity.html' import recent_activity %} {% from 'components/conversation_storage.html' import conversation_storage %} +{% from 'components/notification_overview.html' import notification_overview %} -
- {{ storage_overview(room_count, file_count, folder_count, total_size) }} - {{ storage_usage(storage_by_type) }} - {{ recent_activity(recent_events, is_admin) }} - {{ conversation_storage(conversation_count, message_count, attachment_count, conversation_total_size, recent_conversations) }} - - {% if current_user.is_admin %} - {{ contacts(recent_contacts) }} - - {% endif %} - - {{ starred_files(starred_count, file_count) }} - {{ trash(trash_count, pending_deletion, oldest_trash_date, trash_size) }} - {{ trash_type(trash_by_type) }} + +
+

Storage Overview

+
+ {{ storage_overview(room_count, file_count, folder_count, total_size) }} + {{ storage_usage(storage_by_type) }} + {{ conversation_storage(conversation_count, message_count, attachment_count, conversation_total_size, recent_conversations) }} + {{ trash(trash_count, pending_deletion, oldest_trash_date, trash_size) }} + {{ trash_type(trash_by_type) }} +
+
+ + +
+

Activity & Statistics

+
+ {{ recent_activity(recent_events, is_admin) }} + {{ starred_files(starred_count, file_count) }} + {{ notification_overview(unread_notifications, recent_notifications) }} + {% if current_user.is_admin %} + {{ contacts(recent_contacts) }} + {% endif %} +
{% endblock %}