- `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
41 lines
1.5 KiB
JavaScript
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>
|
|
`;
|
|
}
|