16 lines
819 B
TypeScript
16 lines
819 B
TypeScript
import { createTimeFormatter } from '../time-zone.js';
|
|
import { serverIdentity } from './server-labels.js';
|
|
import type { ServerMatch } from '../match-history.js';
|
|
|
|
export function matchInstanceLabel(match: ServerMatch): string {
|
|
const identity = serverIdentity(match.server);
|
|
const parts = [identity.map !== match.map ? identity.map : '', identity.lobby === null ? '' : `Lobby ${identity.lobby}`,
|
|
match.game === 't5' ? 'Black Ops I' : match.game === 't6' ? 'Black Ops II' : match.game];
|
|
return parts.filter(Boolean).join(' · ') || match.server;
|
|
}
|
|
|
|
/** Shared history formatting; exact timestamps belong in the time element tooltip. */
|
|
export function matchStartedLabel(value: string, zone: string, now = new Date()): string {
|
|
return createTimeFormatter(zone).relative(value, now.getTime());
|
|
}
|