Add "Уточняется" fallback helper + orange styling per TZ 4.1.23

This commit is contained in:
2026-04-21 23:49:10 +03:00
parent df83a587c2
commit b43c341fcb
12 changed files with 79 additions and 0 deletions
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "Aktuell",
"ACTUAL-TIME": "Tatsächliche Zeit",
"TBD": "Wird geklärt",
"AIRPORT_CHANGE": "Wechsel des Flughafens",
"ALL_DAY": "Ganztägig",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -299,6 +299,7 @@
"SHARED": {
"ACTUAL": "Actual",
"ACTUAL-TIME": "Actual Time",
"TBD": "Pending",
"AIRPORT_CHANGE": "Different airports",
"ALL_DAY": "All day",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "Real",
"ACTUAL-TIME": "Hora real",
"TBD": "Por especificar",
"AIRPORT_CHANGE": "Aeropuertos diferentes",
"ALL_DAY": "Todo el día",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "Réelle",
"ACTUAL-TIME": "Heure réelle",
"TBD": "À clarifier",
"AIRPORT_CHANGE": "Aéroports différents",
"ALL_DAY": "Toute la journée",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "Effettivo",
"ACTUAL-TIME": "Ora effettiva",
"TBD": "Da chiarire",
"AIRPORT_CHANGE": "Aeroporti diversi",
"ALL_DAY": "Tutto il giorno",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "実際",
"ACTUAL-TIME": "実際の時間",
"TBD": "確認中",
"AIRPORT_CHANGE": "別の空港",
"ALL_DAY": "終日",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "실제",
"ACTUAL-TIME": "실제 시간",
"TBD": "확인 중",
"AIRPORT_CHANGE": "다른 공항",
"ALL_DAY": "전체",
"ALL_DIRECTIONS": "All directions",
+1
View File
@@ -299,6 +299,7 @@
"SHARED": {
"ACTUAL": "Фактическое",
"ACTUAL-TIME": "Фактическое время",
"TBD": "Уточняется",
"AIRPORT_CHANGE": "Смена аэропорта",
"ALL_DAY": "Весь день",
"ALL_DIRECTIONS": "Все направления",
+1
View File
@@ -260,6 +260,7 @@
"SHARED": {
"ACTUAL": "实际",
"ACTUAL-TIME": "实际时间",
"TBD": "待确定",
"AIRPORT_CHANGE": "不同机场",
"ALL_DAY": "全天",
"ALL_DIRECTIONS": "All directions",
+39
View File
@@ -0,0 +1,39 @@
import { describe, expect, it } from "vitest";
import { tbdOr } from "./tbd.js";
describe("4.1.23-R: tbdOr fallback", () => {
const t = (k: string) => (k === "SHARED.TBD" ? "Уточняется" : k);
it("returns TBD string for null", () => {
expect(tbdOr(null, t)).toBe("Уточняется");
});
it("returns TBD string for undefined", () => {
expect(tbdOr(undefined, t)).toBe("Уточняется");
});
it("returns TBD string for empty string", () => {
expect(tbdOr("", t)).toBe("Уточняется");
});
it("returns TBD string for whitespace-only string", () => {
expect(tbdOr(" ", t)).toBe("Уточняется");
});
it("returns the value when non-empty string", () => {
expect(tbdOr("A320", t)).toBe("A320");
});
it("returns numeric value as-is", () => {
expect(tbdOr(42, t)).toBe(42);
});
it("returns non-string non-number values as-is", () => {
const obj = { code: "MOW" };
expect(tbdOr(obj, t)).toBe(obj);
});
it("returns 0 as-is (not treated as missing)", () => {
expect(tbdOr(0, t)).toBe(0);
});
});
+26
View File
@@ -0,0 +1,26 @@
/**
* "Уточняется" fallback per TZ §4.1.23.
*
* When a field is null / undefined / empty string / whitespace, returns
* the localized "Уточняется" label. Otherwise returns the value as-is.
*
* NOTE: Only apply to fields TZ explicitly enumerates for this fallback
* (gate, terminal, aircraft type, bag belt, dispatch type, etc.). Don't
* use as a blanket fallback for all nullable fields — Angular reference
* uses dashes/absent rendering for fields not listed in §4.1.23.
*
* Styling: callers are responsible for applying the orange color class
* (`.tbd-text` or equivalent) when rendering the fallback string.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type TFunction = (key: string, opts?: any) => string;
export function tbdOr<T>(
value: T | null | undefined,
t: TFunction,
): T | string {
if (value === null || value === undefined) return t("SHARED.TBD");
if (typeof value === "string" && value.trim() === "") return t("SHARED.TBD");
return value;
}
+5
View File
@@ -45,3 +45,8 @@
.wrapper-header {
z-index: 1002;
}
// TZ §4.1.23: "Уточняется" fallback label styling (orange color)
.tbd-text {
color: $orange;
}