useMMAppParams
Returns properties for controlling behavior when embedded in the MachineMetrics platform.
Usage
import { useMMAppParams } from '@machinemetrics/mm-react-tools';
function EmbeddedApp() {
const {
isConfiguring, // prevent data loading required only by setting forms
isEmbedded, // trigger different behavior when loaded in embeddable zone
colorMode, // "dark" or "light" - use it to drive chakra setColorMode
isFullScreen, // hide certain components like filters when in full screen mode
} = useMMAppParams();
return (
<div>
{isConfiguring && <div>Configuring app...</div>}
{isEmbedded && <div>Running in embedded mode</div>}
<div>Current color mode: {colorMode}</div>
{isFullScreen && <div>Running in full screen mode</div>}
</div>
);
}
Returns
Returns an object containing:
isConfiguring
: Boolean indicating if the app is in configuration modeisEmbedded
: Boolean indicating if the app is running in an embeddable zonecolorMode
: String indicating the current color mode ("dark" or "light")isFullScreen
: Boolean indicating if the app is running in full screen mode