fix: clarify blocked source status

This commit is contained in:
ik
2026-09-21 07:37:32 +07:00
parent 3b4557b549
commit 2ed28266df
5 changed files with 19 additions and 6 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export type MediaAsset = { id: string; entity_type: "fish" | "waterbody" | "tack
export const spotPath = (item: Pick<Activity, "waterbody_slug" | "x" | "y">) => `/spots/${item.waterbody_slug}-${item.x}x${item.y}`;
export { activityLevel, ago, freshnessStatus, kg, plural } from "./presentation";
export { activityLevel, ago, freshnessStatus, kg, plural, sourceStatusLabel } from "./presentation";
const base = process.env.API_INTERNAL_URL || import.meta.env.API_INTERNAL_URL || "http://localhost:8000";
+8
View File
@@ -27,3 +27,11 @@ export function freshnessStatus(value: string | null | undefined, now = Date.now
if (!Number.isFinite(timestamp)) return "unknown";
return now - timestamp > 48 * 60 * 60 * 1000 ? "stale" : "fresh";
}
export function sourceStatusLabel(status: string) {
const labels: Record<string, string> = {
healthy: "Актуален", stale: "Данные устарели", temporarily_limited: "Источник временно ограничен",
source_changed: "Источник изменился", waiting: "Ожидает запуска", disabled: "Выключен",
};
return labels[status] ?? "Состояние не определено";
}