From e4238d9fdb40f744fbc3d65a191ef49182cfe9e1 Mon Sep 17 00:00:00 2001 From: Kobe Date: Fri, 6 Jun 2025 09:53:50 +0200 Subject: [PATCH] Better dashboard cards --- .../components/notification_overview.html | 116 ++++++++---------- templates/components/recent_activity.html | 14 +-- 2 files changed, 61 insertions(+), 69 deletions(-) diff --git a/templates/components/notification_overview.html b/templates/components/notification_overview.html index 5713cce..af0744f 100644 --- a/templates/components/notification_overview.html +++ b/templates/components/notification_overview.html @@ -3,88 +3,80 @@
-
Notifications
+
+ + Notifications +
View All
-
-
-
- - Unread: -
-
{{ unread_count }}
-
-
- + {% if recent_notifications %} -
-
-
Recent Notifications
-
{% for notification in recent_notifications %} -
+
-
- {% if notification.notif_type == 'account_created' %} -
- Account Created -
- - Welcome to DocuPulse! Your account has been created successfully. - - {% elif notification.notif_type == 'room_invite' %} -
- Room Invitation -
- - {% if notification.sender %} - {{ notification.sender.username }} invited you to join room "{{ notification.details.room_name }}" +
+
+
+ {% if notification.notif_type == 'account_created' %} + Account Created + {% elif notification.notif_type == 'room_invite' %} + Room Invitation + {% elif notification.notif_type == 'room_invite_removed' %} + Room Invitation Removed + {% elif notification.notif_type == 'conversation_invite' %} + Conversation Invitation + {% elif notification.notif_type == 'conversation_invite_removed' %} + Conversation Invitation Removed + {% elif notification.notif_type == 'conversation_message' %} + New Message + {% else %} + {{ notification.notif_type|replace('_', ' ')|title }} {% endif %} - - {% elif notification.notif_type == 'conversation_invite' %} -
- Conversation Invitation
- {% if notification.sender %} - {{ notification.sender.username }} invited you to a conversation - {% endif %} - - {% elif notification.notif_type == 'conversation_message' %} -
- New Message -
- - {% if notification.sender %} - {{ notification.sender.username }} sent a message in "{{ notification.details.conversation_name }}" - {% endif %} - - {% else %} -
- {{ notification.notif_type|replace('_', ' ')|title }} -
- - {% if notification.details and notification.details.message %} + {% if notification.notif_type == 'account_created' %} + Welcome to DocuPulse! Your account has been created successfully. + {% elif notification.notif_type == 'room_invite' and notification.sender and notification.details %} + {{ notification.sender.username }} {{ notification.sender.last_name }} invited you to join room "{{ notification.details.room_name }}" + {% elif notification.notif_type == 'room_invite_removed' and notification.sender and notification.details %} + {{ notification.sender.username }} {{ notification.sender.last_name }} removed your invitation to room "{{ notification.details.room_name }}" + {% elif notification.notif_type == 'conversation_invite' and notification.sender and notification.details %} + {{ notification.sender.username }} {{ notification.sender.last_name }} invited you to conversation "{{ notification.details.conversation_name }}" + {% elif notification.notif_type == 'conversation_invite_removed' and notification.sender and notification.details %} + {{ notification.sender.username }} {{ notification.sender.last_name }} removed your invitation to conversation "{{ notification.details.conversation_name }}" + {% elif notification.notif_type == 'conversation_message' and notification.sender and notification.details %} + {{ notification.sender.username }} {{ notification.sender.last_name }} sent a message in conversation "{{ notification.details.conversation_name }}" + {% elif notification.details and notification.details.message %} {{ notification.details.message }} {% endif %} - {% endif %} -
- - {{ notification.timestamp.strftime('%Y-%m-%d %H:%M') }} - +
+ + {{ notification.timestamp.strftime('%Y-%m-%d %H:%M') }} + +
- {% if not notification.read %} - New + + {% if notification.notif_type in ['room_invite', 'room_invite_removed'] and notification.details and notification.details.room_id %} + + + + {% elif notification.notif_type in ['conversation_invite', 'conversation_invite_removed', 'conversation_message'] and notification.details and notification.details.conversation_id %} + + + {% endif %}
{% endfor %}
{% else %} -
No recent notifications
+
+ +

No recent notifications

+
{% endif %}
diff --git a/templates/components/recent_activity.html b/templates/components/recent_activity.html index cef594d..ac6afc0 100644 --- a/templates/components/recent_activity.html +++ b/templates/components/recent_activity.html @@ -39,9 +39,9 @@ {% elif event.event_type == 'room_update' %} Updated room "{{ event.details.get('room_name', 'a room') }}" {% elif event.event_type == 'room_member_add' %} - Added {{ event.details.get('added_user_name', 'a user') }} to room "{{ event.details.get('room_name', 'a room') }}" + Added {{ event.details.get('added_user_name', 'a user') }} {{ event.details.get('added_user_last_name', '') }} to room "{{ event.details.get('room_name', 'a room') }}" {% elif event.event_type == 'room_member_remove' %} - Removed {{ event.details.get('removed_user_name', 'a user') }} from room "{{ event.details.get('room_name', 'a room') }}" + Removed {{ event.details.get('removed_user_name', 'a user') }} {{ event.details.get('removed_user_last_name', '') }} from room "{{ event.details.get('room_name', 'a room') }}" {% elif event.event_type == 'conversation_create' %} Started conversation "{{ event.details.get('name', 'a conversation') }}" {% elif event.event_type == 'conversation_open' %} @@ -49,22 +49,22 @@ {% elif event.event_type == 'conversation_update' %} Updated conversation "{{ event.details.get('conversation_name', 'a conversation') }}" {% elif event.event_type == 'conversation_member_add' %} - Added {{ event.details.get('added_user_name', 'a user') }} to conversation "{{ event.details.get('conversation_name', 'a conversation') }}" + Added {{ event.details.get('added_user_name', 'a user') }} {{ event.details.get('added_user_last_name', '') }} to conversation "{{ event.details.get('conversation_name', 'a conversation') }}" {% elif event.event_type == 'conversation_member_remove' %} - Removed {{ event.details.get('removed_user_name', 'a user') }} from conversation "{{ event.details.get('conversation_name', 'a conversation') }}" + Removed {{ event.details.get('removed_user_name', 'a user') }} {{ event.details.get('removed_user_last_name', '') }} from conversation "{{ event.details.get('conversation_name', 'a conversation') }}" {% elif event.event_type == 'message_create' %} Sent a message in "{{ event.details.get('conversation_name', 'a conversation') }}" {% elif event.event_type == 'user_create' %} - Created user account for {{ event.details.get('user_name', 'a user') }} + Created user account for {{ event.details.get('user_name', 'a user') }} {{ event.details.get('user_last_name', '') }} {% elif event.event_type == 'user_update' %} - Updated user account for {{ event.details.get('user_name', 'a user') }} + Updated user account for {{ event.details.get('user_name', 'a user') }} {{ event.details.get('user_last_name', '') }} {% else %} {{ event.event_type|replace('_', ' ')|title }} {% endif %}
{% if is_admin %} - by {{ event.user.username }} + by {{ event.user.username }} {{ event.user.last_name }} {% endif %} {{ event.timestamp.strftime('%Y-%m-%d %H:%M') }}