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) .filter((b) => b.startsWith("P") && b.length == 2)
.sort((a, b) => a.localeCompare(b)); .sort((a, b) => a.localeCompare(b));
const lastBadge = badges[badges.length - 1]; 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>
<p <p
@@ -228,11 +230,7 @@ const FMSStatusSelector = ({
); );
}; };
const RettungsmittelTab = ({ const StationTab = ({ aircraft }: { aircraft: ConnectedAircraft & { Station: Station } }) => {
aircraft,
}: {
aircraft: ConnectedAircraft & { Station: Station };
}) => {
const station = aircraft.Station; const station = aircraft.Station;
const { data: livekitRooms } = useQuery({ const { data: livekitRooms } = useQuery({
queryKey: ["livekit-rooms"], queryKey: ["livekit-rooms"],
@@ -490,5 +488,5 @@ const SDSTab = ({
); );
}; };
export { FMSStatusSelector, RettungsmittelTab, MissionTab, SDSTab }; export { FMSStatusSelector, StationTab as RettungsmittelTab, MissionTab, SDSTab };
export default FMSStatusHistory; export default FMSStatusHistory;

View File

@@ -44,10 +44,8 @@ import {
import { getConnectedAircraftsAPI } from "_querys/aircrafts"; import { getConnectedAircraftsAPI } from "_querys/aircrafts";
import { getStationsAPI } from "_querys/stations"; import { getStationsAPI } from "_querys/stations";
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore"; import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
import { HPGValidationRequired } from "_helpers/hpgValidationRequired";
import { getOsmAddress } from "_querys/osm"; import { getOsmAddress } from "_querys/osm";
import { hpgStateToFMSStatus } from "_helpers/hpgStateToFmsStatus"; import { hpgStateToFMSStatus } from "_helpers/hpgStateToFmsStatus";
import { cn } from "@repo/shared-components";
import { StationsSelect } from "(app)/dispatch/_components/StationSelect"; import { StationsSelect } from "(app)/dispatch/_components/StationSelect";
const Einsatzdetails = ({ const Einsatzdetails = ({
@@ -196,7 +194,7 @@ const Einsatzdetails = ({
<div> <div>
<div className="divider mt-0 mb-0" /> <div className="divider mt-0 mb-0" />
{hpgNeedsAttention && ( {hpgNeedsAttention && mission.hpgValidationState !== "POSITION_AMANDED" && (
<div className="form-control mb-2 flex justify-between items-center"> <div className="form-control mb-2 flex justify-between items-center">
<label className="flex items-center gap-2 cursor-pointer"> <label className="flex items-center gap-2 cursor-pointer">
<input <input
@@ -205,8 +203,11 @@ const Einsatzdetails = ({
checked={ignoreHpg} checked={ignoreHpg}
onChange={(e) => setIgnoreHpg(e.target.checked)} onChange={(e) => setIgnoreHpg(e.target.checked)}
/> />
<span className="label-text font-semibold leading-6"> <span
Ohne HPG-Mission alarmieren 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> </span>
</label> </label>
<button <button
@@ -466,12 +467,16 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
</div> </div>
)} )}
</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) => { {missionStations?.map((station, index) => {
const connectedAircraft = connectedAircrafts?.find( const connectedAircraft = connectedAircrafts?.find(
(aircraft) => aircraft.stationId === station.id, (aircraft) => aircraft.stationId === station.id,
); );
console.log("connectedAircraft", connectedAircraft);
return ( return (
<li key={index} className="flex items-center gap-2"> <li key={index} className="flex items-center gap-2">

View File

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