From 6adec62b5fa173a729fd5e8a8cad8a1ddec9ab4a Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Wed, 4 Mar 2026 11:16:07 +0300 Subject: [PATCH] feat: enhance CurrentDutyView with loading skeletons and improved localization - Added Skeleton components to CurrentDutyView for better loading state representation. - Updated localization messages to include new labels for remaining time display. - Refactored remaining time display logic for clarity and improved user experience. --- .../current-duty/CurrentDutyView.tsx | 70 +++++++++++++------ webapp-next/src/i18n/messages.ts | 4 ++ webapp-next/src/lib/current-duty.test.ts | 2 +- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/webapp-next/src/components/current-duty/CurrentDutyView.tsx b/webapp-next/src/components/current-duty/CurrentDutyView.tsx index d8c8117..f043eb6 100644 --- a/webapp-next/src/components/current-duty/CurrentDutyView.tsx +++ b/webapp-next/src/components/current-duty/CurrentDutyView.tsx @@ -29,6 +29,7 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; +import { Skeleton } from "@/components/ui/skeleton"; import type { DutyWithUser } from "@/types"; export interface CurrentDutyViewProps { @@ -164,14 +165,33 @@ export function CurrentDutyView({ onBack, openedFromPin = false }: CurrentDutyVi aria-live="polite" aria-label={t("loading")} > - -

{t("loading")}

- + + +
+ + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
); } @@ -244,11 +264,10 @@ export function CurrentDutyView({ onBack, openedFromPin = false }: CurrentDutyVi const endTime = formatHHMM(duty.end_at); const shiftStr = `${startDDMM} ${startTime} — ${endDDMM} ${endTime}`; const rem = remaining ?? getRemainingTime(duty.end_at); - const remainingStr = t("current_duty.remaining", { + const remainingValueStr = t("current_duty.remaining_value", { hours: String(rem.hours), minutes: String(rem.minutes), }); - const endsAtStr = t("current_duty.ends_at", { time: endTime }); const displayTz = typeof window !== "undefined" && @@ -280,21 +299,31 @@ export function CurrentDutyView({ onBack, openedFromPin = false }: CurrentDutyVi {t("current_duty.title")} - -

- {duty.full_name} -

-

- {shiftLabel} {shiftStr} -

+ +
+

+ {duty.full_name} +

+

+ {shiftLabel} {shiftStr} +

+
- {remainingStr} + + {t("current_duty.remaining_label")} + + + {remainingValueStr} +
-

{endsAtStr}

+
{hasContacts ? ( )} +