getNextHourTime zu shared library hinzugefügt
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
"use client";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { Badge, cn } from "@repo/shared-components";
|
||||
import {
|
||||
BADGES,
|
||||
ConnectedAircraft,
|
||||
getPublicUser,
|
||||
Mission,
|
||||
@@ -16,7 +18,6 @@ import { toast } from "react-hot-toast";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { editConnectedAircraftAPI } from "_querys/aircrafts";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
import { cn } from "@repo/shared-components";
|
||||
import { PersonIcon } from "@radix-ui/react-icons";
|
||||
import {
|
||||
Ban,
|
||||
@@ -42,6 +43,8 @@ import { useSession } from "next-auth/react";
|
||||
import { sendSdsMessageAPI } from "_querys/missions";
|
||||
import { getLivekitRooms } from "_querys/livekit";
|
||||
import { findLeitstelleForPosition } from "_helpers/findLeitstelleinPoint";
|
||||
import { formatDistance } from "date-fns";
|
||||
import { de } from "date-fns/locale";
|
||||
|
||||
const FMSStatusHistory = ({
|
||||
aircraft,
|
||||
@@ -63,9 +66,22 @@ const FMSStatusHistory = ({
|
||||
<ul className="text-base-content font-semibold">
|
||||
<li className="flex items-center gap-2 mb-1">
|
||||
<p className="flex items-center gap-2 flex-1">
|
||||
<PersonIcon className="w-5 h-5" /> {aircraftUser.fullName} ({aircraftUser.publicId})
|
||||
<PersonIcon className="w-5 h-5" /> {aircraftUser.fullName} ({aircraftUser.publicId}){" "}
|
||||
{(() => {
|
||||
const badges = aircraftUser.badges
|
||||
.filter((b) => b.startsWith("P") && b.length == 2)
|
||||
.sort((a, b) => a.localeCompare(b));
|
||||
const lastBadge = badges[badges.length - 1];
|
||||
return lastBadge ? <Badge badge={lastBadge as BADGES} className="h-8 w-12" /> : null;
|
||||
})()}
|
||||
</p>
|
||||
<p className="text-sm font-thin text-gray-500">
|
||||
<p
|
||||
className={cn(
|
||||
"text-sm font-thin text-gray-500",
|
||||
aircraft.esimatedLogoutTime && "tooltip tooltip-left",
|
||||
)}
|
||||
data-tip={`in ${aircraft.esimatedLogoutTime && formatDistance(new Date(aircraft.esimatedLogoutTime), new Date(), { locale: de })}`}
|
||||
>
|
||||
{aircraft.esimatedLogoutTime
|
||||
? `Geplante Abmeldung: ${new Date(aircraft.esimatedLogoutTime).toLocaleTimeString(
|
||||
[],
|
||||
|
||||
Reference in New Issue
Block a user