gave whitelabels a label field

This commit is contained in:
Carter 2025-03-10 10:45:25 -06:00
parent 3bab272744
commit 429f990b41
2 changed files with 22 additions and 11 deletions

View file

@ -1,22 +1,28 @@
import { lazy, Suspense } from "react"; import { lazy, Suspense } from "react";
import LoadingScreen from "../app/LoadingScreen"; import LoadingScreen from "../app/LoadingScreen";
import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom"; import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
import { Typography } from "@mui/material";
import { useAuth0 } from "@auth0/auth0-react"; import { useAuth0 } from "@auth0/auth0-react";
import Teams from "pages/Teams"; // import Teams from "pages/Teams";
import Users from "pages/Users"; // import Users from "pages/Users";
import TeamPage from "pages/Team"; // import TeamPage from "pages/Team";
import Header from "app/Header"; import Header from "app/Header";
import Logout from "pages/Logout"; import Logout from "pages/Logout";
import Devices from "pages/Devices"; import Devices from "pages/Devices";
import DevicePage from "pages/Device"; // import DevicePage from "pages/Device";
import GroupsPage from "pages/Groups"; // import GroupsPage from "pages/Groups";
import GroupPage from "pages/Group"; // import GroupPage from "pages/Group";
import { ErrorBoundary } from "react-error-boundary"; import { ErrorBoundary } from "react-error-boundary";
import DeviceComponent from "pages/DeviceComponent"; import DeviceComponent from "pages/DeviceComponent";
import Bins from "pages/Bins"; import Bins from "pages/Bins";
import { getWhitelabel } from "services/whiteLabel";
const DeviceHistory = lazy(() => import("pages/DeviceHistory")); const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
const DevicePage = lazy(() => import("pages/Device"));
const GroupsPage = lazy(() => import("pages/Groups"));
const GroupPage = lazy(() => import("pages/Group"));
const Teams = lazy(() => import("pages/Teams"));
const Users = lazy(() => import("pages/Users"));
const TeamPage = lazy(() => import("pages/Team"));
interface Props { interface Props {
toggleTheme: () => void; toggleTheme: () => void;
@ -31,6 +37,7 @@ export default function Router(props: Props) {
const { toggleTheme } = props; const { toggleTheme } = props;
const { isAuthenticated, loginWithRedirect, isLoading } = useAuth0(); const { isAuthenticated, loginWithRedirect, isLoading } = useAuth0();
const whiteLabel = getWhitelabel();
const RelativeRoutes = () => { const RelativeRoutes = () => {
return ( return (
@ -187,7 +194,7 @@ export default function Router(props: Props) {
<Route path="/callback" element={<Navigate to="/" />} /> <Route path="/callback" element={<Navigate to="/" />} />
{/* <Route path="/team/:teamID" element={<Navigate to="/teams/:teamID" />} /> */} {/* <Route path="/team/:teamID" element={<Navigate to="/teams/:teamID" />} /> */}
{/* <Route path="/device/:deviceID" element={<Navigate to="/devices/:devicesID" />} /> */} {/* <Route path="/device/:deviceID" element={<Navigate to="/devices/:devicesID" />} /> */}
<Route path="" element={<Navigate to="/devices" />} /> <Route path="" element={<Navigate to={whiteLabel.homePage ? whiteLabel.homePage : "/devices"} />} />
{/* Page routes */} {/* Page routes */}
{/* <Route index element={<Typography>Hello!</Typography>} /> */} {/* <Route index element={<Typography>Hello!</Typography>} /> */}

View file

@ -47,6 +47,7 @@ interface WhiteLabel {
tutorialPlaylistID?: string; tutorialPlaylistID?: string;
thumbnail?: string; thumbnail?: string;
tutorialFiles?: { name: string; url: string }[]; tutorialFiles?: { name: string; url: string }[];
homePage?: string;
} }
// const DEFAULT_WHITELABEL: WhiteLabel = { // const DEFAULT_WHITELABEL: WhiteLabel = {
@ -84,7 +85,8 @@ const STAGING_WHITELABEL: WhiteLabel = {
hotjarID: import.meta.env.REACT_APP_HOTJAR_ID_BXT, hotjarID: import.meta.env.REACT_APP_HOTJAR_ID_BXT,
docs: "Platform", docs: "Platform",
protips: protips, protips: protips,
tutorialPlaylistID: "" tutorialPlaylistID: "",
homePage: "/devices"
}; };
const BXT_WHITE_LABEL: WhiteLabel = { const BXT_WHITE_LABEL: WhiteLabel = {
@ -103,7 +105,8 @@ const BXT_WHITE_LABEL: WhiteLabel = {
blacklist: [], blacklist: [],
hotjarID: import.meta.env.REACT_APP_HOTJAR_ID_BXT, hotjarID: import.meta.env.REACT_APP_HOTJAR_ID_BXT,
docs: "Platform", docs: "Platform",
protips: protips protips: protips,
homePage: "/devices"
}; };
export function isBXT(): boolean { export function isBXT(): boolean {
@ -138,7 +141,8 @@ const ADAPTIVE_AGRICULTURE_WHITE_LABEL: WhiteLabel = {
url: url:
"https://adaptiveagriculture.ca/wp-content/uploads/2023/08/Bindapt-Adapter-Plate-Set-Up-Guide.pdf" "https://adaptiveagriculture.ca/wp-content/uploads/2023/08/Bindapt-Adapter-Plate-Set-Up-Guide.pdf"
} }
] ],
homePage: "/bins"
}; };
export function IsAdaptiveAgriculture(): boolean { export function IsAdaptiveAgriculture(): boolean {