русский список удалений в английском интерфейсе
This commit is contained in:
@@ -6497,7 +6497,7 @@ function renderHockeyTimerEditorRow(item, focused = false) {
|
||||
? `#${event.player.number || "—"} ${event.player.name}`
|
||||
: "Заготовка без игрока";
|
||||
const description = [
|
||||
event.infraction?.label || "Нарушение не выбрано",
|
||||
hockeyInfractionWebLabel(event.infraction) || "Нарушение не выбрано",
|
||||
event.preset || "Длительность не выбрана",
|
||||
event.eventTime ? `момент ${event.eventTime}` : ""
|
||||
].filter(Boolean).join(" · ");
|
||||
@@ -6930,20 +6930,54 @@ function openTimerQuickEditor(focusActionId = "") {
|
||||
.map((entry, index) => {
|
||||
const parts = entry.split("=").map((part) => part.trim());
|
||||
if (parts.length >= 3) {
|
||||
const label = parts.slice(1, -1).join("=") || parts[0];
|
||||
return {
|
||||
id: parts[0] || `INF_${index + 1}`,
|
||||
label: parts.slice(1, -1).join("=") || parts[0],
|
||||
label,
|
||||
labelRu: label,
|
||||
labelEn: "",
|
||||
defaultPreset: parts.at(-1) || "2",
|
||||
teamPenalty: false
|
||||
};
|
||||
}
|
||||
if (parts.length === 2) {
|
||||
return { id: parts[0] || `INF_${index + 1}`, label: parts[1] || parts[0], defaultPreset: "2", teamPenalty: false };
|
||||
const label = parts[1] || parts[0];
|
||||
return { id: parts[0] || `INF_${index + 1}`, label, labelRu: label, labelEn: "", defaultPreset: "2", teamPenalty: false };
|
||||
}
|
||||
return { id: `INF_${index + 1}`, label: parts[0] || `Нарушение ${index + 1}`, defaultPreset: "2", teamPenalty: false };
|
||||
const label = parts[0] || `Нарушение ${index + 1}`;
|
||||
return { id: `INF_${index + 1}`, label, labelRu: label, labelEn: "", defaultPreset: "2", teamPenalty: false };
|
||||
});
|
||||
}
|
||||
|
||||
// Название нарушения в операторском веб-интерфейсе всегда показываем по-русски.
|
||||
// Внутренний label не меняем: он по-прежнему может использовать язык текущего
|
||||
// контекста в событиях/Mapping, поэтому телевизионную логику это не затрагивает.
|
||||
function hockeyInfractionWebLabel(infraction) {
|
||||
if (!infraction || typeof infraction !== "object") return "";
|
||||
|
||||
const directRussian = String(infraction.labelRu || infraction.name_ru || "").trim();
|
||||
if (directRussian) return directRussian;
|
||||
|
||||
const infractionId = String(infraction.id || infraction.code || "").trim();
|
||||
const directory = getByPath(state.data, "hockey.penalty_directory");
|
||||
if (infractionId && Array.isArray(directory)) {
|
||||
const directoryItem = directory.find((item) =>
|
||||
String(item?.code || item?.id || "").trim() === infractionId
|
||||
);
|
||||
const directoryRussian = String(directoryItem?.name_ru || "").trim();
|
||||
if (directoryRussian) return directoryRussian;
|
||||
}
|
||||
|
||||
return String(
|
||||
infraction.label
|
||||
|| infraction.name
|
||||
|| infraction.labelEn
|
||||
|| infraction.name_en
|
||||
|| infractionId
|
||||
|| ""
|
||||
).trim();
|
||||
}
|
||||
|
||||
function normalizeHockeyPlayer(component, row, side, index) {
|
||||
const props = component.props || {};
|
||||
const get = (fieldName, fallback = "") => formatValue(getByPath(row, props[fieldName]), fallback);
|
||||
@@ -7542,7 +7576,7 @@ function openTimerQuickEditor(focusActionId = "") {
|
||||
board,
|
||||
"prepared",
|
||||
event,
|
||||
`${event.eventTime || "—:—"} · ${event.teamPenalty ? "Командное удаление" : event.player?.name || "Игрок не выбран"} · ${event.infraction.label} · ${event.preset}`
|
||||
`${event.eventTime || "—:—"} · ${event.teamPenalty ? "Командное удаление" : event.player?.name || "Игрок не выбран"} · ${hockeyInfractionWebLabel(event.infraction)} · ${event.preset}`
|
||||
);
|
||||
emitInteraction(component, "penalty_assigned", {
|
||||
item_id: event.id,
|
||||
@@ -7925,7 +7959,7 @@ function openTimerQuickEditor(focusActionId = "") {
|
||||
showModal("Быстрая правка события", `
|
||||
<div class="hpd-time-editor">
|
||||
<strong>${escapeHtml(event.teamPenalty ? "Командное удаление" : event.player ? `#${event.player.number} ${event.player.name}` : "Заготовка удаления")}</strong>
|
||||
<span>${escapeHtml(event.infraction?.label || "Нарушение пока не выбрано")}</span>
|
||||
<span>${escapeHtml(hockeyInfractionWebLabel(event.infraction) || "Нарушение пока не выбрано")}</span>
|
||||
<label>Время события<input id="hpdEventTimeValue" type="text" value="${escapeHtml(event.eventTime || "")}" placeholder="18:42"></label>
|
||||
<label>Оставшееся время<input id="hpdRemainingValue" type="text" value="${escapeHtml(editableTimerValue(event.remainingMs))}" placeholder="02:00"></label>
|
||||
<button id="hpdApplyEvent" type="button" class="btn btn-accent">Применить</button>
|
||||
@@ -8321,7 +8355,7 @@ function hockeyInfractionRow(component, infraction, runtime) {
|
||||
row.classList.toggle("is-selected", board.selectedInfraction?.id === infraction.id);
|
||||
row.innerHTML = `
|
||||
<span class="hpd-infraction-drag">⋮⋮</span>
|
||||
<strong>${escapeHtml(infraction.label)}</strong>
|
||||
<strong>${escapeHtml(hockeyInfractionWebLabel(infraction))}</strong>
|
||||
${infraction.teamPenalty ? `<em>КОМ</em>` : ""}
|
||||
<small>${escapeHtml(infraction.defaultPreset)}</small>
|
||||
`;
|
||||
@@ -8429,7 +8463,7 @@ function hockeyInfractionDropdown(component, runtime) {
|
||||
} else if (hasInfraction) {
|
||||
field.innerHTML = `
|
||||
<small>За что</small>
|
||||
<strong>${escapeHtml(event.infraction.label)}</strong>
|
||||
<strong>${escapeHtml(hockeyInfractionWebLabel(event.infraction))}</strong>
|
||||
<span>${escapeHtml(event.infraction.id)}</span>
|
||||
`;
|
||||
} else if (hasPreset) {
|
||||
@@ -8684,7 +8718,7 @@ function hockeyPenaltyCard(component, event, runtime) {
|
||||
? `#${escapeHtml(event.player.number || "—")} ${escapeHtml(event.player.name)}`
|
||||
: "Перетащите игрока";
|
||||
const infractionText = event.infraction
|
||||
? escapeHtml(event.infraction.label)
|
||||
? escapeHtml(hockeyInfractionWebLabel(event.infraction))
|
||||
: "Перетащите сюда нарушение";
|
||||
const presetText = event.preset
|
||||
? `${escapeHtml(event.preset)} · ${escapeHtml(formatHockeyPenaltyTime(event.durationMs))}`
|
||||
@@ -13027,6 +13061,8 @@ function renderHockeyPenaltyDashboard(node, component, runtime) {
|
||||
return {
|
||||
id: String(infraction.id || ""),
|
||||
label: String(infraction.label || ""),
|
||||
labelRu: String(infraction.labelRu || infraction.name_ru || ""),
|
||||
labelEn: String(infraction.labelEn || infraction.name_en || ""),
|
||||
defaultPreset: String(infraction.defaultPreset || ""),
|
||||
teamPenalty: Boolean(infraction.teamPenalty || infraction.team_penalty),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user