because I got bored of customising my CV for every job
1import { getServerUrl, parseServerUrl } from "@/utils/config";
2import type { StatusConfig } from "./constants";
3import type { ServerInfo } from "./types";
4
5/**
6 * Get server information from shared configuration
7 */
8export const getServerInfo = (): ServerInfo => {
9 const serverUrl = getServerUrl();
10 const parsed = parseServerUrl(serverUrl);
11
12 return {
13 url: parsed.url,
14 hostname: parsed.hostname,
15 port: parsed.port,
16 protocol: parsed.protocol,
17 };
18};
19
20/**
21 * Get status configuration based on server state
22 */
23export const getStatusConfig = (
24 isOnline: boolean,
25 isOffline: boolean,
26): StatusConfig => {
27 if (isOnline) {
28 return { color: "text-ctp-green", icon: "●", text: "Server Online" };
29 }
30 if (isOffline) {
31 return { color: "text-ctp-red", icon: "●", text: "Server Offline" };
32 }
33 return { color: "text-ctp-yellow", icon: "○", text: "Checking..." };
34};