import { getServerUrl, parseServerUrl } from "@/utils/config"; import type { StatusConfig } from "./constants"; import type { ServerInfo } from "./types"; /** * Get server information from shared configuration */ export const getServerInfo = (): ServerInfo => { const serverUrl = getServerUrl(); const parsed = parseServerUrl(serverUrl); return { url: parsed.url, hostname: parsed.hostname, port: parsed.port, protocol: parsed.protocol, }; }; /** * Get status configuration based on server state */ export const getStatusConfig = ( isOnline: boolean, isOffline: boolean, ): StatusConfig => { if (isOnline) { return { color: "text-ctp-green", icon: "●", text: "Server Online" }; } if (isOffline) { return { color: "text-ctp-red", icon: "●", text: "Server Offline" }; } return { color: "text-ctp-yellow", icon: "○", text: "Checking..." }; };