mirror of
https://github.com/fleetdm/fleet
synced 2026-05-01 02:17:21 +00:00
# Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [ ] Documented any API changes (docs/Using-Fleet/REST-API.md or docs/Contributing/API-for-contributors.md) - [ ] Documented any permissions changes - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features. - [ ] Added/updated tests - [ ] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [ ] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)). --------- Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import React, { ReactChild, useContext } from "react";
|
|
import classnames from "classnames";
|
|
import { formatDistanceToNow } from "date-fns";
|
|
|
|
import SandboxExpiryMessage from "components/Sandbox/SandboxExpiryMessage";
|
|
import AppleBMTermsMessage from "components/MDM/AppleBMTermsMessage";
|
|
|
|
import SandboxGate from "components/Sandbox/SandboxGate";
|
|
import { AppContext } from "context/app";
|
|
|
|
interface IMainContentProps {
|
|
children: ReactChild;
|
|
/** An optional classname to pass to the main content component.
|
|
* This can be used to apply styles directly onto the main content div
|
|
*/
|
|
className?: string;
|
|
}
|
|
|
|
const baseClass = "main-content";
|
|
|
|
/**
|
|
* A component that controls the layout and styling of the main content region
|
|
* of the application.
|
|
*/
|
|
const MainContent = ({
|
|
children,
|
|
className,
|
|
}: IMainContentProps): JSX.Element => {
|
|
const classes = classnames(baseClass, className);
|
|
const {
|
|
sandboxExpiry,
|
|
config,
|
|
isSandboxMode,
|
|
isPremiumTier,
|
|
noSandboxHosts,
|
|
} = useContext(AppContext);
|
|
|
|
const isAppleBmTermsExpired = config?.mdm?.apple_bm_terms_expired;
|
|
|
|
const sandboxExpiryTime =
|
|
sandboxExpiry === undefined
|
|
? "..."
|
|
: formatDistanceToNow(new Date(sandboxExpiry));
|
|
|
|
return (
|
|
<div className={classes}>
|
|
{isAppleBmTermsExpired && isPremiumTier && !isSandboxMode && (
|
|
<AppleBMTermsMessage />
|
|
)}
|
|
<SandboxGate
|
|
fallbackComponent={() => (
|
|
<SandboxExpiryMessage
|
|
expiry={sandboxExpiryTime}
|
|
noSandboxHosts={noSandboxHosts}
|
|
/>
|
|
)}
|
|
/>
|
|
{children}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default MainContent;
|