feat(admin): add geolocation information to user sessions and implement geo IP fetching

This commit is contained in:
Jose Selesan
2026-06-10 10:01:36 -03:00
parent 93b3a82638
commit 00f0cf511f
5 changed files with 104 additions and 39 deletions

View File

@@ -19,6 +19,7 @@ import {
CheckCircle2,
Globe,
LogIn,
MapPin,
Monitor,
RefreshCw,
Search,
@@ -99,6 +100,10 @@ function SessionRow({ session }: { session: AdminUserSession }) {
const isExpired = new Date(session.expiresAt) < new Date();
const userAgent = session.userAgent ?? 'Desconocido';
const ip = session.ipAddress ?? '—';
const location =
session.city || session.country
? [session.city, session.country].filter(Boolean).join(', ')
: null;
return (
<div className="rounded-xl border border-border/60 p-4">
@@ -126,6 +131,12 @@ function SessionRow({ session }: { session: AdminUserSession }) {
<Globe className="size-3" />
{ip}
</span>
{location && (
<span className="flex items-center gap-1">
<MapPin className="size-3" />
{location}
</span>
)}
<span className="flex items-center gap-1">
<LogIn className="size-3" />
{new Date(session.createdAt).toLocaleString()}