resolve conflcits
This commit is contained in:
commit
e86734cee9
4 files changed
+14
-8
No files matched your search
@@ -8,7 +8,7 @@ import { Settings, ExternalLink } from "lucide-react";
|
|||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import type { StatusPage } from "@/Types/StatusPage";
|
import { PUBLIC_STATUS_PAGE_PREFIX, type StatusPage } from "@/Types/StatusPage";
|
||||||
|
|
||||||
interface HeaderStatusPageControlsProps {
|
interface HeaderStatusPageControlsProps {
|
||||||
isAdmin: boolean;
|
isAdmin: boolean;
|
||||||
@@ -50,7 +50,7 @@ export const HeaderStatusPageControls = ({
|
|||||||
<Typography
|
<Typography
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.open(
|
window.open(
|
||||||
`/status/public/${statusPage.url}`,
|
`${PUBLIC_STATUS_PAGE_PREFIX}/${statusPage.url}`,
|
||||||
"_blank",
|
"_blank",
|
||||||
"noopener,noreferrer"
|
"noopener,noreferrer"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,8 +9,13 @@ import { useIsAdmin } from "@/Hooks/useIsAdmin";
|
|||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useLocation, useParams } from "react-router-dom";
|
||||||
import { useGet } from "@/Hooks/UseApi";
|
import { useGet } from "@/Hooks/UseApi";
|
||||||
import type { Monitor } from "@/Types/Monitor";
|
import type { Monitor } from "@/Types/Monitor";
|
||||||
import type { StatusPage, StatusPageResponse, StatusPageTheme } from "@/Types/StatusPage";
|
|
||||||
import { resolveStatusPageTheme } from "@/Types/StatusPage";
|
import { resolveStatusPageTheme } from "@/Types/StatusPage";
|
||||||
|
import {
|
||||||
|
PUBLIC_STATUS_PAGE_PREFIX,
|
||||||
|
type StatusPage,
|
||||||
|
type StatusPageResponse,
|
||||||
|
type StatusPageTheme,
|
||||||
|
} from "@/Types/StatusPage";
|
||||||
import { HeaderStatusPageControls } from "./Components/HeaderStatusPageControls";
|
import { HeaderStatusPageControls } from "./Components/HeaderStatusPageControls";
|
||||||
import { StatusPageThemeProvider } from "./themes/StatusPageThemeProvider";
|
import { StatusPageThemeProvider } from "./themes/StatusPageThemeProvider";
|
||||||
import { RefinedStatusPage } from "./themes/refined/RefinedStatusPage";
|
import { RefinedStatusPage } from "./themes/refined/RefinedStatusPage";
|
||||||
@@ -40,7 +45,8 @@ const StatusPageView = () => {
|
|||||||
const { url } = useParams();
|
const { url } = useParams();
|
||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isPublic = location.pathname.startsWith("/status/public");
|
|
||||||
|
const isPublic = location.pathname.startsWith(PUBLIC_STATUS_PAGE_PREFIX);
|
||||||
|
|
||||||
const apiUrl = url ? `/status-page/${url}?type=uptime&type=infrastructure` : null;
|
const apiUrl = url ? `/status-page/${url}?type=uptime&type=infrastructure` : null;
|
||||||
|
|
||||||
@@ -105,8 +111,7 @@ const StatusPageView = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admin preview: wrap in a mock browser frame inside the admin shell.
|
const publicUrl = `${window.location.origin}${PUBLIC_STATUS_PAGE_PREFIX}/${statusPage.url}`;
|
||||||
const publicUrl = `${window.location.origin}/status/public/${statusPage.url}`;
|
|
||||||
return (
|
return (
|
||||||
<BasePage
|
<BasePage
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import type { StatusPage } from "@/Types/StatusPage";
|
import { PUBLIC_STATUS_PAGE_PREFIX, type StatusPage } from "@/Types/StatusPage";
|
||||||
|
|
||||||
interface StatusPagesTableProps {
|
interface StatusPagesTableProps {
|
||||||
data: StatusPage[];
|
data: StatusPage[];
|
||||||
@@ -50,7 +50,7 @@ export const StatusPagesTable = ({
|
|||||||
const handleUrlClick = (e: React.MouseEvent, row: StatusPage) => {
|
const handleUrlClick = (e: React.MouseEvent, row: StatusPage) => {
|
||||||
if (row.isPublished) {
|
if (row.isPublished) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const url = `/status/public/${row.url}`;
|
const url = `${PUBLIC_STATUS_PAGE_PREFIX}/${row.url}`;
|
||||||
window.open(url, "_blank", "noopener,noreferrer");
|
window.open(url, "_blank", "noopener,noreferrer");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export const resolveStatusPageThemeMode = (
|
|||||||
value: string | null | undefined
|
value: string | null | undefined
|
||||||
): StatusPageThemeMode =>
|
): StatusPageThemeMode =>
|
||||||
STATUS_PAGE_THEME_MODES.find((m) => m === value) ?? DEFAULT_STATUS_PAGE_THEME_MODE;
|
STATUS_PAGE_THEME_MODES.find((m) => m === value) ?? DEFAULT_STATUS_PAGE_THEME_MODE;
|
||||||
|
export const PUBLIC_STATUS_PAGE_PREFIX = "/status/public";
|
||||||
|
|
||||||
export interface StatusPage {
|
export interface StatusPage {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
Reference in new issue
Block a user