notifications on dashboard
This commit is contained in:
48
templates/components/notification_overview.html
Normal file
48
templates/components/notification_overview.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% macro notification_overview(unread_count, recent_notifications) %}
|
||||
<div class="masonry-card">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="card-title mb-0"><i class="fas fa-bell me-2"></i>Notifications</h5>
|
||||
<a href="{{ url_for('main.notifications') }}" class="btn btn-primary btn-sm">View All</a>
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="fas fa-envelope me-2 icon-primary"></i>
|
||||
<span class="text-muted">Unread:</span>
|
||||
</div>
|
||||
<div class="fw-bold text-primary">{{ unread_count }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if recent_notifications %}
|
||||
<hr class="my-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="mb-0 text-muted">Recent Notifications</h6>
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
{% for notification in recent_notifications %}
|
||||
<div class="list-group-item list-group-item-action px-0">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="fw-bold {% if not notification.read %}text-primary{% endif %}">{{ notification.title }}</div>
|
||||
<small class="text-muted">
|
||||
{{ notification.message }}
|
||||
• {{ notification.created_at.strftime('%Y-%m-%d %H:%M') }}
|
||||
</small>
|
||||
</div>
|
||||
{% if not notification.read %}
|
||||
<span class="badge bg-primary rounded-pill">New</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-muted small text-center mt-3">No recent notifications</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -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 %}
|
||||
|
||||
<style>
|
||||
.masonry {
|
||||
@@ -42,22 +43,37 @@
|
||||
width: 100%;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.section-title {
|
||||
color: var(--primary-color);
|
||||
margin-bottom: 1.5rem;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="masonry">
|
||||
{{ 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) }}
|
||||
<!-- {{ contact_status(active_count, inactive_count) }} -->
|
||||
{% endif %}
|
||||
|
||||
{{ starred_files(starred_count, file_count) }}
|
||||
{{ trash(trash_count, pending_deletion, oldest_trash_date, trash_size) }}
|
||||
{{ trash_type(trash_by_type) }}
|
||||
<!-- Storage Section -->
|
||||
<div class="mb-4">
|
||||
<h2 class="section-title">Storage Overview</h2>
|
||||
<div class="masonry">
|
||||
{{ 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) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Other Components Section -->
|
||||
<div>
|
||||
<h2 class="section-title">Activity & Statistics</h2>
|
||||
<div class="masonry">
|
||||
{{ 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 %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user