Merge branch 'new_header' into dev_environment
This commit is contained in:
commit
d6603e394e
4 changed files with 31 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
appBar: {
|
appBar: {
|
||||||
zIndex: theme.zIndex.drawer + 1,
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
backgroundImage: "none", // This prevents de-saturation of header in dark mode
|
backgroundImage: "none", // This prevents de-saturation of header in dark mode
|
||||||
backgroundColor: theme.palette.mode === "light" ? "#3b3b3b" : "#272727"
|
backgroundColor: theme.palette.header.main
|
||||||
},
|
},
|
||||||
toolbar: {
|
toolbar: {
|
||||||
marginLeft: theme.spacing(0.5),
|
marginLeft: theme.spacing(0.5),
|
||||||
|
|
@ -128,4 +128,4 @@ export default function Header() {
|
||||||
{isMobile && <BottomNavigator setNavOpen={isOpen => {setNavOpen(isOpen)}} sideIsOpen={navOpen} />}
|
{isMobile && <BottomNavigator setNavOpen={isOpen => {setNavOpen(isOpen)}} sideIsOpen={navOpen} />}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -513,11 +513,12 @@ export default function ComponentSettings(props: Props) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isCableComponent = () => {
|
const hasCableID = () => {
|
||||||
return (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE ||
|
return (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE ||
|
||||||
formComponent.settings.type ===
|
formComponent.settings.type ===
|
||||||
quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE ||
|
quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE ||
|
||||||
formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_PRESSURE_CABLE ||
|
formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_PRESSURE_CABLE ||
|
||||||
|
formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE ||
|
||||||
(formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE &&
|
(formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE &&
|
||||||
formComponent.subType() ===
|
formComponent.subType() ===
|
||||||
quack.CapacitorCableSubtype.CAPACITOR_CABLE_SUBTYPE_FROG))
|
quack.CapacitorCableSubtype.CAPACITOR_CABLE_SUBTYPE_FROG))
|
||||||
|
|
@ -583,7 +584,8 @@ export default function ComponentSettings(props: Props) {
|
||||||
)}
|
)}
|
||||||
</TextField>
|
</TextField>
|
||||||
{supportsExpansion() && setExpLine()}
|
{supportsExpansion() && setExpLine()}
|
||||||
{(isCableComponent() && !supportsExpansion())&& setComponentAddrType()}
|
|
||||||
|
{(hasCableID() && !supportsExpansion())&& setComponentAddrType()}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : activeStep === 1 ? (
|
) : activeStep === 1 ? (
|
||||||
<ComponentForm
|
<ComponentForm
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ const protips: string[] = [
|
||||||
"Want to receive text messages about your devices? Update your phone number and enable SMS notifications!"
|
"Want to receive text messages about your devices? Update your phone number and enable SMS notifications!"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const DEFAULT_HEADER_COLOUR = "#1f2a35";
|
||||||
|
|
||||||
export interface WhiteLabelFeatures {
|
export interface WhiteLabelFeatures {
|
||||||
bins: boolean;
|
bins: boolean;
|
||||||
visualFarm: boolean;
|
visualFarm: boolean;
|
||||||
|
|
@ -55,6 +57,7 @@ interface WhiteLabel {
|
||||||
secondaryColour: any;
|
secondaryColour: any;
|
||||||
signatureColour: any;
|
signatureColour: any;
|
||||||
signatureAccentColour: any;
|
signatureAccentColour: any;
|
||||||
|
headerColour?: any;
|
||||||
auth0ClientId: string;
|
auth0ClientId: string;
|
||||||
redirectOnLogout: boolean;
|
redirectOnLogout: boolean;
|
||||||
logoutRedirectTarget: string;
|
logoutRedirectTarget: string;
|
||||||
|
|
@ -444,6 +447,14 @@ export function getSignatureColour(): any {
|
||||||
return getWhitelabel().signatureColour;
|
return getWhitelabel().signatureColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getHeaderColour(): any {
|
||||||
|
return getWhitelabel().headerColour ?? DEFAULT_HEADER_COLOUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHeaderColor(): any {
|
||||||
|
return getHeaderColour();
|
||||||
|
}
|
||||||
|
|
||||||
export function getSignatureAccentColour(): any {
|
export function getSignatureAccentColour(): any {
|
||||||
return getWhitelabel().signatureAccentColour;
|
return getWhitelabel().signatureAccentColour;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,21 @@
|
||||||
import * as Colours from "@mui/material/colors"
|
import * as Colours from "@mui/material/colors"
|
||||||
import { createTheme, ThemeOptions } from '@mui/material/styles';
|
import { createTheme, ThemeOptions } from '@mui/material/styles';
|
||||||
import {
|
import {
|
||||||
|
getHeaderColor,
|
||||||
getPrimaryColour,
|
getPrimaryColour,
|
||||||
getSecondaryColour,
|
getSecondaryColour,
|
||||||
} from "../services/whiteLabel";
|
} from "../services/whiteLabel";
|
||||||
|
|
||||||
|
declare module "@mui/material/styles" {
|
||||||
|
interface Palette {
|
||||||
|
header: Palette["primary"];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PaletteOptions {
|
||||||
|
header?: PaletteOptions["primary"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const baseTheme: ThemeOptions = {
|
const baseTheme: ThemeOptions = {
|
||||||
palette: {
|
palette: {
|
||||||
mode: 'light', // default mode; will be overridden by system if needed
|
mode: 'light', // default mode; will be overridden by system if needed
|
||||||
|
|
@ -62,6 +73,9 @@ export const getTheme = (mode: 'light' | 'dark') =>
|
||||||
...baseTheme.palette,
|
...baseTheme.palette,
|
||||||
primary: makePaletteColor(getPrimaryColour()),
|
primary: makePaletteColor(getPrimaryColour()),
|
||||||
secondary: makePaletteColor(getSecondaryColour()),
|
secondary: makePaletteColor(getSecondaryColour()),
|
||||||
|
header: {
|
||||||
|
main: getHeaderColor(),
|
||||||
|
},
|
||||||
mode,
|
mode,
|
||||||
...(mode === 'dark'
|
...(mode === 'dark'
|
||||||
? {
|
? {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue