Files
nodeMap/components/gisPolylines/tooltip/generateLineTooltipContent.js
ISA 016e1a927d refactor: Tooltip-Generierung für Linien ausgelagert und Anzeige von Stationsnamen (LD_Name) hinzugefügt
- `generateLineTooltipContent` in eigene Datei extrahiert
- `useLineData` angepasst, um Stationen aus `gisStationsStaticDistrict` zu übergeben
- Anzeige der Station im Tooltip nun über `LD_Name` statt `matchingLine.name`
- Bugfix: "Station: N/A" wird nun korrekt angezeigt
2025-06-25 08:43:26 +02:00

41 lines
1.5 KiB
JavaScript

// /components/gisPolylines/tooltip/generateLineTooltipContent.js
// KEIN useSelector hier!
export function generateLineTooltipContent(statis, matchingLine, values, stations) {
const station = stations.find(s => s.IdLD === statis.IdLD);
const stationName = station?.LD_Name || "N/A";
const messageDisplay = values.messages
.map(
msg =>
`<span class="inline-block text-gray-800">
<span class="inline-block w-2 h-2 rounded-full mr-2" style="background-color: ${msg.prioColor};"></span>
${msg.message}
</span><br>`
)
.join("");
return `
<div class="bg-white rounded-lg m-0 p-2 w-[210px]">
<span class="text-lg font-semibold text-gray-900">${statis.ModulName || "Unknown"}</span><br>
<span class="text-md font-bold text-gray-800">${statis.ModulTyp || "N/A"}</span><br>
<span class="text-md font-bold text-gray-800">Slot: ${statis.Modul || "N/A"}</span><br>
<span class="text-md font-bold text-gray-800">Station: ${stationName}</span>
<br>
<div style="max-width: 100%; overflow-wrap: break-word; word-break: break-word; white-space: normal;">
${messageDisplay}
</div>
<br>
${
values.messwert
? `<span class="inline-block text-gray-800">Messwert: ${values.messwert}</span><br>`
: ""
}
${
values.schleifenwert
? `<span class="inline-block text-gray-800">Schleifenwert: ${values.schleifenwert}</span>`
: ""
}
</div>
`;
}