feat(admin): show PWA badge in user activity panel
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Purple "PWA" badge next to browser name when session was from installed
PWA app. Also reflected in browser grouping as "Chrome Mobile (PWA)" etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-03-18 09:19:24 +01:00
parent d38066e64f
commit a9b78f9bf8
2 changed files with 15 additions and 2 deletions

View File

@ -88,6 +88,7 @@ def admin_user_activity():
'started_at': sess.started_at,
'device_type': sess.device_type or '-',
'browser': sess.browser or '-',
'is_pwa': getattr(sess, 'is_pwa', False) or False,
'duration_min': duration_min,
'page_views_count': sess.page_views_count or 0,
})

View File

@ -104,6 +104,18 @@
.device-tablet { background: #FEF3C7; color: #D97706; }
.device-other { background: #F3F4F6; color: #6B7280; }
.pwa-badge {
display: inline-block;
padding: 1px 6px;
border-radius: var(--radius-sm);
font-size: 10px;
font-weight: 700;
background: #7C3AED;
color: white;
vertical-align: middle;
margin-left: 4px;
}
/* ---- Group tabs ---- */
.group-tabs {
display: flex;
@ -320,7 +332,7 @@
</thead>
<tbody>
{% for s in recent_sessions %}
<tr data-user="{{ s.user_name }}" data-device="{{ s.device_type }}" data-browser="{{ s.browser }}">
<tr data-user="{{ s.user_name }}" data-device="{{ s.device_type }}" data-browser="{{ s.browser }}{{ ' (PWA)' if s.is_pwa }}">
<td>{{ s.user_name }}</td>
<td data-sort-value="{{ s.started_at.strftime('%Y%m%d%H%M') if s.started_at else '0' }}">{{ s.started_at.strftime('%d.%m.%Y %H:%M') if s.started_at else '-' }}</td>
<td>
@ -329,7 +341,7 @@
{{ s.device_type }}
</span>
</td>
<td>{{ s.browser }}</td>
<td>{{ s.browser }}{% if s.is_pwa %} <span class="pwa-badge">PWA</span>{% endif %}</td>
<td class="num">{{ s.duration_min }}</td>
<td class="num">{{ s.page_views_count }}</td>
</tr>