Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
899 B · 34 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435import { 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..." };};