fix: remove duplicate card subtitle, improve disable logic, inclusive offline count

This commit is contained in:
2026-03-21 21:16:26 +01:00
parent 025c021896
commit a5e50fe8b7
2 changed files with 5 additions and 7 deletions

View File

@@ -52,6 +52,7 @@ export function ServerCard({ server }: ServerCardProps) {
ServiceStatus.Stopping, ServiceStatus.Stopping,
ServiceStatus.Unknown, ServiceStatus.Unknown,
].includes(server.status); ].includes(server.status);
const isRunning = server.status === ServiceStatus.Running;
return ( return (
<div className="overflow-hidden rounded-lg border border-gh-border bg-gh-canvas transition-colors hover:border-gh-blue/40"> <div className="overflow-hidden rounded-lg border border-gh-border bg-gh-canvas transition-colors hover:border-gh-blue/40">
@@ -60,9 +61,6 @@ export function ServerCard({ server }: ServerCardProps) {
<span className="text-sm font-semibold text-gh-primary">{server.name}</span> <span className="text-sm font-semibold text-gh-primary">{server.name}</span>
<StatusDot status={server.status} /> <StatusDot status={server.status} />
</div> </div>
<div className="mt-1 text-xs text-gh-muted">
{server.state?.track || 'No track'} · {server.state?.playerCount ?? 0} players
</div>
<div className="mt-3 grid grid-cols-2 gap-3"> <div className="mt-3 grid grid-cols-2 gap-3">
<div> <div>
@@ -91,7 +89,7 @@ export function ServerCard({ server }: ServerCardProps) {
variant="primary" variant="primary"
size="sm" size="sm"
onClick={startServer} onClick={startServer}
disabled={server.status === ServiceStatus.Running || isPending || disabled} disabled={isRunning || disabled || isPending}
> >
Start Start
</GhButton> </GhButton>
@@ -99,7 +97,7 @@ export function ServerCard({ server }: ServerCardProps) {
variant="ghost" variant="ghost"
size="sm" size="sm"
onClick={restartServer} onClick={restartServer}
disabled={server.status === ServiceStatus.Stopped || isPending || disabled} disabled={!isRunning || disabled || isPending}
> >
Restart Restart
</GhButton> </GhButton>
@@ -107,7 +105,7 @@ export function ServerCard({ server }: ServerCardProps) {
variant="danger-outline" variant="danger-outline"
size="sm" size="sm"
onClick={stopServer} onClick={stopServer}
disabled={server.status === ServiceStatus.Stopped || isPending || disabled} disabled={!isRunning || disabled || isPending}
> >
Stop Stop
</GhButton> </GhButton>

View File

@@ -24,7 +24,7 @@ export function ServerListWithActions({ servers, user }: ServerListWithActionsPr
const canCreateServer = hasPermission(user, 'server.create'); const canCreateServer = hasPermission(user, 'server.create');
const runningCount = servers.filter((s) => s.status === ServiceStatus.Running).length; const runningCount = servers.filter((s) => s.status === ServiceStatus.Running).length;
const offlineCount = servers.filter((s) => s.status === ServiceStatus.Stopped).length; const offlineCount = servers.filter((s) => s.status !== ServiceStatus.Running).length;
return ( return (
<> <>