feat(dashboard): enlarge pulsing red Agent Server marker and add detailed color legend inside GlobeMap

This commit is contained in:
ypratama committed 2026-11-09 16:22:21 +07:00
1 parent 7e65eba01f
commit 6f50522173
1 file changed
+65 -21
+65 -21
View File
@@ -21,6 +21,8 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
}
const { arcsData, pointsData, labelsData } = useGlobeData(data, isLight);
const destPoints = pointsData.filter((pt: any) => !pt.isOrigin);
const originPoints = pointsData.filter((pt: any) => pt.isOrigin);
const mapBorderColor = isLight ? "#ffffff" : "#0ea5e9";
const mapFillColor = isLight ? "#4ade80" : "#0f172a";
@@ -34,9 +36,28 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
stroke-dashoffset: -100;
}
}
@keyframes pulseOriginRing {
0% {
transform: scale(0.8);
opacity: 0.9;
}
70% {
transform: scale(2.2);
opacity: 0;
}
100% {
transform: scale(2.2);
opacity: 0;
}
}
.globe-animated-line {
animation: flowDashGlobe 1.5s linear infinite;
}
.globe-origin-pulse {
animation: pulseOriginRing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
transform-origin: center;
transform-box: fill-box;
}
`}</style>
<ComposableMap
projection="geoMercator"
@@ -82,7 +103,7 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
if (isLocal) {
return (
<Marker key={`arc-${i}`} coordinates={[arc.startLng, arc.startLat]}>
<circle r={8} fill="none" stroke={color} strokeWidth={1.5} opacity={0.6} strokeDasharray="2,2" />
<circle r={9} fill="none" stroke={color} strokeWidth={1.5} opacity={0.7} strokeDasharray="2,2" />
</Marker>
);
}
@@ -107,9 +128,9 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
key={`arc-${i}`}
coordinates={coordinates}
stroke={color}
strokeWidth={1.5}
strokeWidth={1.6}
strokeLinecap="round"
strokeOpacity={0.9}
strokeOpacity={0.92}
strokeDasharray="2 4 4 4 8 78"
className="globe-animated-line"
style={{ pointerEvents: 'none' }}
@@ -117,9 +138,20 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
);
})}
{pointsData.map((pt: any, i: number) => (
<Marker key={`marker-${i}`} coordinates={[pt.lng, pt.lat]}>
<circle r={pt.size * 2} fill={pt.color} opacity={0.8} />
{/* External Country Destination Markers */}
{destPoints.map((pt: any, i: number) => (
<Marker key={`dest-marker-${i}`} coordinates={[pt.lng, pt.lat]}>
<circle r={6} fill={pt.color} opacity={0.22} />
<circle r={3.2} fill={pt.color} stroke="#0f172a" strokeWidth={0.8} opacity={0.95} />
</Marker>
))}
{/* Agent Server Origin Markers (Rendered on top with large pulsing red beacon) */}
{originPoints.map((pt: any, i: number) => (
<Marker key={`origin-marker-${i}`} coordinates={[pt.lng, pt.lat]}>
<circle r={11} fill="#f43f5e" opacity={0.35} className="globe-origin-pulse" />
<circle r={8} fill="#f43f5e" opacity={0.25} />
<circle r={5.2} fill="#f43f5e" stroke="#ffffff" strokeWidth={1.5} />
</Marker>
))}
@@ -127,7 +159,7 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
<Marker key={`label-${i}`} coordinates={[lbl.lng, lbl.lat]}>
<text
textAnchor="middle"
y={-10}
y={-12}
style={{
fontFamily: "system-ui",
fill: lbl.color,
@@ -143,20 +175,32 @@ export const GlobeMap = ({ data }: GlobeMapProps) => {
</ZoomableGroup>
</ComposableMap>
{/* Direction & Node Legend Overlay */}
<div className="absolute bottom-3 left-3 z-10 flex flex-wrap items-center gap-3 rounded-lg border border-white/10 bg-slate-950/80 px-3 py-1.5 text-[10px] text-slate-300 backdrop-blur-md">
<span className="flex items-center gap-1.5">
<span className="inline-block h-2 w-2 rounded-full bg-rose-500" />
<span>Agent Server</span>
</span>
<span className="flex items-center gap-1.5">
<span className="inline-block h-0.5 w-4 rounded bg-sky-400" />
<span>Outbound (Agent → Luar)</span>
</span>
<span className="flex items-center gap-1.5">
<span className="inline-block h-0.5 w-4 rounded bg-emerald-400" />
<span>Inbound (Luar → Agent)</span>
</span>
{/* Keterangan / Noted Warna & Cara Baca Peta */}
<div className="absolute bottom-3 left-3 right-3 sm:right-auto z-20 rounded-xl border border-white/15 bg-slate-950/90 px-3.5 py-2.5 text-[11px] text-slate-200 shadow-xl backdrop-blur-md">
<div className="mb-1.5 text-[10px] font-bold uppercase tracking-wider text-slate-400">
Keterangan Peta &amp; Warna (Cara Baca):
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-5 gap-y-1.5">
<div className="flex items-center gap-2">
<span className="relative flex h-3 w-3 shrink-0 items-center justify-center">
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-rose-400 opacity-75" />
<span className="relative inline-flex h-2.5 w-2.5 rounded-full border border-white bg-rose-500" />
</span>
<span><strong className="text-rose-400">Titik Merah:</strong> Lokasi Server Agent</span>
</div>
<div className="flex items-center gap-2">
<span className="inline-block h-2.5 w-2.5 shrink-0 rounded-full border border-slate-900 bg-sky-400" />
<span><strong className="text-sky-400">Titik Biru:</strong> Negara Tujuan / Luar</span>
</div>
<div className="flex items-center gap-2">
<span className="inline-block h-1 w-5 shrink-0 rounded-full bg-sky-400 shadow-[0_0_6px_#38bdf8]" />
<span><strong className="text-sky-400">Garis Biru (→):</strong> Upload (Agent ke Luar)</span>
</div>
<div className="flex items-center gap-2">
<span className="inline-block h-1 w-5 shrink-0 rounded-full bg-emerald-400 shadow-[0_0_6px_#34d399]" />
<span><strong className="text-emerald-400">Garis Hijau (←):</strong> Download (Luar ke Agent)</span>
</div>
</div>
</div>
</div>
);