From 0878bde259d348effb01a4c0fb677cff8e1c9e58 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 22 Mar 2026 13:25:02 +0100 Subject: [PATCH] fix: redesign session review as card layout instead of cramped table --- app/sites/[id]/settings/page.tsx | 156 ++++++++++++------------------- 1 file changed, 59 insertions(+), 97 deletions(-) diff --git a/app/sites/[id]/settings/page.tsx b/app/sites/[id]/settings/page.tsx index 5fefba0..e2cfe98 100644 --- a/app/sites/[id]/settings/page.tsx +++ b/app/sites/[id]/settings/page.tsx @@ -1369,104 +1369,66 @@ export default function SiteSettingsPage() { )} - {/* Sessions table */} -
- - - - - - - - - - - - - - - - {(sessions?.sessions || []) - .filter(s => botView === 'blocked' ? s.bot_filtered : !s.bot_filtered) - .map((session) => ( - - - - - - - - - - - - ))} - {(sessions?.sessions || []).filter(s => botView === 'blocked' ? s.bot_filtered : !s.bot_filtered).length === 0 && ( - - - + {/* Session cards */} +
+ {(sessions?.sessions || []) + .filter(s => botView === 'blocked' ? s.bot_filtered : !s.bot_filtered) + .map((session) => ( +
+ { + const next = new Set(selectedSessions) + if (e.target.checked) next.add(session.session_id) + else next.delete(session.session_id) + setSelectedSessions(next) + }} + className="rounded border-neutral-600 bg-neutral-800 text-brand-orange focus:ring-brand-orange shrink-0" + /> + +
+
+ {session.first_page} + = 5 ? 'bg-red-900/30 text-red-400' : + session.suspicion_score >= 3 ? 'bg-yellow-900/30 text-yellow-400' : + 'bg-neutral-800 text-neutral-400' + }`}> + {session.suspicion_score >= 5 ? 'High risk' : session.suspicion_score >= 3 ? 'Suspicious' : 'Low risk'} + +
+
+ {session.pageviews} page{session.pageviews !== 1 ? 's' : ''} + {session.duration != null ? `${Math.round(session.duration)}s` : 'No duration'} + {[session.city, session.country].filter(Boolean).join(', ') || 'Unknown location'} + {session.browser || 'Unknown browser'} + {session.referrer || 'Direct'} +
+
+ + {botView === 'review' ? ( + + ) : ( + )} -
-
- { - if (e.target.checked) { - const allIds = new Set((sessions?.sessions || []).map(s => s.session_id)) - setSelectedSessions(allIds) - } else { - setSelectedSessions(new Set()) - } - }} - checked={selectedSessions.size > 0 && selectedSessions.size === (sessions?.sessions || []).length} - className="rounded border-neutral-600 bg-neutral-800 text-brand-orange focus:ring-brand-orange" - /> - SessionPagesDurationLocationBrowserReferrerScoreAction
- { - const next = new Set(selectedSessions) - if (e.target.checked) next.add(session.session_id) - else next.delete(session.session_id) - setSelectedSessions(next) - }} - className="rounded border-neutral-600 bg-neutral-800 text-brand-orange focus:ring-brand-orange" - /> - -
{session.session_id.slice(0, 12)}...
-
{session.first_page}
-
{session.pageviews} - {session.duration != null ? `${Math.round(session.duration)}s` : } - - {[session.city, session.country].filter(Boolean).join(', ') || '\u2014'} - {session.browser || '\u2014'}{session.referrer || Direct} - = 5 ? 'bg-red-900/30 text-red-400' : - session.suspicion_score >= 3 ? 'bg-yellow-900/30 text-yellow-400' : - 'bg-neutral-800 text-neutral-400' - }`}> - {session.suspicion_score} - - - {botView === 'review' ? ( - - ) : ( - - )} -
- {botView === 'blocked' ? 'No blocked sessions' : 'No suspicious sessions found'} -
+
+ ))} + {(sessions?.sessions || []).filter(s => botView === 'blocked' ? s.bot_filtered : !s.bot_filtered).length === 0 && ( +
+ {botView === 'blocked' ? 'No blocked sessions' : 'No suspicious sessions found'} +
+ )}