From a0612d74b172ebcfe734c47e598a5ac35ff1fa1c Mon Sep 17 00:00:00 2001 From: Shivam Patel Date: Mon, 9 Feb 2026 02:46:41 -0500 Subject: [PATCH] Fix country detail panel clipped by overflow-hidden ancestors The dropdown was rendering inside the overflow-x-auto scroll container, which forces overflow-y to clip too, making it invisible. Lifted the detail panel above the scroll row as a separate component, with selected state managed by GlobeCard so only one expands at a time. Co-Authored-By: Claude Opus 4.6 --- components/widgets/GlobeCard.tsx | 74 ++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/components/widgets/GlobeCard.tsx b/components/widgets/GlobeCard.tsx index c27fa1f..3eefcb4 100644 --- a/components/widgets/GlobeCard.tsx +++ b/components/widgets/GlobeCard.tsx @@ -18,37 +18,45 @@ function countryCodeToFlag(code: string): string { return [...code.toUpperCase()].map(c => String.fromCodePoint(0x1f1e6 + c.charCodeAt(0) - 65)).join(''); } -function CountryChip({ country }: { country: CountryData }) { - const [expanded, setExpanded] = useState(false); - +function CountryChip({ country, isSelected, onSelect }: { country: CountryData; isSelected: boolean; onSelect: (code: string | null) => void }) { return ( -
- - {expanded && ( -
- {country.regions.map((r) => ( -
-
- {r.region} - {r.count} -
- {r.cities.map((c) => ( -
- {c.city} - {c.count} -
- ))} + + ); +} + +function CountryDetail({ country }: { country: CountryData }) { + return ( +
+
+ {countryCodeToFlag(country.code)} + {country.code} + {country.count} hits +
+ {country.regions.map((r) => ( +
+
+ {r.region} + {r.count} +
+ {r.cities.map((c) => ( +
+ {c.city} + {c.count}
))}
- )} + ))}
); } @@ -72,6 +80,7 @@ export function GlobeCard() { countries: [], }); const [grabbing, setGrabbing] = useState(false); + const [selectedCountry, setSelectedCountry] = useState(null); useEffect(() => { async function fetchVisitors() { @@ -190,9 +199,18 @@ export function GlobeCard() { {visitorStats.countries.length > 0 && (
+ {selectedCountry && (() => { + const country = visitorStats.countries.find(c => c.code === selectedCountry); + return country ? : null; + })()}
{visitorStats.countries.map((country) => ( - + ))}