Skip to content

Commit a20d5cf

Browse files
committed
add daylight in tooltip
1 parent 74dc15e commit a20d5cf

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

scripts/generate_satellite_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def is_daytime(lat_degrees, lon_degrees, observation_time):
169169

170170
# Calculate solar position relative to the location
171171
astrometric = location.at(t).observe(sun)
172-
alt = astrometric.apparent().altaz()
172+
alt, az, distance = astrometric.apparent().altaz()
173173

174174
# Return True if sun is above horizon (elevation > 0°)
175175
return alt.degrees > 0

src/components/SatellitePopup.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Popup } from "react-map-gl/maplibre";
2+
import { Sun, Moon } from "lucide-react";
3+
import { Badge } from "@/components/ui/badge";
24

35
interface ClickedFeature {
46
lngLat: { lng: number; lat: number };
@@ -11,6 +13,7 @@ interface ClickedFeature {
1113
tasking: boolean;
1214
start_time: string;
1315
end_time: string;
16+
is_daytime?: boolean;
1417
}
1518

1619
interface SatellitePopupProps {
@@ -40,6 +43,20 @@ export const SatellitePopup = ({ clickedFeature, onClose }: SatellitePopupProps)
4043
<p>Tasking: {clickedFeature.tasking ? "Yes" : "No"}</p>
4144
<p>Start Time: {clickedFeature.start_time}</p>
4245
<p>End Time: {clickedFeature.end_time}</p>
46+
<div className="flex items-center gap-1 mt-1">
47+
<span>Daylight:</span>
48+
{clickedFeature.is_daytime !== undefined ? (
49+
<Badge
50+
variant={clickedFeature.is_daytime ? "soft-yellow" : "soft-purple"}
51+
className="flex items-center gap-1"
52+
>
53+
{clickedFeature.is_daytime ? <Sun size={12} /> : <Moon size={12} />}
54+
{clickedFeature.is_daytime ? "Day" : "Night"}
55+
</Badge>
56+
) : (
57+
<Badge variant="outline">N/A</Badge>
58+
)}
59+
</div>
4360
</div>
4461
</Popup>
4562
);

0 commit comments

Comments
 (0)