diff --git a/src/components/Map.tsx b/src/components/Map.tsx index f31ee0a..30c4234 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -7,6 +7,7 @@ import mapData from '../assets/data/map-data.json' interface Props { style?: CSSProperties + error?: boolean } interface MapRecord { @@ -47,22 +48,27 @@ function addPins(map: DottedMap, pins: MapRecord[], color: string) { } const mapPrecomputed = new DottedMap({ map: JSON.parse(mapData) }) +const mapNoPins = new DottedMap({ map: JSON.parse(mapData) }) addPins(mapPrecomputed, deduplicatedRecords, '#303030') const mapSvgOptions: DottedMapWithoutCountriesLib.SvgSettings = { shape: 'hexagon', radius: 0.21, color: '#dadada' } -export default function Card({ style }: Props): ReactElement { +export default function Card({ style, error }: Props): ReactElement { const { peers } = useContext(Context) const [map, setMap] = useState(mapPrecomputed.getSVG(mapSvgOptions)) useEffect(() => { + // Display error map + if (error) setMap(mapNoPins.getSVG({ ...mapSvgOptions, color: '#eaeaea' })) + + // Display just the base map without any connections if (!peers) return const points = findIntersection(fullMapDb, peers) const mapNew = Object.create(mapPrecomputed) addPins(mapNew, points, '#09CA6C') setMap(mapNew.getSVG(mapSvgOptions)) - }, [peers]) + }, [peers, error]) return (
+ {error && ( + + + + + + )}
) } diff --git a/src/pages/info/index.tsx b/src/pages/info/index.tsx index 3cebb63..c07f620 100644 --- a/src/pages/info/index.tsx +++ b/src/pages/info/index.tsx @@ -25,7 +25,7 @@ export default function Status(): ReactElement { return (
- {status.all ? ( + {status.all === 'OK' ? ( navigate(ROUTES.DOWNLOAD) }} icon={} @@ -105,7 +105,7 @@ export default function Status(): ReactElement { )}
- +