merged in team share branch and update proto
This commit is contained in:
commit
78884da48c
25 changed files with 359 additions and 48 deletions
BIN
src/assets/whitelabels/Streamline/stream-logo.png
Normal file
BIN
src/assets/whitelabels/Streamline/stream-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
|
|
@ -59,7 +59,7 @@ const useStyles = makeStyles((theme: Theme) => {
|
|||
},
|
||||
stickyHeader: {
|
||||
position: "sticky",
|
||||
backgroundColor: getThemeType() === "light" ? "rgb(245, 245, 245)" : "rgb(40, 40, 40)",
|
||||
// backgroundColor: getThemeType() === "light" ? "rgb(245, 245, 245)" : "rgb(40, 40, 40)",
|
||||
top: 0,
|
||||
zIndex: 300 //giving a really high z-index to make sure nothing is in front of it
|
||||
}
|
||||
|
|
@ -165,6 +165,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
const saved = localStorage.getItem(rowKey);
|
||||
return saved ? JSON.parse(saved) : [];
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(rowKey, JSON.stringify(rowWidths));
|
||||
}, [rowWidths])
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ export default function UpgradeDevice(props: Props) {
|
|||
};
|
||||
|
||||
const percent = () => {
|
||||
return Math.round((upgrade.status.offset / upgrade.status.size) * 100);
|
||||
let progress = Math.round((upgrade.status.offset / upgrade.status.size) * 100)
|
||||
console.log(progress)
|
||||
return progress;
|
||||
};
|
||||
|
||||
const tooltip = () => {
|
||||
|
|
@ -243,7 +245,7 @@ export default function UpgradeDevice(props: Props) {
|
|||
<UpdateIcon />
|
||||
{upgrading() && (
|
||||
<CircularProgress
|
||||
// variant="static"
|
||||
variant="determinate"
|
||||
value={percent()}
|
||||
size={"2rem"}
|
||||
className={classes.buttonProgress}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ export default function GateFlowGraph(props: Props) {
|
|||
|
||||
const flowChart = () => {
|
||||
return (
|
||||
<Card raised style={{ padding: 10, marginBottom: 15 }}>
|
||||
<Card raised style={{ padding: 10, marginBottom: 15, marginTop: 15 }}>
|
||||
<CardHeader
|
||||
title={<Typography style={{ fontSize: 25, fontWeight: 650 }}>Mass Air Flow</Typography>}
|
||||
subheader={
|
||||
|
|
@ -369,7 +369,7 @@ export default function GateFlowGraph(props: Props) {
|
|||
<Grid container direction="row" spacing={2} className={classes.runtimeGrid}>
|
||||
<Grid size={3}>
|
||||
<Card raised className={classes.calcCard}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid container width="100%" direction="column" alignItems="center">
|
||||
<Grid>Approximate Runtime:</Grid>
|
||||
<Grid>
|
||||
<Typography style={{ fontWeight: 650, fontSize: 15 }}>
|
||||
|
|
@ -381,7 +381,7 @@ export default function GateFlowGraph(props: Props) {
|
|||
</Grid>
|
||||
<Grid size={3}>
|
||||
<Card raised className={classes.calcCard}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid container width="100%" direction="column" alignItems="center">
|
||||
<Grid>Cost to run PCA:</Grid>
|
||||
<Grid>
|
||||
<Typography style={{ fontWeight: 650, fontSize: 15 }}>
|
||||
|
|
@ -396,7 +396,7 @@ export default function GateFlowGraph(props: Props) {
|
|||
</Grid>
|
||||
<Grid size={3}>
|
||||
<Card raised className={classes.calcCard}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid container width="100%" direction="column" alignItems="center">
|
||||
<Grid>Cost to run APU:</Grid>
|
||||
<Grid>
|
||||
<Typography style={{ fontWeight: 650, fontSize: 15 }}>
|
||||
|
|
@ -411,7 +411,7 @@ export default function GateFlowGraph(props: Props) {
|
|||
</Grid>
|
||||
<Grid size={3}>
|
||||
<Card raised className={classes.calcCard}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid container width="100%" direction="column" alignItems="center">
|
||||
<Grid>Total Cost:</Grid>
|
||||
<Grid>
|
||||
<Typography style={{ fontWeight: 650, fontSize: 15 }}>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export class Bin {
|
|||
}
|
||||
|
||||
public empty(): boolean {
|
||||
return this.settings.inventory?.empty || this.settings.inventory?.grainBushels === 0;
|
||||
return this.settings.inventory?.empty || (this.settings.inventory !== undefined && this.settings.inventory !== null && this.settings.inventory.grainBushels < 5);
|
||||
}
|
||||
|
||||
public objectType(): pond.ObjectType {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { getWhitelabel } from "services/whiteLabel";
|
|||
import Ventilation from "pages/VentEditor";
|
||||
import { useGlobalState } from "providers";
|
||||
import DeviceSupport from "pages/DeviceSupport";
|
||||
import Login from "pages/Login";
|
||||
|
||||
const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
|
||||
const DevicePage = lazy(() => import("pages/Device"));
|
||||
|
|
@ -283,12 +284,12 @@ export default function Router() {
|
|||
};
|
||||
|
||||
if (isLoading) return null;
|
||||
if (!isAuthenticated) {
|
||||
loginWithRedirect()
|
||||
return (
|
||||
null
|
||||
)
|
||||
}
|
||||
// if (!isAuthenticated) {
|
||||
// loginWithRedirect()
|
||||
// return (
|
||||
// null
|
||||
// )
|
||||
// }
|
||||
|
||||
function ErrorFallback({ error }: { error: Error }) {
|
||||
return <div>Something went wrong: {error.stack}</div>;
|
||||
|
|
@ -302,6 +303,7 @@ export default function Router() {
|
|||
|
||||
{/* Redirects */}
|
||||
<Route path="/callback" element={<Navigate to="/" />} />
|
||||
<Route path="/login" element={<Login />} />
|
||||
{/* <Route path="/team/:teamID" element={<Navigate to="/teams/:teamID" />} /> */}
|
||||
{/* <Route path="/device/:deviceID" element={<Navigate to="/devices/:devicesID" />} /> */}
|
||||
<Route path="" element={<Navigate to={whiteLabel.homePage ? whiteLabel.homePage : "/devices"} />} />
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import {
|
|||
// isBXT,
|
||||
IsMiVent,
|
||||
IsOmniAir,
|
||||
IsStreamline,
|
||||
} from "services/whiteLabel";
|
||||
import MiningIcon from "products/ventilation/MiningIcon";
|
||||
import { useAuth0 } from "@auth0/auth0-react";
|
||||
|
|
@ -156,11 +157,12 @@ export default function SideNavigator(props: Props) {
|
|||
const authenticatedSideMenu = () => {
|
||||
const isMiVent = IsMiVent();
|
||||
const isAg = IsAdaptiveAgriculture()
|
||||
const isStreamline = IsStreamline()
|
||||
const isMiPCA = IsOmniAir()
|
||||
const isAdCon = IsAdCon()
|
||||
return (
|
||||
<List className={classes.list} component="nav">
|
||||
{(isAg || user.hasFeature("admin")) && (
|
||||
{(isAg || isStreamline || user.hasFeature("admin")) && (
|
||||
<Tooltip title="Visual Farm" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-visual-farm"
|
||||
|
|
@ -202,7 +204,7 @@ export default function SideNavigator(props: Props) {
|
|||
</ListItemButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
{(isAg || user.hasFeature("admin")) && (
|
||||
{(isAg || isStreamline || user.hasFeature("admin")) && (
|
||||
<Tooltip title="Contracts" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-contracts"
|
||||
|
|
@ -216,7 +218,7 @@ export default function SideNavigator(props: Props) {
|
|||
</ListItemButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
{(isAg || user.hasFeature("admin")) && (
|
||||
{(isAg || isStreamline || user.hasFeature("admin")) && (
|
||||
<Tooltip title="Bins" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-dashboard"
|
||||
|
|
@ -258,7 +260,7 @@ export default function SideNavigator(props: Props) {
|
|||
</ListItemButton>
|
||||
</Tooltip>
|
||||
}
|
||||
{(isAg || user.hasFeature("admin")) && (
|
||||
{(isAg || isStreamline || user.hasFeature("admin")) && (
|
||||
<Tooltip title="Transactions" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-transactions"
|
||||
|
|
@ -350,7 +352,7 @@ export default function SideNavigator(props: Props) {
|
|||
{open && <ListItemText primary="Users" />}
|
||||
</ListItemButton>
|
||||
</Tooltip>
|
||||
{(isAg || user.hasFeature("admin")) && (
|
||||
{(isAg || isStreamline || user.hasFeature("admin")) && (
|
||||
<Tooltip title="My Fields" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-field-list"
|
||||
|
|
@ -434,7 +436,7 @@ export default function SideNavigator(props: Props) {
|
|||
</ListItemButton>
|
||||
</Tooltip>
|
||||
}
|
||||
{isAg &&
|
||||
{isAg || isStreamline &&
|
||||
<Tooltip title="Marketplace" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-marketplace"
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ export default function DevicePage() {
|
|||
}
|
||||
|
||||
return (
|
||||
<PageContainer padding={isMobile ? 0 : 2}>
|
||||
<PageContainer spacing={isMobile ? 0 : 2}>
|
||||
<Grid container justifyContent={"space-between"}>
|
||||
<Grid>
|
||||
<SmartBreadcrumb deviceName={device.name()} />
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ export default function Devices() {
|
|||
const [limit, setLimit] = useState(10);
|
||||
const [page, setPage] = useState(0);
|
||||
|
||||
const [{ user }] = useGlobalState()
|
||||
|
||||
const [order, setOrder] = useState<"asc" | "desc">(() => {
|
||||
// Load from sessionStorage on initial render
|
||||
const savedOrder = sessionStorage.getItem('order');
|
||||
|
|
@ -585,6 +587,7 @@ export default function Devices() {
|
|||
}
|
||||
|
||||
const provisionButton= () => {
|
||||
if (!user.allowedTo("provision")) return null
|
||||
return (
|
||||
<Tooltip title="Provision Device">
|
||||
<IconButton onClick={openProvisionDialog} aria-label="Provision Device">
|
||||
|
|
|
|||
|
|
@ -115,17 +115,13 @@ export default function Gate(props: Props) {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(gateID)
|
||||
let key = gateID;
|
||||
let kind = "gate";
|
||||
if (as) {
|
||||
key = as;
|
||||
kind = "team";
|
||||
}
|
||||
console.log(key)
|
||||
console.log(kind)
|
||||
userAPI.getUser(user.id(), { key: key, kind: kind } as Scope).then(resp => {
|
||||
console.log(resp)
|
||||
setPermissions(resp.permissions);
|
||||
});
|
||||
}, [as, gateID, userAPI, user]);
|
||||
|
|
|
|||
53
src/pages/Login.tsx
Normal file
53
src/pages/Login.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { RedirectLoginOptions, useAuth0 } from "@auth0/auth0-react";
|
||||
// import { useAuth } from "hooks";
|
||||
import queryString from "query-string";
|
||||
import { useCallback, useEffect } from "react";
|
||||
import { useLocation } from "react-router";
|
||||
// import Loading from "./Loading";
|
||||
import LoadingScreen from "app/LoadingScreen";
|
||||
|
||||
interface Props {
|
||||
prevPath?: string;
|
||||
}
|
||||
|
||||
export default function Login(props: Props) {
|
||||
const { prevPath } = props;
|
||||
const location = useLocation();
|
||||
const { loginWithRedirect } = useAuth0();
|
||||
|
||||
const setRouteBeforeLogin = useCallback((): Promise<string> => {
|
||||
return new Promise(function(resolve) {
|
||||
localStorage.setItem("routeBeforeLogin", prevPath ? prevPath : "/");
|
||||
return resolve("success");
|
||||
});
|
||||
}, [prevPath]);
|
||||
|
||||
useEffect(() => {
|
||||
const options: RedirectLoginOptions = {
|
||||
authorizationParams: {} // Initialize here
|
||||
};
|
||||
console.log(location)
|
||||
if (location && location.search) {
|
||||
let parsed = queryString.parse(location.search);
|
||||
|
||||
console.log(parsed.signup)
|
||||
if (parsed.signup === "true") {
|
||||
// if (options.authorizationParams) options.authorizationParams.screen_hint = "signup"; // 'signup' tells Auth0 to show the signup tab
|
||||
options.authorizationParams!.screen_hint = "signup"; // 'signup' tells Auth0 to show the signup tab
|
||||
console.log(options)
|
||||
}
|
||||
|
||||
if (parsed.email && parsed.email !== "") {
|
||||
// if (options.authorizationParams) options.authorizationParams.login_hint = parsed.email.toString(); // prefill email
|
||||
options.authorizationParams!.login_hint = parsed.email.toString(); // prefill email
|
||||
}
|
||||
}
|
||||
|
||||
setRouteBeforeLogin().finally(() => {
|
||||
loginWithRedirect(options);
|
||||
});
|
||||
}, [location, loginWithRedirect, setRouteBeforeLogin]);
|
||||
|
||||
// return <LoadingScreen fullViewport={true} />;
|
||||
return <LoadingScreen message="login redirect" />;
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import AeroGrowLightLogo from "../assets/whitelabels/AeroGrow/lightLogo.png";
|
|||
import MiVentLightLogo from "../assets/whitelabels/MiVent/lightLogo.png";
|
||||
// import OmniAirLogo from "../assets/whitelabels/OmniAir/OmniAirLogo.png";
|
||||
import MiPCALogo from "../assets/whitelabels/OmniAir/MiPCALogo.png";
|
||||
import StreamlineLogo from "../assets/whitelabels/Streamline/stream-logo.png"
|
||||
// import { green, yellow } from "@mui/material/colors";
|
||||
|
||||
const protips: string[] = [
|
||||
|
|
@ -111,6 +112,28 @@ const BXT_WHITE_LABEL: WhiteLabel = {
|
|||
homePage: "/devices"
|
||||
};
|
||||
|
||||
const STREAMLINE_WHITE_LABEL: WhiteLabel = {
|
||||
name: "Streamline",
|
||||
primaryColour: "#FFFF",
|
||||
// primaryColour: "#0000FF",
|
||||
secondaryColour: "yellow",
|
||||
// secondaryColour: "#FFFF00",
|
||||
// signatureColour: "#272727",
|
||||
signatureColour: "#005bb0",
|
||||
signatureAccentColour: "#fff",
|
||||
auth0ClientId: import.meta.env.VITE_AUTH0_STREAMLINE_CLIENT_ID,
|
||||
redirectOnLogout: false,
|
||||
logoutRedirectTarget: "",
|
||||
darkLogo: StreamlineLogo,
|
||||
lightLogo: StreamlineLogo,
|
||||
transparentLogoBG: false,
|
||||
blacklist: [],
|
||||
hotjarID: import.meta.env.REACT_APP_HOTJAR_ID_BXT,
|
||||
docs: "Platform",
|
||||
protips: protips,
|
||||
homePage: "/devices"
|
||||
};
|
||||
|
||||
export function isBXT(): boolean {
|
||||
return getName() === "Brand X Technologies";
|
||||
}
|
||||
|
|
@ -157,6 +180,14 @@ export function IsAdaptiveAgriculture(): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
export function IsStreamline(): boolean {
|
||||
return (
|
||||
getName() === "Streamline"
|
||||
// window.location.origin.includes("staging") ||
|
||||
// window.location.origin.includes("localhost")
|
||||
);
|
||||
}
|
||||
|
||||
const AEROGROW_WHITE_LABEL: WhiteLabel = {
|
||||
name: "AeroGrow",
|
||||
primaryColour: "green",
|
||||
|
|
@ -254,6 +285,7 @@ export function IsOmniAir(): boolean {
|
|||
}
|
||||
|
||||
const whitelabels = new Map<string, WhiteLabel>([
|
||||
["streamline", STREAMLINE_WHITE_LABEL],
|
||||
["adaptiveag", ADAPTIVE_AGRICULTURE_WHITE_LABEL],
|
||||
["adaptiveagriculture", ADAPTIVE_AGRICULTURE_WHITE_LABEL],
|
||||
["brandxducks", BXT_WHITE_LABEL],
|
||||
|
|
@ -276,6 +308,9 @@ export function getWhitelabel(): WhiteLabel {
|
|||
if (window.location.origin.includes("bxt-dev")) {
|
||||
return BXT_WHITE_LABEL;
|
||||
}
|
||||
if (window.location.origin.includes("localhost")) {
|
||||
return STREAMLINE_WHITE_LABEL;
|
||||
}
|
||||
if (window.location.origin.includes("staging") || import.meta.env.VITE_LOCAL_STAGING=='true') {
|
||||
return STAGING_WHITELABEL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { createContext, useContext, useMemo, useState } from "react";
|
||||
import { ThemeProvider, createTheme, PaletteMode } from "@mui/material/styles";
|
||||
import { ThemeProvider, PaletteMode } from "@mui/material/styles";
|
||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||
import { getTheme } from "./theme";
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { useNavigate } from "react-router-dom";
|
|||
import TeamDialog from "teams/TeamDialog";
|
||||
import AccessObject from "./AccessObject";
|
||||
import { useSnackbar, useUserAPI } from "hooks";
|
||||
import { useThemeMode } from "theme/AppThemeProvider";
|
||||
// import { useThemeMode } from "theme/AppThemeProvider";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
accessIcon: {
|
||||
|
|
@ -76,7 +76,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||
|
||||
export default function UserMenu() {
|
||||
|
||||
const { toggleMode } = useThemeMode()
|
||||
// const { toggleMode } = useThemeMode()
|
||||
const [{ user, team, as }, dispatch] = useGlobalState();
|
||||
const { loginWithRedirect } = useAuth0();
|
||||
const classes = useStyles();
|
||||
|
|
@ -163,10 +163,6 @@ export default function UserMenu() {
|
|||
<Lock className={classes.rightIcon} fontSize="small" />
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<IconButton onClick={/*toggleMode*/ () => {}} className={classes.rightIcon} aria-label="Toggle Theme">
|
||||
<ThemeIcon />
|
||||
</IconButton>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue