remove unsued strings, initial commit

This commit is contained in:
Alex Holliday
2026-01-26 21:14:04 +00:00
parent 1cffd51bd3
commit b61077bd3f
6 changed files with 168 additions and 41 deletions
@@ -0,0 +1,159 @@
import { BaseChart } from "@/Components/v2/design-elements";
import { FileText } from "lucide-react";
import { Pie, PieChart, ResponsiveContainer, Label } from "recharts";
import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
import { getPageSpeedPalette } from "@/Utils/MonitorUtils";
import { useTheme } from "@mui/material/styles";
import { alpha } from "@mui/material/styles";
import { useState } from "react";
import Tooltip from "@mui/material/Tooltip";
import { useTranslation } from "react-i18next";
const CenterLabel = ({ viewBox, value }: any) => {
const { cx, cy } = viewBox;
return (
<foreignObject
x={cx - 25}
y={cy - 10}
width={50}
height={50}
>
<Typography
variant="h1"
align="center"
>
{value}
</Typography>
</foreignObject>
);
};
export const PiePageSpeed = ({ latestCheck }: { latestCheck: any }) => {
const { t } = useTranslation();
const theme = useTheme();
const [hoverTitle, setHoverTitle] = useState<string | null>(null);
const LABELS: Record<string, string> = {
FCP: t("common.charts.pageSpeed.fcp"),
SI: t("common.charts.pageSpeed.si"),
LCP: t("common.charts.pageSpeed.lcp"),
TBT: t("common.charts.pageSpeed.tbt"),
CLS: t("common.charts.pageSpeed.cls"),
};
const metrics = [
{ key: "fcp", color: alpha("#1DE9B6", 0.6), weight: 0.1 },
{ key: "si", color: alpha("#7C4DFF", 0.6), weight: 0.1 },
{ key: "lcp", color: alpha("#FFB200", 0.6), weight: 0.25 },
{ key: "tbt", color: alpha("#00AFFE", 0.6), weight: 0.3 },
{ key: "cls", color: alpha("#FF4181", 0.6), weight: 0.25 },
];
const scores = metrics.flatMap(({ key, color, weight }) => {
const val = Math.floor((latestCheck?.[key] ?? 0) * 100);
const inverse = 100 - val;
return [
{
name: `${key.toUpperCase()} Inverse`,
value: inverse * weight,
fill: "transparent",
stroke: color,
weight,
},
{
name: key.toUpperCase(),
value: val * weight,
fill: color,
stroke: color,
weight,
},
];
});
const totalScore =
(latestCheck?.fcp || 0) * 0.1 +
(latestCheck?.si || 0) * 0.1 +
(latestCheck?.lcp || 0) * 0.25 +
(latestCheck?.tbt || 0) * 0.3 +
(latestCheck?.cls || 0) * 0.25;
const pageSpeedPalette = getPageSpeedPalette(Math.floor(totalScore * 100));
const score = [
{
value: 100,
fill: alpha(theme.palette[pageSpeedPalette].light || "#ffffff", 0.6),
stroke: "none",
},
];
return (
<BaseChart
icon={
<FileText
size={20}
strokeWidth={1.5}
/>
}
title={t("common.charts.pageSpeed.title")}
>
<Tooltip
open={Boolean(hoverTitle)}
title={hoverTitle || ""}
arrow
followCursor
placement="top"
>
<Box
sx={{
"& .recharts-wrapper:focus, & .recharts-surface:focus": {
outline: "none",
},
"& .recharts-wrapper *:focus": { outline: "none" },
"& svg:focus, & g:focus, & path:focus": { outline: "none" },
position: "relative",
}}
>
<ResponsiveContainer
width="100%"
height={250}
>
<PieChart>
<Pie
data={score}
dataKey="value"
cx="50%"
cy="50%"
outerRadius="65%"
>
<Label
position={"center"}
content={<CenterLabel value={Math.floor(totalScore * 100)} />}
/>
</Pie>
<Pie
data={scores}
innerRadius="70%"
outerRadius="80%"
label={({ name, value }) => `${name}: ${Math.round(value)}`}
dataKey="value"
stroke="none"
onMouseEnter={(_, index: number) => {
const d = scores[index];
if (!d) return;
const isInverse = String(d.name).includes("Inverse");
const pair = isInverse && scores[index + 1] ? scores[index + 1] : d;
const base = String(pair.name).replace(" Inverse", "");
const full = LABELS[base] ?? base;
const displayVal = Math.round(Number(pair.value) || 0);
setHoverTitle(`${full}: ${displayVal}`);
}}
onMouseLeave={() => setHoverTitle(null)}
/>
</PieChart>
</ResponsiveContainer>
</Box>
</Tooltip>
</BaseChart>
);
};
@@ -5,3 +5,4 @@ export * from "./charts/RadialAvgResponse";
export * from "./charts/HistogramDetails";
export * from "./charts/HistogramPageSpeed";
export * from "./charts/HistogramPageSpeedTooltip";
export * from "./charts/PiePagespeed";
@@ -0,0 +1,7 @@
import { BasePage } from "@/Components/v2/design-elements";
const PageSpeedDetails = () => {
return <BasePage>PageSpeed Details - Work in Progress</BasePage>;
};
export default PageSpeedDetails;
+1 -1
View File
@@ -21,7 +21,7 @@ import UptimeCreate from "../Pages/Uptime/Create/index.jsx";
// PageSpeed
import PageSpeed from "../Pages/PageSpeed/Monitors/index";
import PageSpeedDetails from "../Pages/PageSpeed/Details/index.jsx";
import PageSpeedDetails from "../Pages/PageSpeed/Details/";
import PageSpeedCreate from "../Pages/PageSpeed/Create/index.jsx";
// Infrastructure
-40
View File
@@ -53,8 +53,6 @@
},
"submit": "Submit",
"title": "Title",
"distributedStatusHeaderText": "Real-time, real-device coverage",
"distributedStatusSubHeaderText": "Powered by millions devices worldwide, view a system performance by global region, country or city",
"settingsDisabled": "Disabled",
"settingsSuccessSaved": "Settings saved successfully",
"settingsFailedToSave": "Failed to save settings",
@@ -90,18 +88,11 @@
"webhookSendSuccess": "Webhook notification sent successfully",
"webhookSendError": "Error sending webhook notification to {platform}",
"webhookUnsupportedPlatform": "Unsupported platform: {platform}",
"distributedRightCategoryTitle": "Monitor",
"distributedStatusServerMonitors": "Server Monitors",
"distributedStatusServerMonitorsDescription": "Monitor status of related servers",
"distributedUptimeCreateSelectURL": "Here you can select the URL of the host, together with the type of monitor.",
"distributedUptimeCreateChecks": "Checks to perform",
"distributedUptimeCreateChecksDescription": "You can always add or remove checks after adding your site.",
"distributedUptimeCreateIncidentNotification": "Incident notifications",
"distributedUptimeCreateIncidentDescription": "When there is an incident, notify users.",
"distributedUptimeCreateAdvancedSettings": "Advanced settings",
"distributedUptimeDetailsNoMonitorHistory": "There is no check history for this monitor yet.",
"distributedUptimeDetailsStatusHeaderUptime": "Uptime:",
"distributedUptimeDetailsStatusHeaderLastUpdate": "Last updated",
"notifications": {
"enableNotifications": "Enable {{platform}} notifications",
"testNotification": "Test notification",
@@ -174,7 +165,6 @@
"failed": "Failed to send test notification"
}
},
"testLocale": "testLocale",
"add": "Add",
"monitors": "monitors",
"pages": {
@@ -241,34 +231,6 @@
}
}
},
"distributedUptimeStatusCreateStatusPage": "status page",
"distributedUptimeStatusCreateStatusPageAccess": "Access",
"distributedUptimeStatusCreateStatusPageReady": "If your status page is ready, you can mark it as published.",
"distributedUptimeStatusBasicInfoHeader": "Basic Information",
"distributedUptimeStatusBasicInfoDescription": "Define company name and the subdomain that your status page points to.",
"distributedUptimeStatusLogoHeader": "Logo",
"distributedUptimeStatusLogoDescription": "Upload a logo for your status page",
"distributedUptimeStatusLogoUploadButton": "Upload logo",
"distributedUptimeStatusStandardMonitorsHeader": "Standard Monitors",
"distributedUptimeStatusStandardMonitorsDescription": "Attach standard monitors to your status page.",
"distributedUptimeStatusCreateYour": "Create your",
"distributedUptimeStatusEditYour": "Edit your",
"distributedUptimeStatusPublishedLabel": "Published and visible to the public",
"distributedUptimeStatusCompanyNameLabel": "Company name",
"distributedUptimeStatusPageAddressLabel": "Your status page address",
"distributedUptimeStatus30Days": "30 days",
"distributedUptimeStatus60Days": "60 days",
"distributedUptimeStatus90Days": "90 days",
"distributedUptimeStatusPageNotSetUp": "A status page is not set up.",
"distributedUptimeStatusContactAdmin": "Please contact your administrator",
"distributedUptimeStatusPageNotPublic": "This status page is not public.",
"distributedUptimeStatusPageDeleteDialog": "Do you want to delete this status page?",
"distributedUptimeStatusPageDeleteConfirm": "Yes, delete status page",
"distributedUptimeStatusPageDeleteDescription": "Once deleted, your status page cannot be retrieved.",
"distributedUptimeStatusDevices": "Devices",
"distributedUptimeStatusUpt": "UPT",
"distributedUptimeStatusUptBurned": "UPT Burned",
"distributedUptimeStatusUptLogo": "Upt Logo",
"incidentsTableNoIncidents": "No incidents recorded",
"incidentsTablePaginationLabel": "incidents",
"incidentsTableMonitorName": "Monitor Name",
@@ -279,7 +241,6 @@
"incidentsOptionsHeader": "Incidents for:",
"incidentsOptionsHeaderFilterBy": "Filter by:",
"incidentsOptionsHeaderFilterAll": "All",
"incidentsOptionsHeaderFilterActive": "Active",
"incidentsOptionsHeaderFilterDown": "Down",
"incidentsOptionsHeaderFilterCannotResolve": "Cannot Resolve",
"incidentsOptionsHeaderShow": "Show:",
@@ -625,7 +586,6 @@
"game": "Enter the IP address or hostname and the port number to ping (e.g., 192.168.1.100 or example.com) and choose game type.",
"https": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard."
},
"auth": {
"common": {
"navigation": {