locale
This commit is contained in:
1 parent
b94e6052c3
commit
64d1ba08f9
23 files changed
+1657
-170
No files matched your search
@@ -47,7 +47,7 @@ export const HeaderCreate = ({
|
||||
>
|
||||
{limitReached
|
||||
? "Your plan's limit has been reached"
|
||||
: label || t("createNew")}
|
||||
: label || t("common.buttons.createNew")}
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ButtonGroup, Button } from "@/components/inputs";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||
import { useTranslation } from "react-i18next";
|
||||
export const HeaderRange = ({
|
||||
range,
|
||||
setRange,
|
||||
@@ -14,6 +15,7 @@ export const HeaderRange = ({
|
||||
loading: boolean;
|
||||
all?: boolean;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||
return (
|
||||
@@ -45,7 +47,7 @@ export const HeaderRange = ({
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
All
|
||||
{t("common.buttons.range.all")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
@@ -61,7 +63,7 @@ export const HeaderRange = ({
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
Recent
|
||||
{t("common.buttons.range.recent")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
@@ -76,7 +78,7 @@ export const HeaderRange = ({
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
Day
|
||||
{t("common.buttons.range.day")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
@@ -91,7 +93,7 @@ export const HeaderRange = ({
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
7 days
|
||||
{t("common.buttons.range.week")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
@@ -106,7 +108,7 @@ export const HeaderRange = ({
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
30 days
|
||||
{t("common.buttons.range.month")}
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Stack>
|
||||
|
||||
@@ -127,9 +127,9 @@ export const MonitorBasePageWithStates: React.FC<
|
||||
return (
|
||||
<EmptyMonitorFallback
|
||||
page={page}
|
||||
title={t(`${page}Monitor.fallback.title`)}
|
||||
bullets={t(`${page}Monitor.fallback.checks`, { returnObjects: true })}
|
||||
actionButtonText={t(`${page}Monitor.fallback.actionButton`)}
|
||||
title={t(`monitors.${page}.fallback.title`)}
|
||||
bullets={t(`monitors.${page}.fallback.checks`, { returnObjects: true })}
|
||||
actionButtonText={t(`monitors.${page}.fallback.actionButton`)}
|
||||
actionLink={actionLink || ""}
|
||||
monitorLimitReached={monitorLimitReached}
|
||||
/>
|
||||
|
||||
@@ -41,7 +41,11 @@ const StatusBox = ({
|
||||
return (
|
||||
<BGBox>
|
||||
<Stack spacing={theme.spacing(4)}>
|
||||
<Typography variant={"h2"} textTransform="uppercase" color={theme.palette.text.secondary}>
|
||||
<Typography
|
||||
variant={"h2"}
|
||||
textTransform="uppercase"
|
||||
color={theme.palette.text.secondary}
|
||||
>
|
||||
{label}
|
||||
</Typography>
|
||||
<Typography variant="h1" color={color}>
|
||||
@@ -55,23 +59,47 @@ const StatusBox = ({
|
||||
export const UpStatusBox = ({ n }: { n: number }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
return <StatusBox label={t("monitorStatus.up")} n={n} color={theme.palette.success.light} />;
|
||||
return (
|
||||
<StatusBox
|
||||
label={t("monitors.common.status.up")}
|
||||
n={n}
|
||||
color={theme.palette.success.light}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const DownStatusBox = ({ n }: { n: number }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
return <StatusBox label={t("monitorStatus.down")} n={n} color={theme.palette.error.light} />;
|
||||
return (
|
||||
<StatusBox
|
||||
label={t("monitors.common.status.down")}
|
||||
n={n}
|
||||
color={theme.palette.error.light}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const PausedStatusBox = ({ n }: { n: number }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
return <StatusBox label={t("monitorStatus.paused")} n={n} color={theme.palette.warning.light} />;
|
||||
return (
|
||||
<StatusBox
|
||||
label={t("monitors.common.status.paused")}
|
||||
n={n}
|
||||
color={theme.palette.warning.light}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const InitializingStatusBox = ({ n }: { n: number }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
return <StatusBox label={t("monitorStatus.initializing")} n={n} color={theme.palette.warning.light} />;
|
||||
return (
|
||||
<StatusBox
|
||||
label={t("monitors.common.status.initializing")}
|
||||
n={n}
|
||||
color={theme.palette.warning.light}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import TablePagination from "@mui/material/TablePagination";
|
||||
import type { TablePaginationProps } from "@mui/material/TablePagination";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useState, Fragment } from "react";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||
@@ -362,6 +363,7 @@ export const Pagination: React.FC<TablePaginationProps> = ({ ...props }) => {
|
||||
|
||||
const EmptyView = () => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Stack
|
||||
alignItems={"center"}
|
||||
@@ -373,7 +375,7 @@ const EmptyView = () => {
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
}}
|
||||
>
|
||||
<Typography>No data</Typography>
|
||||
<Typography>{t("monitors.common.table.empty")}</Typography>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import DialogContentText from "@mui/material/DialogContentText";
|
||||
import DialogTitle from "@mui/material/DialogTitle";
|
||||
import { Button } from "@/components/inputs";
|
||||
import { typographyLevels } from "@/theme/palette";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export const DialogInput = ({
|
||||
open,
|
||||
@@ -25,6 +26,7 @@ export const DialogInput = ({
|
||||
cancelColor?: "error" | "primary";
|
||||
loading?: boolean;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Dialog open={open}>
|
||||
<DialogTitle sx={{ fontSize: typographyLevels.l }}>{title}</DialogTitle>
|
||||
@@ -38,7 +40,7 @@ export const DialogInput = ({
|
||||
color={cancelColor}
|
||||
onClick={onCancel}
|
||||
>
|
||||
Cancel
|
||||
{t("common.buttons.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
@@ -46,7 +48,7 @@ export const DialogInput = ({
|
||||
color={confirmColor}
|
||||
onClick={onConfirm}
|
||||
>
|
||||
Confirm
|
||||
{t("common.buttons.confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -4,6 +4,7 @@ import Typography from "@mui/material/Typography";
|
||||
import { Gauge } from "lucide-react";
|
||||
import { Cell, RadialBarChart, RadialBar, ResponsiveContainer } from "recharts";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getResponseTimeColor } from "@/utils/MonitorUtils";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
|
||||
@@ -14,6 +15,7 @@ export const ChartAvgResponse = ({
|
||||
avg: number;
|
||||
max: number;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const chartData = [
|
||||
{ name: "max", value: max - avg, color: "transparent" },
|
||||
@@ -28,7 +30,10 @@ export const ChartAvgResponse = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<BaseChart icon={<Gauge size={20} strokeWidth={1.5} />} title={"Average response time"}>
|
||||
<BaseChart
|
||||
icon={<Gauge size={20} strokeWidth={1.5} />}
|
||||
title={t("common.charts.avgResponseTime.title")}
|
||||
>
|
||||
<Stack height="100%" position={"relative"} justifyContent={"flex-end"}>
|
||||
<ResponsiveContainer width="100%" height={155}>
|
||||
<RadialBarChart
|
||||
@@ -49,8 +54,12 @@ export const ChartAvgResponse = ({
|
||||
</RadialBarChart>
|
||||
</ResponsiveContainer>
|
||||
<Stack direction={"row"} justifyContent={"space-between"}>
|
||||
<Typography variant="body2">Low</Typography>
|
||||
<Typography variant="body2">High</Typography>
|
||||
<Typography variant="body2">
|
||||
{t("common.charts.avgResponseTime.lowLabel")}
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
{t("common.charts.avgResponseTime.highLabel")}
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack
|
||||
position="absolute"
|
||||
|
||||
@@ -51,7 +51,7 @@ export const HeaderControls = ({
|
||||
await post(`/monitors/${monitor._id}/notifications/test`, {});
|
||||
}}
|
||||
>
|
||||
{t("sendTestNotifications")}
|
||||
{t("common.buttons.testNotification")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
@@ -60,7 +60,7 @@ export const HeaderControls = ({
|
||||
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||
}}
|
||||
>
|
||||
{t("menu.incidents")}
|
||||
{t("common.buttons.incidents")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={isPatching || isPosting}
|
||||
@@ -76,7 +76,9 @@ export const HeaderControls = ({
|
||||
)
|
||||
}
|
||||
>
|
||||
{monitor?.status === "paused" ? t("resume") : t("pause")}
|
||||
{monitor?.status === "paused"
|
||||
? t("common.buttons.resume")
|
||||
: t("common.buttons.pause")}
|
||||
</Button>
|
||||
<Button
|
||||
startIcon={<Settings size={20} strokeWidth={1.5} />}
|
||||
@@ -84,7 +86,7 @@ export const HeaderControls = ({
|
||||
navigate(`${path}/${monitor._id}/configure`);
|
||||
}}
|
||||
>
|
||||
{t("configure")}
|
||||
{t("common.buttons.configure")}
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Stack>
|
||||
|
||||
@@ -5,6 +5,7 @@ import Typography from "@mui/material/Typography";
|
||||
import { Select, Checkbox, TextInput } from "@/components/inputs";
|
||||
import { LoadingSpinner } from "@/components/design-elements";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import type { SelectChangeEvent } from "@mui/material/Select";
|
||||
@@ -42,6 +43,7 @@ export const HeaderFilter = ({
|
||||
loading = false,
|
||||
}: HeaderFilterProps) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
const [localSearch, setLocalSearch] = useState<string>(searchString);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -68,7 +70,7 @@ export const HeaderFilter = ({
|
||||
return (
|
||||
<Stack spacing={theme.spacing(4)} direction={{ xs: "column", sm: "row" }}>
|
||||
<Select
|
||||
placeholder="Monitor type"
|
||||
placeholder={t("monitors.uptime.filters.type.placeholder")}
|
||||
multiple
|
||||
value={selectedTypes}
|
||||
onChange={handleTypeChange}
|
||||
@@ -83,7 +85,7 @@ export const HeaderFilter = ({
|
||||
))}
|
||||
</Select>
|
||||
<Select
|
||||
placeholder="Monitor status"
|
||||
placeholder={t("monitors.uptime.filters.status.placeholder")}
|
||||
multiple
|
||||
value={selectedStatuses}
|
||||
onChange={handleStatusChange}
|
||||
@@ -100,7 +102,7 @@ export const HeaderFilter = ({
|
||||
<LoadingSpinner show={loading} sx={{ alignSelf: "center" }} />
|
||||
<Box flex={1} display={{ xs: "none", md: "inherit" }} />
|
||||
<TextInput
|
||||
placeholder="Search monitors"
|
||||
placeholder={t("monitors.uptime.filters.search.placeholder")}
|
||||
value={localSearch}
|
||||
onChange={(event) => {
|
||||
setLocalSearch(event.target.value);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { TrendingUp, AlertTriangle } from "lucide-react";
|
||||
import type { GroupedCheck } from "@/types/check";
|
||||
import type { MonitorStatus } from "@/types/monitor";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { normalizeResponseTimes } from "@/utils/DataUtils";
|
||||
import { useState } from "react";
|
||||
import { formatDateWithTz } from "@/utils/TimeUtils";
|
||||
@@ -63,9 +64,15 @@ export const HistogramStatus = ({
|
||||
range: string;
|
||||
title: string;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
|
||||
|
||||
const icon = status === "up" ? <TrendingUp size={20} strokeWidth={1.5} /> : <AlertTriangle size={20} strokeWidth={1.5} />;
|
||||
const icon =
|
||||
status === "up" ? (
|
||||
<TrendingUp size={20} strokeWidth={1.5} />
|
||||
) : (
|
||||
<AlertTriangle size={20} strokeWidth={1.5} />
|
||||
);
|
||||
const theme = useTheme();
|
||||
const [idx, setIdx] = useState<number | null>(null);
|
||||
const dateFormat = range === "1d" || range === "2h" ? "MMM D, h A" : "MMM D";
|
||||
@@ -76,7 +83,9 @@ export const HistogramStatus = ({
|
||||
<BaseChart icon={icon} title={title}>
|
||||
<Stack height={"100%"} alignItems={"center"} justifyContent={"center"}>
|
||||
<Typography variant="h2">
|
||||
{status === "up" ? "No checks yet" : "Great, no downtime yet!"}
|
||||
{status === "up"
|
||||
? t("common.charts.uptime.emptyUp")
|
||||
: t("common.charts.uptime.emptyDown")}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</BaseChart>
|
||||
|
||||
Reference in new issue
Block a user