drop/server/composables/community-labels.ts
wdunn001 0348d10602 community: M4 -- game-server registry and issue reports
GameServer/GameServerStatusHistory/Issue/IssueComment models, a
strategy-per-probe_type ServerProbe (tcp_connect/http_get/presence_inferred,
mirroring script-library's game-server-registry-probe.py including the
integer ConnectTimeout fix), the bundled verified registry seed (WoW, EQEmu,
the Goldberg relay, Impostor, OpenDAoC), and full player+admin UI at
/community/servers and /community/issues. Featured flag pins the
persistent-world servers (WoW/EQEmu/OpenDAoC) to a compact status panel
surfaced on the community landing page. Scheduled sweep respects a
circuit-breaker backoff and never probes on page load; the relay is never
network-probed, only liveness-checked over ssh.
2026-08-03 03:19:54 -04:00

54 lines
2.1 KiB
TypeScript

// Static-key $t() lookups for M4's enum-backed labels. The
// @intlify/vue-i18n/no-dynamic-keys lint rule disallows building a
// translation key from a runtime value (e.g. `$t(`community.servers.status.
// ${status}`)`, which the i18n key-extraction tooling can't statically see)
// -- these composables give every enum value its own literal $t() call
// instead, indexed by a plain object afterwards.
export function useServerStatusLabel() {
const { t } = useI18n();
const labels: Record<string, string> = {
up: t("community.servers.status.up"),
down: t("community.servers.status.down"),
degraded: t("community.servers.status.degraded"),
unknown: t("community.servers.status.unknown"),
};
return (status: string) => labels[status] ?? status;
}
export function useIssueStatusLabel() {
const { t } = useI18n();
const labels: Record<string, string> = {
open: t("community.issues.status.open"),
triaged: t("community.issues.status.triaged"),
in_progress: t("community.issues.status.in_progress"),
resolved: t("community.issues.status.resolved"),
wontfix: t("community.issues.status.wontfix"),
duplicate: t("community.issues.status.duplicate"),
};
return (status: string) => labels[status] ?? status;
}
export function useIssueKindLabel() {
const { t } = useI18n();
const labels: Record<string, string> = {
bug: t("community.issues.kind.bug"),
crash: t("community.issues.kind.crash"),
launch_failure: t("community.issues.kind.launch_failure"),
missing_files: t("community.issues.kind.missing_files"),
multiplayer: t("community.issues.kind.multiplayer"),
performance: t("community.issues.kind.performance"),
request: t("community.issues.kind.request"),
};
return (kind: string) => labels[kind] ?? kind;
}
export function useIssueSeverityLabel() {
const { t } = useI18n();
const labels: Record<string, string> = {
blocker: t("community.issues.severity.blocker"),
major: t("community.issues.severity.major"),
minor: t("community.issues.severity.minor"),
cosmetic: t("community.issues.severity.cosmetic"),
};
return (severity: string) => labels[severity] ?? severity;
}