feat: Add description for stations in sightbar
This commit is contained in:
@@ -139,6 +139,7 @@ interface ApiRoute {
|
|||||||
interface ApiStation {
|
interface ApiStation {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
description?: string;
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
city_id: number;
|
city_id: number;
|
||||||
@@ -2375,6 +2376,7 @@ const MapSightbar: React.FC<MapSightbarProps> = observer(
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
name: station.name,
|
name: station.name,
|
||||||
|
description: station.description || "",
|
||||||
});
|
});
|
||||||
feature.setId(`station-${station.id}`);
|
feature.setId(`station-${station.id}`);
|
||||||
feature.set("featureType", "station");
|
feature.set("featureType", "station");
|
||||||
@@ -2813,11 +2815,19 @@ const MapSightbar: React.FC<MapSightbarProps> = observer(
|
|||||||
numericRouteId !== null &&
|
numericRouteId !== null &&
|
||||||
mapStore.hiddenRoutes.has(numericRouteId);
|
mapStore.hiddenRoutes.has(numericRouteId);
|
||||||
|
|
||||||
|
const description = feature.get("description") as
|
||||||
|
| string
|
||||||
|
| undefined;
|
||||||
|
const showDescription =
|
||||||
|
featureType === "station" &&
|
||||||
|
description &&
|
||||||
|
description.trim() !== "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={String(fId)}
|
key={String(fId)}
|
||||||
data-feature-id={fId}
|
data-feature-id={fId}
|
||||||
className={`flex items-start p-2 rounded-md group transition-colors duration-150 ${
|
className={`flex items-start p-2 rounded-md group transition-colors duration-150 relative ${
|
||||||
isSelected
|
isSelected
|
||||||
? "bg-orange-100 border border-orange-300"
|
? "bg-orange-100 border border-orange-300"
|
||||||
: "hover:bg-blue-50"
|
: "hover:bg-blue-50"
|
||||||
@@ -2860,6 +2870,11 @@ const MapSightbar: React.FC<MapSightbarProps> = observer(
|
|||||||
{fName}
|
{fName}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{showDescription && (
|
||||||
|
<div className="mt-1 text-xs text-gray-600 line-clamp-2">
|
||||||
|
{description}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-shrink-0 flex items-center space-x-1 opacity-60 group-hover:opacity-100">
|
<div className="flex-shrink-0 flex items-center space-x-1 opacity-60 group-hover:opacity-100">
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user