/** * Servers overview page */ import { useQuery } from '@tanstack/react-query'; import { Link } from 'react-router-dom'; import { guildsApi } from '../services/api'; export function Servers() { const { data: guilds, isLoading } = useQuery({ queryKey: ['guilds'], queryFn: guildsApi.list, }); const total = guilds?.length ?? 0; const premiumCount = guilds?.filter((guild) => guild.premium).length ?? 0; const standardCount = total - premiumCount; return (
{/* Header */}

Servers

All servers that have added GuardDen

{/* Stats */}
Total Servers
{total}
Premium Servers
{premiumCount}
Standard Servers
{standardCount}
{/* Table */}
{isLoading ? (
Loading...
) : guilds && guilds.length > 0 ? (
{guilds.map((guild) => ( ))}
Server Server ID Owner ID Plan Actions
{guild.name} {guild.id} {guild.owner_id} {guild.premium ? 'Premium' : 'Standard'} Configure
) : (
No servers found
)}
); }