From b0cadf66bf08a1e00d6f226f0187a1712e19d3dc Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 20 Feb 2025 15:18:14 -0800 Subject: [PATCH] add sharing feature --- .../Components/DistributedUptimeMap/index.jsx | 6 +- .../Details/Components/StatusHeader/index.jsx | 71 ++++++++++--------- .../DistributedUptimeStatus/Status/index.jsx | 9 ++- 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx b/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx index 940b59351..7617666eb 100644 --- a/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx +++ b/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx @@ -5,7 +5,6 @@ import { useTheme } from "@mui/material/styles"; import maplibregl from "maplibre-gl"; import { useSelector } from "react-redux"; import buildStyle from "./buildStyle"; -import { ColContainer } from "../../../../../Components/StandardContainer"; const DistributedUptimeMap = ({ width = "100%", checks }) => { const mapContainer = useRef(null); @@ -29,12 +28,17 @@ const DistributedUptimeMap = ({ width = "100%", checks }) => { useEffect(() => { if (mapContainer.current && !map.current) { const initialStyle = buildStyle(initialTheme.current, initialMode.current); + map.current = new maplibregl.Map({ container: mapContainer.current, style: initialStyle, center: [0, 20], zoom: 0.8, attributionControl: false, + canvasContextAttributes: { + antialias: true, + preserveDrawingBuffer: true, + }, }); } map.current.on("load", () => { diff --git a/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx b/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx index c5a861fca..0e9b9bd20 100644 --- a/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx +++ b/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx @@ -4,19 +4,17 @@ import { Stack, Typography } from "@mui/material"; import PulseDot from "../../../../../Components/Animated/PulseDot"; import LastUpdate from "../LastUpdate"; import ChatBot from "../Chatbot"; +import ShareComponent from "../../../../../Components/ShareComponent"; // Utils import { useTheme } from "@emotion/react"; import PropTypes from "prop-types"; -const StatusHeader = ({ monitor, connectionStatus }) => { - console.log(monitor); - +const StatusHeader = ({ monitor, connectionStatus, elementToCapture }) => { const theme = useTheme(); - const COLOR_MAP = { - up: theme.palette.distributedStatusHeader.up, - down: theme.palette.distributedStatusHeader.down, + up: theme.palette.successSecondary.main, + down: theme.palette.error.lowContrast, }; const MSG_MAP = { @@ -35,43 +33,48 @@ const StatusHeader = ({ monitor, connectionStatus }) => { - - - - + + + - {MSG_MAP[connectionStatus]} - + + {MSG_MAP[connectionStatus]} + + + Uptime: {(monitor.totalUptime * 100).toFixed(2)}% + + - Uptime: {(monitor.totalUptime * 100).toFixed(2)}% + Last updated{" "} + - - Last updated{" "} - - + diff --git a/src/Pages/DistributedUptimeStatus/Status/index.jsx b/src/Pages/DistributedUptimeStatus/Status/index.jsx index a714f6976..a1c6b473f 100644 --- a/src/Pages/DistributedUptimeStatus/Status/index.jsx +++ b/src/Pages/DistributedUptimeStatus/Status/index.jsx @@ -19,7 +19,7 @@ import StatusHeader from "../../DistributedUptime/Details/Components/StatusHeade //Utils import { useTheme } from "@mui/material/styles"; -import { useState } from "react"; +import { useState, useRef } from "react"; import { useParams } from "react-router-dom"; import { useSubscribeToDetails } from "../../DistributedUptime/Details/Hooks/useSubscribeToDetails"; import { useStatusPageFetchByUrl } from "./Hooks/useStatusPageFetchByUrl"; @@ -31,6 +31,7 @@ const DistributedUptimeStatus = () => { const location = useLocation(); const isPublic = location.pathname.startsWith("/status/distributed/public"); + const elementToCapture = useRef(null); // Local State const [dateRange, setDateRange] = useState("day"); const [isDeleteOpen, setIsDeleteOpen] = useState(false); @@ -135,9 +136,12 @@ const DistributedUptimeStatus = () => { return ( {!isPublic && } {