Feat: Migrate Hardcoded Strings

This commit is contained in:
Br0wnHammer committed 2025-03-12 00:56:28 +05:30
1 parent 6578d7e78a
commit 5df5cf3870
15 files changed
+231 -117

No files matched your search

@@ -20,11 +20,13 @@ import { createToast } from "../../../Utils/toastUtils";
import { useNavigate } from "react-router-dom";
import { useMonitorsFetch } from "../../StatusPage/Create/Hooks/useMonitorsFetch";
import { useDUStatusPageFetchByUrl } from "../Status/Hooks/useDUStatusPageFetchByUrl";
import { useTranslation } from "react-i18next";
const CreateStatus = () => {
const theme = useTheme();
const { monitorId, url } = useParams();
const navigate = useNavigate();
const { t } = useTranslation();
const isCreate = typeof url === "undefined";
const [createStatusPage, isLoading, networkError] = useCreateStatusPage(isCreate);
@@ -176,7 +178,7 @@ const CreateStatus = () => {
component="span"
fontSize="inherit"
>
{isCreate ? "Create your" : "Edit your"}{" "}
{isCreate ? t("distributedUptimeStatusCreateYour") : t("distributedUptimeStatusEditYour")}{" "}
</Typography>
<Typography
component="span"
@@ -184,21 +186,21 @@ const CreateStatus = () => {
fontSize="inherit"
fontWeight="inherit"
>
status page
{t("distributedUptimeStatusCreateStatusPage")}
</Typography>
</Typography>
<ConfigBox>
<Stack>
<Typography component="h2">Access</Typography>
<Typography component="h2">{t("distributedUptimeStatusCreateStatusPageAccess")}</Typography>
<Typography component="p">
If your status page is ready, you can mark it as published.
{t("distributedUptimeStatusCreateStatusPageReady")}
</Typography>
</Stack>
<Stack gap={theme.spacing(18)}>
<Checkbox
id="publish"
name="isPublished"
label={`Published and visible to the public`}
label={t("distributedUptimeStatusPublishedLabel")}
isChecked={form.isPublished}
onChange={handleFormChange}
/>
@@ -206,9 +208,9 @@ const CreateStatus = () => {
</ConfigBox>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">Basic Information</Typography>
<Typography component="h2">{t("distributedUptimeStatusBasicInfoHeader")}</Typography>
<Typography component="p">
Define company name and the subdomain that your status page points to.
{t("distributedUptimeStatusBasicInfoDescription")}
</Typography>
</Stack>
<Stack gap={theme.spacing(18)}>
@@ -216,7 +218,7 @@ const CreateStatus = () => {
id="companyName"
name="companyName"
type="text"
label="Company name"
label={t("distributedUptimeStatusCompanyNameLabel")}
placeholder="Company name"
value={form.companyName}
onChange={handleFormChange}
@@ -227,7 +229,7 @@ const CreateStatus = () => {
id="url"
name="url"
type="url"
label="Your status page address"
label={t("distributedUptimeStatusPageAddressLabel")}
disabled={!isCreate}
value={form.url}
onChange={handleFormChange}
@@ -238,8 +240,8 @@ const CreateStatus = () => {
</ConfigBox>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">Logo</Typography>
<Typography component="p">Upload a logo for your status page </Typography>
<Typography component="h2">{t("distributedUptimeStatusLogoHeader")}</Typography>
<Typography component="p">{t("distributedUptimeStatusLogoDescription")} </Typography>
</Stack>
<Stack
gap={theme.spacing(18)}
@@ -262,7 +264,7 @@ const CreateStatus = () => {
color="accent"
tabIndex={-1}
>
Upload logo
{t("distributedUptimeStatusLogoUploadButton")}
<VisuallyHiddenInput onChange={handleImageUpload} />
</Button>
</Box>
@@ -270,9 +272,9 @@ const CreateStatus = () => {
</ConfigBox>
<ConfigBox>
<Stack>
<Typography component="h2">Standard Monitors</Typography>
<Typography component="h2">{t("distributedUptimeStatusStandardMonitorsHeader")}</Typography>
<Typography component="p">
Attach standard monitors to your status page.
{t("distributedUptimeStatusStandardMonitorsDescription")}
</Typography>
</Stack>
<Stack gap={theme.spacing(18)}>
@@ -301,7 +303,7 @@ const CreateStatus = () => {
color="accent"
onClick={handleSubmit}
>
Save
{t("settingsSave")}
</Button>
</Stack>
</Stack>
@@ -1,8 +1,10 @@
import { Stack, Button, ButtonGroup } from "@mui/material";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
const TimeFrameHeader = ({ timeFrame, setTimeFrame, sx, ...props }) => {
const theme = useTheme();
const { t } = useTranslation();
return (
<Stack
direction="row"
@@ -16,21 +18,21 @@ const TimeFrameHeader = ({ timeFrame, setTimeFrame, sx, ...props }) => {
filled={(timeFrame === 30).toString()}
onClick={() => setTimeFrame(30)}
>
30 days
{t("distributedUptimeStatus30Days")}
</Button>
<Button
variant="group"
filled={(timeFrame === 60).toString()}
onClick={() => setTimeFrame(60)}
>
60 days
{t("distributedUptimeStatus60Days")}
</Button>
<Button
variant="group"
filled={(timeFrame === 90).toString()}
onClick={() => setTimeFrame(90)}
>
90 days
{t("distributedUptimeStatus90Days")}
</Button>
</ButtonGroup>
</Stack>
@@ -124,9 +124,9 @@ const DistributedUptimeStatus = () => {
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
>
A status page is not set up.
{t("distributedUptimeStatusPageNotSetUp")}
</Typography>
<Typography>Please contact your administrator</Typography>
<Typography>{t("distributedUptimeStatusContactAdmin")}</Typography>
</GenericFallback>
</Stack>
);
@@ -137,7 +137,7 @@ const DistributedUptimeStatus = () => {
return (
<Stack sx={sx}>
<GenericFallback>
<Typography>This status page is not public.</Typography>
<Typography>{t("distributedUptimeStatusPageNotPublic")}</Typography>
</GenericFallback>
</Stack>
);
@@ -155,9 +155,9 @@ const DistributedUptimeStatus = () => {
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
>
Network error
{t("networkError")}
</Typography>
<Typography>Please check your connection</Typography>
<Typography>{t("checkConnection")}</Typography>
</GenericFallback>
);
}
@@ -171,7 +171,7 @@ const DistributedUptimeStatus = () => {
<Stack gap={theme.spacing(10)}>
<Breadcrumbs list={BREADCRUMBS} />
<GenericFallback>
<Typography>There is no check history for this monitor yet.</Typography>
<Typography>{t("distributedUptimeDetailsNoMonitorHistory")}</Typography>
</GenericFallback>
</Stack>
);
@@ -246,17 +246,17 @@ const DistributedUptimeStatus = () => {
gap={theme.spacing(8)}
>
<InfoBox
heading="Devices"
heading={t("distributedUptimeStatusDevices")}
subHeading={monitor?.totalChecks ?? 0}
icon={PeopleAltOutlinedIcon}
alt="Upt Logo"
sx={{ width: "50%" }}
/>
<InfoBox
heading={isSmallScreen ? "UPT" : "UPT Burned"}
heading={isSmallScreen ? t("distributedUptimeStatusUpt") : t("distributedUptimeStatusUptBurned")}
subHeading={safelyParseFloat(monitor?.uptBurnt).toFixed(4)}
img={UptLogo}
alt="Upt Logo"
alt={t("distributedUptimeStatusUptLogo")}
sx={{ width: "50%" }}
/>
</Stack>
@@ -295,7 +295,7 @@ const DistributedUptimeStatus = () => {
<Footer />
<Dialog
// open={isOpen.deleteStats}
title="Do you want to delete this status page?"
title={t("distributedUptimeStatusPageDeleteDialog")}
onConfirm={() => {
deleteStatusPage();
setIsDeleteOpen(false);
@@ -304,8 +304,8 @@ const DistributedUptimeStatus = () => {
setIsDeleteOpen(false);
}}
open={isDeleteOpen}
confirmationButtonLabel="Yes, delete status page"
description="Once deleted, your status page cannot be retrieved."
confirmationButtonLabel={t("distributedUptimeStatusPageDeleteConfirm")}
description={t("distributedUptimeStatusPageDeleteDescription")}
isLoading={isDeleting || isLoading}
/>
</Stack>