Piloten Badge gefixed

This commit is contained in:
PxlLoewe
2025-07-02 23:27:03 -07:00
parent 2e82475840
commit e137b0c75e
3 changed files with 29 additions and 17 deletions

View File

@@ -72,7 +72,9 @@ const FMSStatusHistory = ({
.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;
return lastBadge ? (
<Badge badge={lastBadge as BADGES} className="h-5 w-8" width={40} />
) : null;
})()}
</p>
<p
@@ -228,11 +230,7 @@ const FMSStatusSelector = ({
);
};
const RettungsmittelTab = ({
aircraft,
}: {
aircraft: ConnectedAircraft & { Station: Station };
}) => {
const StationTab = ({ aircraft }: { aircraft: ConnectedAircraft & { Station: Station } }) => {
const station = aircraft.Station;
const { data: livekitRooms } = useQuery({
queryKey: ["livekit-rooms"],
@@ -490,5 +488,5 @@ const SDSTab = ({
);
};
export { FMSStatusSelector, RettungsmittelTab, MissionTab, SDSTab };
export { FMSStatusSelector, StationTab as RettungsmittelTab, MissionTab, SDSTab };
export default FMSStatusHistory;

View File

@@ -44,10 +44,8 @@ import {
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
import { getStationsAPI } from "_querys/stations";
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
import { HPGValidationRequired } from "_helpers/hpgValidationRequired";
import { getOsmAddress } from "_querys/osm";
import { hpgStateToFMSStatus } from "_helpers/hpgStateToFmsStatus";
import { cn } from "@repo/shared-components";
import { StationsSelect } from "(app)/dispatch/_components/StationSelect";
const Einsatzdetails = ({
@@ -196,7 +194,7 @@ const Einsatzdetails = ({
<div>
<div className="divider mt-0 mb-0" />
{hpgNeedsAttention && (
{hpgNeedsAttention && mission.hpgValidationState !== "POSITION_AMANDED" && (
<div className="form-control mb-2 flex justify-between items-center">
<label className="flex items-center gap-2 cursor-pointer">
<input
@@ -205,8 +203,11 @@ const Einsatzdetails = ({
checked={ignoreHpg}
onChange={(e) => setIgnoreHpg(e.target.checked)}
/>
<span className="label-text font-semibold leading-6">
Ohne HPG-Mission alarmieren
<span
className="label-text font-semibold leading-6 tooltip"
data-tip="Die HPG-Alarmierung wird trotzdem ausgeführt. Die Position des HPG-Einsatzes kann gravierend von der Einsatzposition abweichen"
>
HPG-Fehler ignorieren
</span>
</label>
<button
@@ -466,12 +467,16 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
</div>
)}
</div>
<ul className="space-y-2 max-h-[300px] overflow-y-auto overflow-x-auto">
<ul className="space-y-2 h-[130px] overflow-y-auto overflow-x-auto flex-1">
{mission.missionStationIds.length === 0 && (
<p className="text-gray-500 w-full text-center my-10 font-semibold">
Keine Rettungsmittel zugewiesen
</p>
)}
{missionStations?.map((station, index) => {
const connectedAircraft = connectedAircrafts?.find(
(aircraft) => aircraft.stationId === station.id,
);
console.log("connectedAircraft", connectedAircraft);
return (
<li key={index} className="flex items-center gap-2">

View File

@@ -13,15 +13,24 @@ const badgeImageMapping = {
[BADGES.V1Veteran]: "v1-veteran.png",
};
export const Badge = ({ badge, className }: { badge: BADGES; className?: string }) => {
export const Badge = ({
badge,
className,
width = 80,
}: {
badge: BADGES;
className?: string;
width?: number;
}) => {
return (
<span className={cn("h-fit h-full p-1 flex justify-center items-center", className)}>
<img
src={`${process.env.NEXT_PUBLIC_HUB_URL}/badges/${badgeImageMapping[badge]}`}
alt="Badge"
width="80"
width={width}
height="auto"
className="block h-auto w-auto max-w-[80px]"
style={{ maxWidth: `${width}px` }}
className="block h-auto w-auto"
/>
</span>
);